[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Ftpapi] I'm obviously missing something ...
I don't know why you are getting the '401' error? Possibly there's a
problem with the Bearer token you're using? When a login fails, the
HTTP protocol typically will just re-send the 401 error. So if you give
a bad userid/password, it'll simply say '401, I need a userid/password'
or if you give a bad bearer token, same thing, etc.
Its not clear why you are adding a 'content-type' here. Content-type is
meant to tell the receiving system what sort of data is being sent. In
this example, you are doing a GET request, so it is not sending any sort
of data (aside from the URL itself, but content-type does not relate to
I'd also recommend switching to use the newer APIs such as http_string,
http_stmf or http_req rather than the old stuff like http_get. It
really shouldn't matter for what you're doing, but as it gets more
sophisticated, you'll find the old routines like http_get are difficult
On 5/4/2020 12:00 PM, Jon Paris wrote:
Cross-posted to HTTPAPI and WEB400
I just coded up a basic Zoom API request - this is the basic HTTPAPI code:
url = 'https://api.zoom.us/v2/webinars/' +
%EditC(webinarId: 'X') +
headerVars.contentType = 'application/json';
headerVars.authorization = 'Bearer mySecrtetCodeGoesHere';
: %addr(headerVars) );
rc = http_get( url: '/tmp/result.txt' );
if rc <> 1;
vars likeds(headerVars) const;
Dcl-C CRLF x'0d25';
headersToAdd = 'content-type: ' + vars.contentType + CRLF
+ 'authorization: ' + vars.authorization + CRLF;
This gives me a "401 - This page requires a user-id & password" error
If I copy/paste the credentials and URL into Insomnia and test it - it works. The user Id stuff is in the "secret key" bit.
Since I copied and pasted this stuff into insomnia from the RPG stuff I can only assume I missed a step somewhere. But where?
Ftpapi mailing list