API Response / Multi-dimensional arrays

So I think I have found a solution, for my issue anyway. Maybe this helps you too, steven4, or perhaps other Bubble users that want to work with API responses that contain arrays of things. I’ll explain it briefly here and if anyone would need more explanation please reply.

So in my case I want to know what pricing options there are for a UPS-shipment by using their rates api. Their api responds with a JSON that contains multiple service codes with different pricing. So in order to do something useful with this array I have done this:

  • Setup an API connection through default bubble API-plugin (in my case a POST)
  • Initiate the call, and in my case I can see an array like so:
  • Create a data type ‘shipment’
  • Create fields for both the service code and rate, and make sure to select field type ‘text’ and select ‘this field is a list’
  • In my case I make a change to a thing (Shipment) and for the servicecode and rate I can now select a datafield from the nested array like so:
    rateresponse
  • Now in the data editor you see these kind of lists, which doesn’t look too useful:
    app data
  • But now we can use this data in a repeating group and even start workflows etc for each particular item in this group!
  • My settings for the repeating group look like this: first you set type of content to the nested array from your API:
  • The data source you keep empty for now
  • Put a field in the repeat group and point to current cell’s whatever you need in your case. for me it’s this:
  • And finally for me in the workflow editor I do this: I display a list in the repeating group and use the result of the previous API step as data source:

Now I can view the different responses from the API in the repeating group and do all sorts of cool things with each separate response :smiley:

I hope this helps you (or anyone else) with your issue. Otherwise let me know :smiley:

1 Like