I need a REST service to be called from my Glide app to work on a subset of data from a table.
How to best pass this subset to the service?
Can I query the data in Glide and wrap it up as JSON (or CSV) to put it in the HTTP body of a REST call?
Or should the REST service query the data itself in the Google sheet underlying the Glide app? Then I’d just need to pass to it query params.
Do you make the HTTP call right from the app? My thinking is you can create a JSON structure for each row, then join them together in the right structure using a joined list column.
Yes, the app will make the HTTP call: a URL will be generated which is passed to an image component. The URL will contain the data as JSON in a query parameter.
Generating the JSON for each row in a column in that row is a great idea! Thx!
But how to gather all this JSON in a joined list?
Example:
- There are users of the app
- Each user engages in many activities every day
That’s a 1:n relationship.
I now want to pass only a subset of activities of a user to the REST service. I need to query them.
Each activity row has its own JSON.
But how to query all the activities to join their JSON values into a JSON array?
The query column type doesn’t seem to exist anymore. It looked promising.
Great idea! So far there wasn’t a problem with URL encoding, but good to know.
Yes, I tried quickchart. I think a bar chart might serve my purpose. For the chart generation I would not need a pipedream flow. Nevertheless I wanted to check, how to integrate it with Glide and how to generate images in general in the backend.
Chart generation is not my problem anymore. It’s compiling the data that need to be passed to quickchart. See here: How to pass several records to a REST service?
Yes it does… Query column would be exactly the way to do it, then fetch a joined list through the query.
Ah, indeed! There it is! Great! Sorry I overlooked it.
Have to play around with it:
- Link activity records to user
- Select relevant records with query
- join JSON columns from selected records
- insert joined JSON into URL
- assign URL to image component
done!
sounds about right?
You may need a template column after step 3 to create a valid JSON string. Maybe something like:
{
{joined-list}
}
where {joined-list}
is replaced with your Joined List column.
And I need some code in the backend Because the selected data is not all that needs to be depicted in the bar chart. But that’s a detail. I don’t worry about it. What cost me a bit of a headache was the Glide side. But that I understand better now.
Thanks for your help!