Page 1 of 2

HTTPAPI

Posted: Thu Feb 22, 2024 8:18 pm
by freelance
Hi Scott, wanted to confirm if HTTPAPI needs apache server to be on ?

If yes, then do we need to configure the config file /www/apachedft/conf/httpd.conf for the same ?

-Parag

Re: HTTPAPI (example 7)

Posted: Thu Feb 22, 2024 8:26 pm
by stefan@tageson.se
Absolutely not, httpapi is client software not server-based software

Re: HTTPAPI

Posted: Thu Feb 22, 2024 8:56 pm
by freelance
ok great. Thanks

But in my case, I would be attempting to POST .JSON file from IFS folder to 3rd party website.

Will change this segment as follows -

0087.00 rc = http_url_post_stmf('http://www.scottklement.com/httpapi' --> ('https://seller-us.tiktok.com/product'
0088.00 + '/manage'
0089.00 : tempFile
0090.00 : '/tmp/http_result.txt' --> : '/tmp/http_result.json'
0091.00 : HTTP_TIMEOUT
0092.00 : HTTP_USERAGENT
0093.00 : ContentType );


0063.00 // In this case, the HTTPAPI handout that was downloaded --> Can I comment this segment out ? Any pgm impact ?
0064.00 // in EXAMPLE1 will be added to the temp file
0065.00 //
0066.00
0067.00 http_mfd_encoder_addstmf( enc
0068.00 : 'handout'
0069.00 : '/tmp/Scott''s HTTPAPI +
0070.00 presentation handout.pdf'
0071.00 : 'application/octet-stream');

Can you respond on this ? So, far got no answer.

Re: HTTPAPI

Posted: Fri Mar 01, 2024 5:00 pm
by freelance
Hi there,

I am looking to use Example7 api pgm for my use, which contains the following -

H BNDDIR('HTTPAPI')

/copy httpapi_h
/copy ifsio_h

~~~
But, we have following in the LIBHTTP lib.
Don't see / missing binding directory HTTPAPI BND in here. So, pl advise on this. <--

File . . . . . . QSRVSRC
Library . . . . LIBHTTP

Type options, press Enter.
2=Edit 3=Copy 4=Delete
8=Display description 9=Save 1

Opt Member Type Text
EXPAT BND
HTTPAPI1 BND
HTTPAPI2 BND
LICENSE TXT

So also, we don't see / missing httpapi_h, ifsio_h in here. So, pl advise on this. <--

File . . . . . . EXPAT
Library . . . . LIBHTTP

Type options, press Enter.
2=Edit 3=Copy 4=Delete
8=Display description 9=Save

Opt Member Type Tex
EXPAT_ST.D C
EXPATW.DSP C
EXPATW_S.D C
IASCIITA.H C
INTERNAL.H C

Thus, we running into compilation errors on this pgm Example7.

9 /copy httpapi_h
======> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
*RNF0273 40 a 000900 Compiler not able to open the /COPY or /INCLUDE fil
directive ignored.
10 /copy ifsio_h
======> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
*RNF0273 40 a 001000 Compiler not able to open the /COPY or /INCLUDE fil
directive ignored.

*RNF0273 40 2 Compiler not able to open the /COPY or /INCLUDE file;
directive ignored.
* * * * * E N D O F M E S S A G E S U M M A R Y * * * * *

Compilation stopped. Severity 40 errors found in program.

So, pl advise on this.
Thanks

Re: HTTPAPI

Posted: Fri Mar 01, 2024 6:36 pm
by Scott Klement
Do you not have a QRPGLESRC file? Kinda sounds like someone installed it and then deleted that file.

Re: HTTPAPI (JSON2WEB.rpgle) ~ new pgm

Posted: Sun Mar 03, 2024 4:54 pm
by freelance
Hi Scott,

We switchover to HTTPAPI from YAJL- JSONWEDSRV.sqlrpgle; since this routine was not suitable for our requirement.
We re-installed running the CL install pgm again taking EXPAT opt - 'N' and that produced no error msg. Installation was successful.

Besides, showing you the API defination/segment; HTTPAPI forum message as on Fri Mar 01, 2024 4:48 pm

We are trying to post our AS/400-IFS xxx.JSON file data onto 3rd party website i.e. Titok seller center ('https://seller-us.tiktok.com/product/manage').
That one requires us to login with our Tiktok acc id to access Tiktok shop acc and access the seller center postings page.

So, typically we would need to accommodate API keys i.e. Oauth2 (public & private keys) in our HTTPAPI defination/code segment.
Postman is a manual option we got. Or would GETURI be a good option in this scenario ?

SINCE, jsonwebsrv routine was not suitable; we switched over to HTTPAPI Example7 and made our changes accordingly in there.

Now, would want you to review that API defination/segment that we have put up.

So, pl respond ASAP with your thoughts. Thanks

Re: HTTPAPI

Posted: Mon Mar 04, 2024 3:43 am
by Scott Klement
I'm happy to answer questions about HTTPAPI.

If you want me to create a TIktok account and research their APIs, then determine how to code them, so I can decide if your approach works and provide guidance, that's asking an awful of me. I'd be willing to do it for a consulting fee. But it's too much work to do for you for free.

Again, I'm happy to answer questions about the tool.

As for GETURI, it is a commercial product from Bradley Stone. It is similar to HTTPAPI, does the same sort of work, etc. It is just a commercial tool vs HTTPAPI being open source. I am no expert on GETURI. Either one will work.

I also work for Midrange Dynamics, who sells a commercial tool that does a LOT more for you if you're looking for commercial tools, please give some thought to that.

Re: HTTPAPI

Posted: Mon Mar 04, 2024 4:31 am
by jonboy49
There's another thread on the same topic here Scott. https://www.scottklement.com/forums/vie ... 2000#p2000

As you'll see I've been saying the same thing about tooling but for some reason he is unwilling or unable to supply the API detais.

Re: HTTPAPI

Posted: Mon Mar 04, 2024 4:18 pm
by freelance
Here .. pl see attachment

Re: HTTPAPI

Posted: Mon Mar 04, 2024 4:55 pm
by freelance
Here are Tiktok API details you needed to view .. for better understanding

https://seller-us.tiktok.com/product/manage is the endpoint. AS/400-IFS file .json data to be posted onto this URL.

FYI- my other pgm generates that .json data and stores it into IFS path file /tmp/makejson1.json

But, we also need to worry about OAuth access token inside this Tiktok account, which I access using my id(credentials)