Use URL parameter in API call

General Conversations

I want to build a page that has the route and the parameter, for example:

route: test_page/:code

page parameter: code (String)

When loading this page there will be an action for an API call, this API needs to receive the "code" to bring a certain information.

Each person accesses a page with a certain code, for example:

route: test_page/:code

https://test_page/123

https://test_page/456

This number needs to be in my API call because the return of this information depends on this numbering.

I'll give a fictitious example of an API:

https://info_codigo/get_info?cod=code

I thought about replacing "code" with a structure similar to this:

https://info_codigo/get_info?cod=@{code}

Because it seems that the "@" followed by "{" + parameter + "}" would be the right construction.

I have tried to explain what I intend to do, but I would like an opinion on whether this solution is viable or if there is a better solution.

3 replies