IMO the built-in SQL functions are far and away the easiest way to do this if you're on a version that supports JSON in SQL. There is a really useful document here https://www.ibm.com/developerworks/community/wikis/form/anonymous/api/wiki/bb5007a3-d52b-44e4-a2bc-4e56b454ff0f/page/5ac75e56-a02f-425d-91a5-ab0719e65416/attachment/a24f17a3-093c-40b5-ad7b-943bbaaf9eb6/media/accessing_web_services_using_ibm_db2_for_i_udfs_and_udtfs.pdf where you will find examples. These examples are calls to SOAP/XML APIs but you should be able to work out easily enough how to use/parse a JSON body instead.

The machine I'm currently on is 7.1 but if you need an example using JSON I could knock one up when I'm on my own machine.

Tim.

________________________________

From: WEB400 <web400-bounces@xxxxxxxxxxxxxxxxxx> on behalf of mike smith via WEB400 <web400@xxxxxxxxxxxxxxxxxx>
Sent: 24 July 2019 21:24
To: web400@xxxxxxxxxxxxxxxxxx <web400@xxxxxxxxxxxxxxxxxx>
Cc: mike smith <rpg400allday@xxxxxxxxx>
Subject: [WEB400] Json using tokens

Hi , we need to connect another server from ibmi to pickup data in json documents. Any ideas or sample codes?

FYI- I have installed YAJL and able to connect to GET URL with success.

here are the requirements, where I could use some sample code.

1. Log in to second server using login and password
2. get token and post it token back to pick up json data.

many thanks
Mike
--
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://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.midrange.com%2Fmailman%2Flistinfo%2Fweb400&amp;data=02%7C01%7C%7Cbab7bfd2327b4b6f92b708d7106cb4f3%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636995931381776936&amp;sdata=3xhLBecznKQMPCkk3ZzGOB8aZsZ8FJ7siBVfC4pUTok%3D&amp;reserved=0
or email: WEB400-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Farchive.midrange.com%2Fweb400&amp;data=02%7C01%7C%7Cbab7bfd2327b4b6f92b708d7106cb4f3%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636995931381786941&amp;sdata=XupNT4XI54eT0UT2M4A9KZ%2BjadaBNCXKEC9%2Bg9hUSWM%3D&amp;reserved=0.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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

This mailing list archive is Copyright 1997-2024 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].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.