Getting the response of a API call

First time retool user here — how do I get the result of a POST call? The API I’m using populates the Location field on the header on the response object, but when I try to use query1.headers.location (specifically, I’m trying to show the result of the call in another Retool component), it’s accessing the header on the original query, not on the response.
Thanks!

Hi Jessy -
Know we talked through solution on Intercom but want to share with others in the community.
Currently you are unable to access the headers from a POST call response. Retool surfaces the data from a POST call response in query_name.data but not the headers. We’ll add this our feature request list.
In your specific scenario (and maybe others!) we were able to get the data you needed another way. Details for those interested:
When you create a form with the Typeform API using POST https://api.typeform.com/forms the API returns a link like https://api.typeform.com/forms/form_id in headers.location. A GET request to this link gives you metadata about the new form.
How do you access this info using Retool?
location url: Build url using {{"https://api.typeform.com/forms/"+query_name.data.id}}
new form metadata: The metadata is returned by the POST /forms request so you don’t need to make a section call, you can just use {{query_name.data}} to access new form metadata.

Are there any updates on this front?

I’m executing a number of API calls (POST-create Google Doc, PATCH-rename Google Doc, PUT-add permissions to Google Doc) and I would like to be able to tell users when the API returns a non-200 response. Is there anyway I can capture this?

Hey @nacho - we have a PR open that will give you access to this data, working on merging it this/next week :slight_smile:

2 Likes