1 Reply Latest reply on Jun 19, 2009 4:06 PM by kolban1

    How to send a JSON string to a REST service with POST

    kolban1 Level 1

      Hi folks,

      I am trying to figure out how to send a REST request to a REST service that is expecting a JSON encoded string of parameters as the POST body in an HTTP request.

       

      When I look at the HTTPService functions, I see that the content type defined there can be one of:

       

      CONTENT_TYPE_FORM

      or

      CONTENT_TYPE_XML

       

      and if one of these are used, I can specify the content to send in the HTTPService.request property.

       

      But neither of these are useful to me in my situation.   I want to send a JSON string ... for example:

       

      {"Hello": "World", "Name": "Neil"}

       

      and can't seem to find a way to do this.

       

      The REST service doesn't want to receive a GET request, only a POST request with the JSON parameters in the payload.

       

      Anyone been here before or can offer any advice?

       

      Neil