Cannot do a PUT Using HTTP Client - Forum - OpenEdge Development - Progress Community

Cannot do a PUT Using HTTP Client

 Forum

Cannot do a PUT Using HTTP Client

This question is not answered

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

Jeff Ledbetter
Product Architect | Roundtable Software

All Replies
  • 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.

    Simon L Prinsloo

    www.vidisolve.com

  • 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.

    Jeff Ledbetter
    Product Architect | Roundtable Software

  • 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

    Regards,

    Irfan