REST HTTP POST action? - Forum - Rollbase - Progress Community

REST HTTP POST action?

 Forum

REST HTTP POST action?

  • Another site's API wants me to send an HTTP POST action using REST by sending an XML file to do creates/updates in their system... how would I do that in Rollbase? Steps their API asks me to take to set it up: 1) Set http header Authorization using Basic Authentication. 2) Set http header Accept to 'text/xml'. 3) Issue POST 4) Content Type set to text/xml 5) Set the request body to XML 6) On successful creation of a new user, the HTTP Status code will be 201 for created and the Location header value will be the URI to the resource. 7) On successful update of an already existing user, the HTTP Status code will be 303 and the Location header value will be the URI to the updated resource. 8) On failure, the HTTP Status code will be 400 and the error message(s) will be contained in the entity body. Thanks, Ian
  • You can do points from 2 to 5. Not sure about Basic Authentication - what's required for this?
    As for processing response, this is not possible at a moment, but I will enable this through new server-side API. Please check back on this in about a week.
  • OK, I'm still not sure what to choose if I only want to do 2-5.

    (1) Send REST Request, (which is only HTTP GET)?
    --or--
    (2) Send SOAP Request, (which is not REST)?

    How do I do HTTP POST (write some JS in an object script trigger?)

    Ya I'm not sure about the authentication. When I was using the read functionality of their API through browser calls, it just prompted me for my user/pass.

    Thx.
  • REST means nothing but HTTP GET.
    SOAP means HTTP POST.

    What I plan to add: in a trigger(s) which will follow these two in a chain of triggers you'd be able to use values from HTTP response.
  • I think this is the request I'd like to send:

    POST /introREST/User/{!email} HTTP/1.1
    Host: connect.mydomain.com
    Authorization: Basic user:pass
    Accept: text/xml



    false
    {!email}
    ...
    {!in_username}
  • I've implemented changes to HTTP POST trigger - please check out documentation. Also, for timely updates you can now use my twits:
    http://twitter.com/pvorobiev
  • Pavel,
    Thanks for the updates. I believe I need another instruction.

    I need to be able to populate the "Target URL" for the trigger with an "integration link" (or be able to use tokens)

    Suggestion?
  • But you can include all info in POST request, why do you need to modify URL ?
  • Yea I see your point. But, the target API isn't my design, and that's how the counterpart wants it... the target URL must include the email of the new user for which the api call is creating.

    Can it be done? (if not, can you suggest an alternative?)

    Thanks, Ian
  • Can you construct HTTP POST body in form

    name1=value1&name2=value2&name3=value3

    I think this way you can pass any number of parameters in POST request.