Skip to content

How to interact with an external API #254

Answered by lovasoa
Ajotah98 asked this question in Q&A
Discussion options

You must be logged in to vote

@Ajotah98 : I posted an example here: https://replit.com/@pimaj62145/SQLPage-external-api-fetch?v=1

insert into friends (user_name, friend_name)
select people.value->>'name', friends.value->>'name'
from json_each(sqlpage.exec('curl', 'https://mocki.io/v1/83a2365c-9392-4a3d-8953-9b3ad4f3acb1')) people
join json_each(people.value, '$.friends') friends;

This is the SQLite syntax to iterate over json data. Depending on your database, the syntax may be different:

Replies: 4 comments 3 replies

Comment options

You must be logged in to vote
3 replies
@Ajotah98
Comment options

@lovasoa
Comment options

@Ajotah98
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by Ajotah98
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants