Forum Academy Marketplace Showcase Pricing Features

Nested Json with Pagination to Thing - Catch 22

Below is a return from facebook graph api. It returns 25 results at a time which I have shortened to 2. I am able to parse the data and save each line as a new thing scheduling a backend workflow. However by making the api a “Data” rather than “Action” I am unable to tap into the last line which I need for pagination because you have to use the “data”: line in the JSON which is nested. “Next” is the url needed to call the next page using the same api. The only way I can access the “next url” is by running the api as an “Action”. However, you can’t parse the json into a new thing by scheduling an api workflow on a list / data created by an action. Anybody know how to get around this catch 22?
I’ve tried accessing the api separately but it burns up my calls and returns a new thing with a full list.

{
“data”: [
{
“name”: “of Surprise AZ”,
“member_count”: 5,
“email”: “[email protected]”,
“id”: “1195299160908851”
},
{
“name”: " of Sun City AZ",
“member_count”: 5,
“email”: “[email protected]”,
“id”: “983643985706059”
}
],
“paging”: {
“cursors”: {
“before”: “QVFIxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxU09RWUNnaUdtd1dxcFpwTkdrMxxxxxxxxxxUwSEYxSEc4dTRmxxxxxxxxxxxxxxxxxxxxxxxxxxxxTVBNmw2Xxxxxxxxxl93”,
“after”: “QVFIUxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxzNmVmVk9ocXRwcVVsdk9uU1FFUEZAZAMG4xWVlPelZAKSkh5cxxxxxxxxxxxxxxxxxxxxxxxxxxxxZAXBR”
},
"next":https://graph.facebook.com/v12.0/xxxxxxxxxxxxxxxxx/groups?fields=name%xxxxxxxxxxxxxxxx&limit=25&after=QVFIxxxxxxxxxxxxxxxocXRwcVVsdk9uU1FFUEZAZAMxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxVNZAaU0xZAXBR
}
}

Seems like some custom code to flatten this out would be helpful. Bubble doesn’t always play well with nested data.

I’d be happy to help you explore this possibility, perhaps a script that takes place In the background or client side and returns an easily digestible Json data structure.

Learn more

Need to have your database located in your region! Tired of struggling with Bubble or API’s? Need a little functionality that’s not available yet thru current market plugins? Experience your own bootcamp!

Are you ready to step-it-up or speed it along? Need some custom code or a plugin built? Contact me today to learn how to book a 1-on-1 session, get your plugin built, or yet freelance building support!

Office Hours:
Mon - Fri
9:00 AM - 5:00 PM

Send me a message today:
[email protected]

1 Like

I was able to finally figure this out. It wasn’t easy. First you need to set up a new thing in the data base. I called it DataDump. Then gave it 4 fields. Initial Dump, Initial Dump DATA (list), Secondary Dump, Secondary Dump DATA(list). From the workflows I created an action to create a new DataDump. In that action I called the API and set Initial Dump to the result of step 1’s Data Dump. In the 3rd step I update the DataDump I created in step 1 and set InitialDump DATA with the result of step 1’s Data Dump’s data. Then I scheduled 2 backend api workflows. One on a list and one to duplicate what I had just done except creating Secondary Dump and adding Secondary Dump DATA. Backend WF1 is schedule the api to run on a list of things (Initial Dump DATA) NOT Initial Dump. Initial Dump DATA is a LIST. The 2nd Api schedules another api ONLY if the pagination link is not empty. Worked like a charm

3 Likes

:clap: nice work!

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.