Forum Academy Marketplace Showcase Pricing Features

Dynamic input API URI segments

Hi - I am using the API Plugin to make a call…the structure of the endpoint is to build the request URI based on previous data. For instance:

https://api.leisurelink.com/v1/rentalUnits/114392 where “114392” is really {{unitId}}.

How can I build my API requests to sequentially make requests using relationships?

An example would be where the above URL also has a relationship to:
https://api.leisurelink.com/v1/rentalUnits/114392/images where this URI would return images related to the unitId in question.

Is it possible to do this using the API plug in?

You can remove the “114392” from the first call url and input it as a parameter

Unitid: 114392

In order for that to be dynamic you must set it as “client-safe” on the right hand side next to it.

You can make the URL client safe too, and insert variables.

Not sure that the number is a parameter. It is a resource .

I meant that the parameter is “unitId” and that its value is the number “114392”

That’s not really the same thing. You don’t want &unitid=12345 as a parameter I don’t think ?

1 Like

Actually it is considered a parameter, the parameters can be part of the URL path or query argument. Had to relook at their API

There would need to be another URL though, as the GET URL needs that in there. At least that is how it seems.

Easy enough to test with Postman.

Thank you both for the responses. So in order for me to get unitId value, I first need to make a call to a different endpoint. In order to dynamically input the unitId value, how do I make a sequential call?

So it goes like this:

Call endpoint one - receive a unitId value in the response

Dynamically input the unitId in https://api.leisurelink.com/v1/rentalUnits/114392/images to get the images associated with the unit

At the same time, call https://api.leisurelink.com/v1/rentalUnits/114392 to get the rest of the data associated with the unit.

How would I display the images and the data in a group in this case? I understand that I can dynamically input the unitId, or perhaps use the query path, but sequencing the workflow is a bit confusing for me.

So I think it will work like this …

You will do a GET on https://api.leisurelink.com/v1/rentalUnits{?supplierId,isActive}

That will return you a list of UnitIds. You can then populate a Repeating Group with this.

For each cell in the RG, you can then do subsequent calls to https://api.leisurelink.com/v1/rentalUnits/xxxxxx/images using the results from the first call. So you can insert the UnitId into the URI.

It will work in much the same way as this …

That gets a list of PlaceIds, and then does more calls for each one to get the details. Although that uses a parameter.

2 Likes

You guys are great! Using the thread and the example I got it to work by making the URL client safe then inputting the dynamic data into the URL segment. It didn’t seem to work when I tried to use the segment as a parameter instead…but I didn’t spend a ton of time trying that path.

Thanks again!

1 Like

Hi elanier can you detail how you did it as I have the same issue. Thanks.

Here is an image of my set up…the value ‘113118’ is what I replace with a dynamic element.

So:

Then dynamically insert the ID (or whatever value) in the URL segment like this:

1 Like

Thanks Elanier! I figured it out when using the connector but thanks again for your help :). Appreciated!

@elanier can you please explain how you were able to make these dynamic? I’ve tried, and currently stuck. your assistance is much appreciated.

Take a look at my screenshots above - the blue text you see is a value that I’m getting back from an API. You can input anything there, just select “insert dynamic data” and then you can choose “External API” or you can enter data from the database.

If you want to share a sample app I can give you more concrete help…