Automatically adding trailing slash at the end of the REST API Request URL?

Hi Team,

This problem started about a week or so ago. My apps started failing with the error "Invalid Argument", and it seems like Retool is adding a trailing slash ("/") at the end of the request URL, although I didn't add the slash in my Resource detail's base URL. I have query parameters that start with "?", so the URL sums up like "...raph/execute/?queryId=8..." is making the target server to return a 400 error. Could you please look into this? I tried to add a transformer to strip that out at least temporarily, but couldn't find what might be the Object name for the request URI.

Thank you!

Hi there @cry7670 ,

Based on this: "...raph/execute/?queryId=8...", are you adding the entire api endpoint url on your REST API resource?

You should be able to just type in your base url. For example, as your base url. When you use this resource, add the remaining part of your API endpoint. It is so you can reuse your resource for other endpoint you have.

On your example, it should be showing like this in the app: []graph/execute?queryId=8...

I place the base url in brackets to indicate that you can't edit it when you use it in an app. Does that make sense?

1 Like

Hi @jocen,

Thank you for the reply! No, that is not what I meant. I am putting the base URL below (1st screenshot), but when I use this resource to add the query parameters, Retool adds the trailing slash for me (2nd screenshot) and it fails my request since my request URL should not have the slash right before "?". Is there a way to turn that auto-addition?

@cry7670 why are you putting the entire endpoint as your base url? They provided you an example there on what the base URL is.

Do the following and you can reuse your REST API resource for different endpoints:
Base URL:
API Resource in App: {{base_url}}gql/econo/exe[?params...]

It adds the trailing slash because it is only expecting you to use the base_url in the resource.

1 Like