REST post webservice

I am trying to create a restful webservice that will accept a “post” method and have IS act as the server of this webservice.

I understand the concept of the get method were the $resourceID is part of the URL and have created several get webservices, I also understand how to use the $path and other optional paramaters with the ?name=value&… all within the URL, however if there are 25 different name-value pairs that have to be supplied for a “post” I wouldn’t think you would code these all within the URL to execute, you would instead include this data within the request header such as in the example given in the REST Developer’s guide 8.2.

Documentation for the Discussion example might provide the following examples to illustrate body structure: [FONT=Palatino Linotype,Palatino Linotype][SIZE=3][FONT=Palatino Linotype,Palatino Linotype][SIZE=3]Example 1: Creating a new topic
[/size][/font][/SIZE][/FONT]Request:
[FONT=Letter Gothic MT,Letter Gothic MT][SIZE=1]POST http://IS_server:5555/discussion/topic
Authorization: BASIC
Content-Length:
Content-Type: <application/x-www-form-urlencoded; utf-8>

[/SIZE][/FONT]Response: If the request was valid, the Discussion application will respond with the following
[FONT=Letter Gothic MT,Letter Gothic MT][SIZE=1]HTTP/1.1 201 Created
Content-Length: 0
ETag: 32619Location: [url]http://host/discussion/topic/32619[/url]

How do I retrieve the request headers and extract out all of the “topic” information that would be need to create a new topic if there are 25 different “pairs” of information?[/SIZE][/FONT]

I think you may be mixing “get” and “post”. A post won’t have name/value pairs in the URL. A post would have a body of some sort, typically XML, that would have the data being HTTP post’ed.

An HTTP get wouldn’t have that many parameters, unless you’re implementing a search of some sort that is designed around field names instead of query string of some kind. And yes, you would code these all within the URL if you had 1, 2, 10 or 25 parameters–that’s how get works.

In neither case would you create your own name-value pairs in the HTTP header.

Thanks for the reply.
You state “A post would have a body of some sort, typically XML,” How do I retrieve this XML data into the _post flow service?

The content handlers of IS will do this for you. When the content type of the post is text/xml (application/xml, and possibly other types) it will be available in the pipeline as “node” when your service is invoked.

Thanks, for the help. When I added the xmlNodeToDocument I was finally able to see the request header data.

Hi,

Can u pls tell me, how the req to the RET web service would be authenicated when the sevice is invoked from outsid the hom env (Client env)?

As in, the client would be prompted for USer/ID pasword ? Or it should be embedded in the URL ? how should we create the URL in that case?

For ex, when within the network, the server would prompt for the user/pwd but how should it be handled form the client network ? As in, the IS should first accept the request and then it would hit the service.

Thanks,
Priya

Can someone help me with how i can retrieve the value of $resourceID and $path in the flow service. I am able to invoke my _get service, however when try to “see” the value of $resourceID in the pipeline (through save pipeline) or get it as output via variable substitution i dont get anything.

Hello,

I have a totally same issue like Basheer, $resourceID and $path are not visible in pipeline. The invoking of services (_get, _post, _put, _delete) works fine. I’m on 9.5. Any idea where an issue can lie? Thanks

@Basheer Did you solve that anyhow?

Did you make use of getTransportInfo service, can you please give a try.

Thanks,

They should be passed to the service by the server. Do you use the “rest” directive for calling the service? I.e. does the URL you’re using look like http://server/[b]rest[/b]/