Binding data to external API calls

I had to manually take that stuff out. We are good now

2 Likes

If I remove the braces it does not work at all. I have no control over how the url is passed and cannot add the query parameter to the end of the url at all.

Try this

This is my base url http://vapor.prelub.com/api/v1/partnumbers
This is my endpoint /num
All I want to do is add the / and a number to the end to get

http://vapor.prelub.com/api/v1/partnumbers/endpoint/somenumber
I have tried your suggestion and just get a 500 error.

I am using version 6 beta 9.

Should I be using version 5?

So what is the actual error?

So there’s two concepts being mentioned in here. Path parameters and query parameters.

Path parameters are like http://vapor.prelub.com/api/v1/partnumbers/122203
Query parameters are like http://vapor.prelub.com/api/v1/partnumbers?num=122203

It appears you want to use path parameters, so ignore and remove anything related to query parameters.

When setting up the schema in Wappler you have two options. The first is to have Wappler fetch the schema.

You can hardcode the number like this, then click Fetch Schema.
image

Your other option is to manually add the schema and click the Play icon.
image

I enabled debug mode and all I am trying to do is define the schema. here is how I have it setup in the api action.

. This is what I get when I click define schema. . I add the parameter value to the variable. . Then I click Fetch Schema. I sit and wait for ever as I think it is trying to post to the base url which returns all the parts which is what I don’t want.

Note that you can copy and paste the schema for the expected response from your API docs if it’s not possible to retrieve it. It will then be available in the Data Picker.

How do I dynamically set the path parameter?

How do I dynamically set the path parameter. I’ve been struggling with that for a while?

You have it here. This is a dynamic path parameter.
image

Also, delete this query parameter.
image

When you go to the Schema Editor you need to remove the curly braces and manually add the number to fetch the schema.
image

One additional note. It looks like this is going to be a GET method, but in all of your screenshots you have a POST variable for the part number. You won’t need the POST variables as you’ll be passing the value as part of the URL in your app.

If this is connecting to a Wappler API then you’ll most likely need to use a PARAM variable and a route.

image

image

This is an external api call. it runs outside of this app. Not sure how I would put a route parameter in for that. Just add it to the routes?

The value I want to pass it comes from a form which is why I have the form linked to the action. Is there another way to do this?

This is what I get from the form.

This is how I have it setup now.

This is the response I get from the server call with this url http://localhost:8080/api/v1.0/partnumbers/num/199892.

Did you define/setup the schema?

Yes, the schema is defined.