I am totally new to bubble, but I have some years in traditional programming under the belt. What I am struggling with is the handling of API responses.
I want the user to enter an URL and the query then FreeAPI from BuiltWith.com - it returns a multidimensional array with information about a website for instance “technologies used”.
Now in PHP I would take the API response object, iterate over the Object Items (or Array Lists) and write each of it into a table “Tech” and reference it to a table “Websites”.
Now with bubble I seem to be lost already at the conceptual level. How do I iterate over the result objects list? Some like FOR EACH… Or how do I implement a conditional (if entry does not exist then…)
I spent the better part of last night reading the reference, documentation, searching the forum or watching videos - but still not sure I am looking in the right direction.
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:
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:
Hey! Thanks for your post. I am having a similar problem. Could you post your API Connector body text to see how to format the list in en body?
I connected to my accounting platform and i am trying to make a call to create an invoice. I have a required field called ProductLines which is a list. And each productlines has some required fields, (Quantity, Amount, Description, Discount) But isimply cant find a guide to fill in those arrays. Can you help?
Kindly
Emil
Hi! Thanks for your reply.
Íf you want to check it out the documentation is right here: https://api.dinero.dk/docs https://api.dinero.dk/openapi/index.html#tag/Invoices/paths/~1v1~1{organizationId}~1invoices/post
Im trying to perform a POST call named Create Invoice. Should be pretty simple.
Authentication is giving me some issues also, since the token times out after a certain time. Ive read that it can be solved with use of Custom Token, but i can figure out how to set it up.
Note that i am pretty new to setting up these api call.
I performed a get call succesfully by first performing a “get token” call and then using the key returned to perform the get call.
Yeah learning how the authentication stuff works can be pretty time consuming / frustrating!
So what I usually do is to first try my API-calls out in a tool called Postman. This way I am sure that I get the requests going with the least amount of effort. This can save you some headache.
Then when you get it to work in Postman, you try to recreate your requests in Bubble with the API plugin.
The docs you posted have a pretty clear example to create an invoice:
Hi Jelle!
Sorry I havent seen your reply until now!
Authentication is alright, i managed to get through, but im doing it with a GET call to get the token and then using the token manually in the header of the post call in create invoice.
Im receiving this error: {“type”:“https://tools.ietf.org/html/rfc7231#section-6.5.13”,“title”:“Unsupported Media Type”,“status”:415,“traceId”:“0HM54DF0VE4I0:00000038”}
So im guessing there is something wrong with the parameters im posting. Thats why i was looking for a sollution on how to set the variable parameters ( productlines) up
Did you try using Postman the test the call for creating the invoice? I’m not sure how to format the nested productlines in Bubble, so maybe it’s best to first try and create an invoice through Postman. If that works without errors you can try to recreate your call with Bubble.