Help! Vimeo API – complex "format as text" – what’s the solution?

Hi all,

I going crazy trying to set up a workflow to create a set of records from the from the Vimeo API Call – Get Call https://api.vimeo.com/me/videos. I can get the API to initialize but Vimeo seems determined to make it hard do anything with the response by including a bunch of garbage (spaces, /r, /n) inside each item of the response that needs to be stripped and some “/”s inside the response that need to be escaped.

I have already tried multiple combinations of “format as JSON safe inside “format as text”, with “find and replace” and “extract with Regex”. Nothing seems to work.

Some of the failures relate to things like Bubble not allowing me to do to Regex’s in a row. I have a pattern that looks identical at the beginning and end of each item but they are actually slightly different.

I think that the sequence of operations is critical so hoping that someone out there can set me straight.

The Vimeo response type is “data”. Inside the data list, the json looks as follows.

“data”: [
{
“uri”: “/videos/880349166”,
“duration”: 84
},
{
“uri”: “/videos/879219476”,
“duration”: 5
},
{
“uri”: “/videos/879219473”,
“duration”: 16
},

]

When I pump this into freeformatter.com to get the escaped JSON, I get the following.
{\r\n "uri": "/videos/880349166",\r\n "duration": 84\r\n },\r\n {\r\n "uri": "/videos/879219476",\r\n "duration": 5\r\n },\r\n {\r\n "uri": "/videos/879219473",\r\n "duration": 16\r\n }

The "/videos/880349166" is the data value. I have tried removing the “/video/” completely and this may be the solution but as I can’t get the rest right, I am not sure. The same goes for all the other solutions that I have tried. As all it takes is one wrong move to not make the solution work, it is very difficult to figure out how what the answer is.

I really appreciate the help!!!

Yeah Bubble does not play nice with nested JSON. You’ll probably have to store the response and then splice and dice it.

You can look around in the forum for some creative solutions that may work for your use case (e.g., Need help looping over JSON response - #17 by georgecollier)

You can:

  1. Schedule API workflow on a list which calls a backend workflow and takes the uri and duration as parameters. The list should be Result of step 1’s data.

  2. Use the Bulk create data API (more technical but more efficient)

The issue you seem to be having is that you’re trying to format the list as text. Format as text in Bubble always outputs a text, never a list, so that’s why you’re struggling to Schedule API workflow on a list.

Are you just trying to grab the Vimeo ID?

Maybe try this: testApp42wCleanDB | Bubble Editor

It’s hard for me to test on this free app that I am using, but in theory, this should work.

Check out the Vimeo and Vimeo2 api workflows on the backend workflows.

Thanks! I will check these out!

HI @georgecollier,

I have been so focused on trying to make this work as a recursive backend workflow that I had forgotten that I have the API data type in the front end. Not sure why Bubble does not make those API data types in the backend. It is good to have this as a back up. In actually got this to work but I repurposed the input fields to try to get a backend recursive workflow to work. I is a relief to remember that in the worse case scenario, I can go get this to work.

My hope is that I can format the data in the API response so that I can pass it to the backend as a Vimeo Record DataType (I have this created) or as a list of text items that I can somehow used to do a recursive workflow because I need to tie the vimeo data record to a catalog table and doing that in one single workflow would be much more efficient.

Is it possible to convert the API response in the front end and send to the back end in a data type that can be used in a recursive workflow? If yes, what is the process AND is there a way to parse / translate the API response I shared to achieve this?

After I got schedule a workflow on a list a work, I tried to get the Bulk API load to work. I have this running for a GDrive API so have a good handle on the Bulk Approach so think that my issue is formating the JSON. Will have another run at this and create a separate post if I can’t get it to run. Cheers

Hi @J805 , This looks interesting! I will give it a try. Thanks!

1 Like

Multiple parameters. Have an API workflow that takes List of uri (text) and List of duration (number).

This workflow does:

  1. Create a new thing using uris:first item and durations:first item
  2. Schedules itself to run again, with the List of uris being uris:items from #2 and the List of durations being durations:items from #2. Add a conditional on the schedule ‘Only when uris:count > 1’ to avoid an infinite loop.

In plain language, what we’re doing is passing two lists of data - URIs and Durations. Then, we’ll process the first item of each list, and then remove these items from the list before doing the same again with the new first item in the list.

@georgecollier @code-escapee @J805

Gents,
I was away on vacation so did not have a chance to try out your proposed solution till this week. I had never understood the “each of item” function it now makes sense. But I cannot seem to get it to work. I get an endless loop of just the first record in the list. It is driving me crazy!! Can you have a look and see if you see anything that I am doing wrong.

There are TWO issues.
1.) The reduce the list to count zero is not working - the routine loops infinitely.
2.) The one and only one record is produced a thousand times.

This is how I have built it.
I send parameters from front end to a backend api call that uses the Dropbox plugin. I have embedded recursive workflows to allow for multiple calls to the Dropbox plugin (but it never gets that far. The plugin executes fine and the lists appear to create properly using the “result of api call, each item, field approach”.


i have counted the full 45 records in the log file after it is executed.
The id field values are recognizeable - i don’t know about the rest

The dropbox list processing API kicks off the recursive and takes first item off the list.

and sends on the remaining list for the passback to Create-dropbox-record, which creates the same miserable record over and over again. next two images are not duplicates the second lets you see the bottom of the parameter list and the only when for the recurive call to create-dropbox-record.

I am using the fact that the list reduces to zero as my stop on the WF but have added in an additional metric (upper bound hard number stop) to ensure i don’t use up all my WUs.

Appreciate the help.

@georgecollier @code-escapee @J805
Gents,
I had cocked up the embedded workflow so that it was calling the Dropbox API on each iteration! Doh!!! :turkey:
Works like a charm now. Thanks so much for your help!!! :wave: :wave: :wave:

1 Like

So glad you got it working :raised_hands: