Page 3 of 3

Re: JSONWEBSRV.sqlrpgle

Posted: Sun Mar 03, 2024 10:46 pm
by jonboy49
Example 7 assumes that there is a website at the other end which is expecting multi-part form data and that one of the inputs is a file. It has no notion of authentication. It is also highly unlikely that the TikTok API works like that.
Refer to the TikTok API document I referenced earlier. That is the kind of document from TikTok you should work from. If you do not have that then talk to the person you are doing this work for and ask them for it. All we know so far is that the base URL for that service is https://seller-us.tiktok.com/product/manage - but we don't know the names etc. of any parameters. Nor do we don't know how the payload should be defined. etc. etc. From the example TikTok URL I posted you can see that TikTok's requirements are _very_ different than those for Example 7. It is likely that the TikTok APIs you are trying to use are similar.

Example 7 is just that an EXAMPLE that works under specific conditions - and those conditions are set by Scott's website. As I said before you cannot just change the URL and expect it to work - it won't.

Your last question, about keys, we cannot address until you have got the basics right - and you have not yet done that.

1) Look at the TikTok URL I posted
2) Locate similar documentation for the API you need to call.
3) If you still can't find documents then ask whoever tasked you to do this to give you the documents or at least to give you an example in another language. Java, Python, whatever ?
4) Show us the docs or the sameple. So far all we know is that the base URL to call is probably https://seller-us.tiktok.com/product/manage

PLEASE read all of this and respond to the questions if you want more help. Right now we are going around in circles because you are either not listening or we have a language issue - or both.

Re: JSONWEBSRV.sqlrpgle

Posted: Sun Mar 03, 2024 11:51 pm
by freelance
Ok I do understand every bit of it you stated.

So, would GETURI be a good option in this scenario ? Cause it's sample pgm expects bearer code used in Tiktok API.

OAuth is typically used with public & private keys.

Postman would be last resort. Manual upload of JSON data to URL.

Re: JSONWEBSRV.sqlrpgle

Posted: Mon Mar 04, 2024 12:10 am
by jonboy49
Ok I do understand every bit of it you stated.
I'm not sure you do or you wouldn't ask about GETURI. There is nothing that it can do that HTTPAPI can't. HTTPAPI is a perfectly good choice it can handle authentication just fine.

I'm not psychic and I can't help you unless I know the API's requirements. Without those, no tool is of any use to you. If you can do it with Postman great then do a trial run that way, have Postman generate the swagger doc and send that. I can work out what you need from HTTPAPI to achieve the same thing.

Most authentication these days, including I believe TikTok, will use public and private keys in some fashion.

JSON2WEB.rpgle (new HTTPAPI pgm)

Posted: Mon Mar 04, 2024 4:51 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)

Most authentication these days, including I believe TikTok, will use public and private keys in some fashion - you are right !
We need that as shown in snapshot.

But, don't see any authentication code segment in your Example7 !? Maybe we could fix that. Let's get started then.

Do share me your Example7 with neccessary code change, including oauth access token provision.

My existing new pgm code segment is here for your review ... !

SEU==> JSON2WEB
FMT ** ... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ...+.
0059.00 // post the results to the web server
0060.00
0061.00 rc = http_url_post_stmf('https://seller-us.tiktok.com/product'
0062.00 + '/manage'
0063.00 : tempFile
0064.00 : '/tmp/makejson1.json'
0065.00 : HTTP_TIMEOUT
0066.00 : HTTP_USERAGENT
0067.00 : ContentType );
0068.00
0069.00 if (rc <> 1);
0070.00 msg = http_error();
0071.00 dsply msg;
0072.00 return;
0073.00 endif;
0074.00
0075.00 QCMDEXC('DSPF ''/tmp/makejson1.json''': 200);
0076.00
0077.00 // delete temp files, we're done
0078.00
0079.00 unlink('/tmp/makejson1.json');
0080.00 unlink(tempFile);
0081.00
0082.00 return;
0083.00 /end-free
****************** End of data ****************************************

Re: JSONWEBSRV.sqlrpgle

Posted: Mon Mar 04, 2024 5:25 pm
by freelance
More Tiktok API details (parms) ..

Re: JSON2WEB.rpgle

Posted: Mon Mar 04, 2024 8:25 pm
by freelance
Hi Jonboy, any thoughts so far ?

Are we good with the info I provide related to API details !?

Re: JSONWEBSRV.sqlrpgle

Posted: Mon Mar 04, 2024 9:59 pm
by Scott Klement
As this thread is no longer related to JSONWEBSRV.sqlrpgle, I am going to close it. Please post follow-ups on the other thread.
https://www.scottklement.com/forums/viewtopic.php?t=441

It is very difficult to keep track of a conversation when information is split across two threads.