This is the program I tried to make using LIBHTTP:
H dftactgrp(*no) actgrp(*new)
H bnddir('HTTPAPI') option(*srcstmt)
/define WEBFORMS
/copy httpapi_h
D addSpecialHeaders...
D PR
D headersToAdd 32767A varying
D vars likeds(headerVars) const
D headerVars ds qualified
D acceptType 100a varying
D apikey 100a varying
D form s like(WEBFORM)
D url s 1000a varying
D msg s 1000a varying
D errnum s 10i 0
D rc s 10i 0
/free
// Turn'on debugging -- probably want this to be *OFF
// when in production.
http_debug(*on);
// Create a URL with a properly encoded query string:
// form = WebForm_open();
// WebForm_setVar(form: qry);
url = '';
// WebForm_close(form);
// Tell HTTPAPI to use an "exit procedure" that is a subprocedure
// called when it's adding headers to the URL. Pass the API
// key and content-type to accept to the exit procedure when
// the time comes.
headerVars.acceptType = 'Content-Type';
headerVars.apiKey = 'application/json';
http_xproc( HTTP_POINT_ADDL_HEADER
: %paddr(addSpecialHeaders)
: %addr(headerVars) );
headerVars.acceptType = 'X-Shopify-Access-Token';
headerVars.apiKey = 'shppa_123456789013456790123456790';
http_xproc( HTTP_POINT_ADDL_HEADER
: %paddr(addSpecialHeaders)
: %addr(headerVars) );
// Perform a GET request and save the result to a file in the IFS.
rc = http_get( url: '/home/test/http.txt' );
if rc <> 1;
msg = http_error();
http_error(errnum);
http_crash();
endif;
*inlr = *on;
/end-free
P addSpecialHeaders...
P B
D PI
D headersToAdd 32767A varying
D vars likeds(headerVars) const
D CRLF C x'0d25'
/free
headersToAdd = 'accept: ' + vars.acceptType + CRLF
+ 'apikey: ' + vars.apiKey + CRLF;
/end-free
P E
and this is the log when I try to run it:
> call tst_http
(GSKit) Il valore dell'identificatore non è valido.
(GSKit) "Peer" non riconosciuto o è stato ricevuto un messaggio formattato
non correttamente.
SSL Handshake: (GSKit) "Peer" non riconosciuto o è stato ricevuto un
messaggio f
/* */
thank you
Fulvio
I think he's asking for examples of calling Shopify. (I don't have any, but others might? Not sure what Shopify is...)
On 9/4/2020 3:12 PM, Jon Paris wrote:
It might help if you told us what problem you are experiencing.
-- _______________________________________________ Ftpapi mailing list Ftpapi@xxxxxxxxxxxxxxxxxxxxxx http://scottklement.com/mailman/listinfo/ftpapi