I added:

http_setAuth(HTTP_AUTH_NONE:'':'');

Just ahead of the http_get Charles and it made no difference. Still get the "requires user ..." 401 error.



On May 4, 2020, at 1:18 PM, Charles Wilt <charles.wilt@xxxxxxxxx> wrote:

Jon,

Try adding...
// if using Auth token next line need be here other wise it will
add
// BASIC auth by default.
http_setAuth(HTTP_AUTH_NONE:'':'');

Charles

On Mon, May 4, 2020 at 11:00 AM Jon Paris <jon.paris@xxxxxxxxxxxxxx> 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') +
'/tracking_sources';

headerVars.contentType = 'application/json';

headerVars.authorization = 'Bearer mySecrtetCodeGoesHere';

http_xproc( HTTP_POINT_ADDL_HEADER
: %paddr(addSpecialHeaders)
: %addr(headerVars) );

rc = http_get( url: '/tmp/result.txt' );
if rc <> 1;
http_crash();
endif;


Dcl-Proc addSpecialHeaders;
Dcl-Pi *N;
headersToAdd Varchar(32767);
vars likeds(headerVars) const;
End-Pi;

Dcl-C CRLF x'0d25';

headersToAdd = 'content-type: ' + vars.contentType + CRLF
+ 'authorization: ' + vars.authorization + CRLF;
End-Proc;


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?


Jon Paris
--
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400) mailing
list
To post a message email: WEB400@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/web400.


--
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400) mailing list
To post a message email: WEB400@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/web400.



This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2020 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].