http get with authorization

Posted by smartsysISV on 11-Oct-2014 12:35

I want to call a webservice with this http-get command

This is an authenticated service and I need to send this header:
Authorization: Bearer ack5yfdffzbdtgjq44cjgm2j54s
Content-Type: application/x-www-form-urlencoded

How can I attach the autorization in the request-header?

Posted by pvorobie on 13-Oct-2014 13:38

You can also use

rbv_api.sendJSONRequest(url, null, "GET", contentType, username, password, headers)

If you pass username and password, this API will add basic authentication header for you. Otherwise use last parameter to pass HTTP headers.

All Replies

Posted by Godfrey Sorita on 13-Oct-2014 12:25

Can you provide more information on how you are sending this request? Rollbase can send GET requests using either 'Send HTTP GET Request' trigger type or 'rbv_api.sendHttpGet' API.

Also, have you considered using 'Send HTTP POST Request' trigger type? For this particular trigger type, the HTTP header can be configured on the trigger properties.

Posted by pvorobie on 13-Oct-2014 12:28

rbv_api.senfHttpPost API can include array of HTTP headers as well.

Posted by smartsysISV on 13-Oct-2014 13:17

OK, I used the 'Send HTTP GET Request' trigger type, but I can of course switch to the 'rbv_api.sendHttpGet'.

Can anyone tell me how to attach the http headers?

Posted by pvorobie on 13-Oct-2014 13:38

You can also use

rbv_api.sendJSONRequest(url, null, "GET", contentType, username, password, headers)

If you pass username and password, this API will add basic authentication header for you. Otherwise use last parameter to pass HTTP headers.

Posted by smartsysISV on 13-Oct-2014 13:59

Thank you, this works fine!

This thread is closed