We’re adding a feature to the API connector plugin by which you can initialize an API call by manually pasting in representative JSON, thus adding fields that might not be present in a test call. Just click the “Manually enter API response” button, paste in your JSON, and then edit fields and data types as you ordinarily would.
We’ve also included the ability to edit JSON gotten from an automatic call. You can do this by scrolling to the bottom of the Edit Data Types popup and clicking “Edit raw data”.
This is a major update - And very welcome. Having to make a “perfect” Initialize Call that contained every field I think I would ever need was cumbersome… And in some cases, very very difficult to do. Looking forward to testing it out.
@marca I see one potential area for improvement. After setting up the initial call, if you click the “modify call types” button or the “Manually enter API response” link to modify the call, it wipes out the previous code/fields.
Is there a way for it to keep the manually added code?
Default behavior is to make a test call again when you click “Modify call types”, but to retain additional fields from custom JSON. This decision was made to keep things reasonably simple, but we’re open to input on how this best ought to work.
Sample JSON is not stored for performance reasons. If you have strong feelings that it ought to be, let me know.
Hi @marca - thanks for improving the API connector. I’ve initialized my call and saved all the types, but there’s one field “error” that is not saved because it only happens when there’s a server side error. If I save just “error”, it wipes out all my other fields as per what @Kfawcett has experienced.
With this new feature, Is there a way to add in field “error” in addition to what I’ve already saved from my initialize successful call? Or, do I have to somehow manually copy all the successful call fields and manually enter “error” as an additional field?
Yes there is. Initialize an automatic call, show the raw response, and then click “Edit raw response”, which we just added. This will open the JSON editor and allow you to add the necessary field.
@marca Marca, will this handle being able to call directly from a JSON output file rather that calling an api? Sometimes people will want to pull data from a JSON return file directly and use it just like bubble had called an api… Will what you are talking about handle this? If not, can this be currently done?