[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: HTTP Request Header
Additional header is relatively easy to add. You create a procedure that will return your headers. Then you set an exit point that points to your procedure. The exit point is called during the send and sends whatever the procedure says. Headers end with CRLF so be sure to include as part of the string (see below).
To set the exit point, put this in the main:
http_xproc( HTTP_POINT_ADDL_HEADER
: %paddr(YourHeaderProcedureNameHere) );
The procedure pointed to by the %paddr looks like this:
D addl_headers PR ExtProc(
D peAddlHdrs 32767A varying
D peUserData * value
And can be coded similar to this (notice you do not have to do anything with the peUserData unless you want to. This would be for passing in your data):
P YourHeaderProcedureNameHere...
B
D PI
D headers 32767a varying
D CRLF C x'0d25'
headers = 'X-Standardize-Only: true' + CRLF;
P E
-----Original Message-----
From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx [mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Chris Edmondson
Sent: Tuesday, September 8, 2015 7:21 PM
To: ftpapi@xxxxxxxxxxxxxxxxxxxxxx
Subject: HTTP Request Header
Hi Scott,
I'm using your http api on As400 at v6r1 to submit address validation requests to smartystreets.com street address validation web service. I'm creating a GET request which is working great but, in order to get some additional information from the web service, I need to specify a certain http request header. I cannot figure out how to do this, am hoping you can point me in the right direction.
Here's what smartystreets says I need to send:
https://smartystreets.com/docs/address#http-request-headers
Specifically it's the first one, X-Standardize-Only: true.
This is the code which presently works:
>
> url = 'https://api.smartystreets.com/street-address'
> + '?auth-id=xxxxxxxx'
> + '&auth-token=xxxx';
> Form = WEBFORM_open();
> WEBFORM_setVar(Form : 'street' : %trim(adrs));
> WEBFORM_setVar(Form : 'secondary' : %trim(adrs2));
> WEBFORM_setVar(Form : 'city' : %trim(city));
> WEBFORM_setVar(Form : 'state' : %trim(state2));
> WEBFORM_setVar(Form : 'zipcode' : %trim(zip));
>
> url = url + WEBFORM_getData(Form);
>
> WEBFORM_Close(Form);
>
>
> rc = http_url_get(url: tempFile);
>
>
Thanks,
--
Chris Edmondson
509.670.6817
-----------------------------------------------------------------------
This is the FTPAPI mailing list. To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------