[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Help with HTTPAPI
Hi Jeff,
On 6/22/2012 10:07 AM, Jeff Young wrote:
I have a project where I need to do the following:
1) Append the destination string "/import" to the URL:
[1]https://api.traceregister.com/import OR
[2]https://api.traceregister.com/training/import
You're right, HTTPAPI doesn't have much in the way of documentation...
That's something that needs to be fixed, unfortunately, I've been
struggling to find time.
Setting up a Wiki for HTTPAPI would be a good idea, IMHO.
Anyway, appending /import to a string isn't really part of HTTPAPI, it's
just concatenating two strings.
url = 'https://api.traceregister.com';
if (whatever);
url = url + '/import';
endif;
It's just typical RPG, right? The output of all of that gets passed to
HTTPAPI...
2) Create an HTTP Request using the modified URL, and set a header
attribute named "Authorization" equal to the Import Key:
request.header["Authorization"] = ImportKey
I've never seen code like this: request.header["Authorization"],. This
appears to be the instructions for some other HTTP tool aside from
HTTPAPI??
Assuming you're asking for a custom HTTP header to be added to your
request, however, it can be done by setting up an exit procedure that
runs for the HTTP_POINT_ADDL_HEADER exit point. HTTPAPI will call this
procedure while it's creating the HTTP request header, and you can add
your own string at that point.
3) Send the HTTP Request as a POST with the modified XML document
contents as the Request Payload.
The XML document is in a file on the IFS.
HTTPAPI has different POST routines, depending on how you'd like to
supply your input, and how you'd like to receive your output. I see
that the input should come from a stream file, but you haven't mentioned
how you want to receive the response.
The easiest one way to get started is to receive the response into
another stream file in the IFS... in which case, you should call the
http_url_post_stmf() routine.
From what I can determine, there is no form information available,
so how would I send the file with the above requirements?
I don't understand this question. What do you mean by "form
information"?
-----------------------------------------------------------------------
This is the FTPAPI mailing list. To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------