Using fetch_with_meta() on a list of elements to make multiple requests to a REST API #1103
Replies: 2 comments
-
|
Unfortunately there is no nice built-in way to do this in SQLPage. Either you do it from inside the database with https://github.com/pramsey/pgsql-http Or you do it from an external script with sqlpage.exec. |
Beta Was this translation helpful? Give feedback.
-
|
Thank you for your response. Unfortunately, I was expecting this answer. I have tried several approaches without success. It would be interesting to find a solution, as this is a common need when interfacing an SQLPage application with a REST API to cross-reference information with other applications in an information system. Could we consider a function batch_fetch_with_meta() that takes a JSON array as a parameter, makes the different requests, and returns the result in a JSON-formatted string? Something like this: The response would be composed of JSON objects, each describing the result of one of the requests. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I am encountering difficulties with the sqlpage.fetch_with_meta() function. For a project, I need to call a REST service that returns a list of identifiers. Subsequently, I need to use another REST service for each identifier to retrieve the data I require.
I have no issues calling the first service, which returns a JSON array. However, I am struggling to find a way to apply the fetch_with_meta() function to each element of this array.
What is a recommended approach to use fetch_with_meta() while iterating over a list of elements?
Best regards
Olivier
Beta Was this translation helpful? Give feedback.
All reactions