JSONWEBSRV.sqlrpgle

Discussions relating to the ScottKlement.com port of the open source YAJL JSON Reader/Generator. This includes the YAJL tool as well as the YAJLR4, YAJLGEN, YAJLINTO and YAJLDTAGEN add-ons from ScottKlement.com. http://www.scottklement.com/yajl/
jonboy49
Posts: 206
Joined: Wed Jul 28, 2021 8:18 pm

Re: JSONWEBSRV.sqlrpgle

Post 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.
freelance
Posts: 28
Joined: Wed Feb 21, 2024 2:38 pm

Re: JSONWEBSRV.sqlrpgle

Post 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.
jonboy49
Posts: 206
Joined: Wed Jul 28, 2021 8:18 pm

Re: JSONWEBSRV.sqlrpgle

Post 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.
freelance
Posts: 28
Joined: Wed Feb 21, 2024 2:38 pm

JSON2WEB.rpgle (new HTTPAPI pgm)

Post 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 ****************************************
Attachments
OAuth User API details (for Tiktok developer).JPG
OAuth User API details (for Tiktok developer).JPG (61.71 KiB) Viewed 428 times
Tiktok OAuth - 2 options.JPG
Tiktok OAuth - 2 options.JPG (30.71 KiB) Viewed 428 times
freelance
Posts: 28
Joined: Wed Feb 21, 2024 2:38 pm

Re: JSONWEBSRV.sqlrpgle

Post by freelance »

More Tiktok API details (parms) ..
Attachments
OAuth User API details (for Tiktok developer) ~2.JPG
OAuth User API details (for Tiktok developer) ~2.JPG (57.69 KiB) Viewed 414 times
OAuth User API details (for Tiktok developer) ~3.JPG
OAuth User API details (for Tiktok developer) ~3.JPG (89.83 KiB) Viewed 414 times
OAuth User API details (for Tiktok developer) ~4.JPG
OAuth User API details (for Tiktok developer) ~4.JPG (53.94 KiB) Viewed 414 times
freelance
Posts: 28
Joined: Wed Feb 21, 2024 2:38 pm

Re: JSON2WEB.rpgle

Post by freelance »

Hi Jonboy, any thoughts so far ?

Are we good with the info I provide related to API details !?
Scott Klement
Site Admin
Posts: 658
Joined: Sun Jul 04, 2021 5:12 am

Re: JSONWEBSRV.sqlrpgle

Post 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.
Locked