httpapi documentation

Use this board for starting discussions, asking questions, and giving advice on RPG programming for the IBM i platform (and predecessors.)
Theju112
Profound User
Posts: 48
Joined: Fri Jul 10, 2020 8:35 am
First Name: Thej
Last Name: Pav
Company Name: Confidential
Phone: 00918310800134
Address 1: Chennai
Address 2: India
City: Chennai
State / Province: Outside Canada/USA
Zip / Postal Code: 673592
Country: India
Contact:

httpapi documentation

Post by Theju112 »

pls let me know if there is any docs for httpapi ?

for eg, doc which describes parameters to pass to http_xproc?

I am struggling to understand below code. the http_strig is taking only the form_data as input..so how exactly is the form header used? Apologies my web knowledge is very limited.

Code: Select all

form_header = 'Authorization: Basic ' + %trim(WSBASE64) + CRLF;
http_xproc( HTTP_POINT_ADDL_HEADER : %paddr(setHeader));       
url = WSAUTURL;                                                
                                                               
//-------------------------------------------------------------
// Step 1 - Get ID Token                                       
//-------------------------------------------------------------
                                                               
  form_data =  'grant_type=client_credentials'                 
       //+ '&' + 'client_id=' + %Trim(WSCSKEY)                 
       //+ '&' + 'client_secret=' + %Trim(WSCSSEC)             
       + '&' + 'scope=openid';                                 
enJL = %len(%trim(form_data));                                 
                                                               
                                                               
clear retdata;                                                 
Monitor;                                                       
   retdata = http_string('POST': url : %trim(form_data) :      
                         'application/x-www-form-urlencoded'); 
Last edited by Theju112 on Thu Dec 16, 2021 2:04 am, edited 1 time in total.
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: httpapi documentation

Post by Scott Klement »

The "documentation" is in comments in the HTTPAPI_H member, as well as the examples named EXAMPLExx.
Theju112
Profound User
Posts: 48
Joined: Fri Jul 10, 2020 8:35 am
First Name: Thej
Last Name: Pav
Company Name: Confidential
Phone: 00918310800134
Address 1: Chennai
Address 2: India
City: Chennai
State / Province: Outside Canada/USA
Zip / Postal Code: 673592
Country: India
Contact:

Re: httpapi documentation

Post by Theju112 »

Hi Scott,

Also kindly help with the code snippet I have added to my original question.
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: httpapi documentation

Post by Scott Klement »

I don't understand why it is called "form_header" -- it appears to be an HTTP header (rather than a form header), specifically, it is someone's manual implementation of HTTP Basic Authentication. I don't understand why someone would code that, though... HTTPAPI has built-in support for basic authentication... why write it yourself?

Presumably, "form_header" is a global variable that is being utilitized by the SetHeader() subprocedure. It's hard to tell, however, since you haven't posted the code for the SetHeader() subprocedure, or the definition of "form_header", I don't know that for certain.

Perhaps you can ask whomever wrote it why they wrote it that way?
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests