Fetch from api with parameters from collection

I was trying to replicate the example provided in Fetch Data from API and display array result in Collection - #4 by Darren_Murphy but hit a snag.

The API I want to use uses query parameters (or a request body) to get the data it needs.

How can I pass data from a row to the API?

For example

`My-Api: The Ultimate SMTP Relay Service

BTW data is not loaded inside the tooltip for Fetch JSON
image

Also where can I find docs on how this column functions?

I can’t seem to find any

Is there another column I can use to fetch data from an API? Maybe the JavaScript option (which also doesn’t seem to be documented btw)?
image

At it’s most basic, you can construct a url using a template column, but sometimes, special characters can get in the way. In that case, a Construct URL column will properly handle urlencoding and query parameters. The Encode Text column will handle url encoding and base64 encoding if you need it for other uses.

-I would start with the Fetch column and maybe the Transform JSON column if you need to pull values out of the JSON.
-You can use the javascript column to write javascript. Pass in parameters, have it do stuff, and return a value. Not much to explain there. As long as you know code, you can probably find a use for it.
-You could also use the Experimental code column, but you need to host your code on something like Replt or GitHub. Most of the time you can get away with using the javascript column instead. For more info on Experimental Code column, you can do a forum search for ‘experimental code’ or ‘hell yes’.

2 Likes

I ended up using Construct URL to build the URL as a new column and then created a second column with Fetch JSON and used the constructed URL as the endpoint.

Thanks for the help @Jeff_Hager !

2 Likes

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.