PUT with If-Match Header?

Discussions related to HTTPAPI (An HTTP Client Package for RPG programming.) http://www.scottklement.com/httpapi/
Post Reply
heimo
Posts: 2
Joined: Wed Aug 25, 2021 9:32 am

PUT with If-Match Header?

Post by heimo »

I'm using HTTPAPI to syncronize different Databases.
Now I need to send Header-Informations with the PUT-Command.
Example:
PUT /SYSTEM/ODataV4/Company('COMP')/Customer('123456')
If-Match: W/"440112715"


With "POSTMAN" there is an own categorie "Headers" - but how to implement this in RPG ?
I use:
Response = http_string('PUT':URLCust:DataU:'application/json');
jonboy49
Posts: 207
Joined: Wed Jul 28, 2021 8:18 pm

Re: PUT with If-Match Header?

Post by jonboy49 »

Basically you will need to use http_xproc to declare the procedure to add the custom headers. This is called _before_ you call the http_... function to invoke the web service. The http API will then call your routine while building the request.

Here's a snippet of what I use to invoke Zoom APIs.

Code: Select all

      http_xproc( HTTP_POINT_ADDL_HEADER
                : %paddr(addSpecialHeaders)
                : %addr(authorizationToken) );
                
 ....
 
 Dcl-Proc addSpecialHeaders;
   Dcl-Pi *N;
      headersToAdd    Varchar(32767);
      var             like(authorizationToken) const;
   End-Pi;

   Dcl-c  CRLF  x'0d25';

   headersToAdd = 'authorization: ' + var + CRLF;

End-Proc;
heimo
Posts: 2
Joined: Wed Aug 25, 2021 9:32 am

Re: PUT with If-Match Header?

Post by heimo »

hey jonboy49!
thnx very much - it helped.
Post Reply