Cannot do a PUT Using HTTP Client

Posted by Jeff Ledbetter on 19-Aug-2019 14:54

Hi.

Are there known issues with making a PUT request with the HTTP ABL client? I am trying to send JSON.

My test case works as expected in a REST client (Insomnia) but fails when 403 when I use ABL.

I have no issues with GET requests to this same server. Any clues on where to start looking?

Code snippet:

httpClient = ClientBuilder:Build():Client.

httpRequest = RequestBuilder:Put(cPut,oPayload):ContentType('application/json'):UsingBasicAuthentication(credentials):Request.

httpResponse = httpClient:Execute(httpRequest).

MESSAGE httpResponse:StatusCode
  VIEW-AS ALERT-BOX

All Replies

Posted by Simon L. Prinsloo on 20-Aug-2019 06:43

Hi Jeff

The problem is with the user's access on the server. You authenticated successfully, otherwise you would have received 401, but you user does not have authorization to perform the action.

401 = Authentication failed or you did not even try to authenticate.

403 = You did successfully authenticate but you have no access to the given URL.

Posted by Jeff Ledbetter on 20-Aug-2019 13:00

Hi Simon. I agree that seems to be the case. The only "odd" thing is that it works fine using curl with the same credentials.

Posted by Irfan on 20-Aug-2019 17:18

Jeff, What kind of server are you trying to access ?

cURL sometimes explicitly set all  headers by default(like Accept: */*), where as in the HTTP Client it takes what you gave. I was seeing this problem while I was accessing PASOE OEManager REST API's. The accept type is not application/json, instead it is a application/vnd+progress+json

This thread is closed