Is there a way to allow zaps to define which URL to use for authentication and API calls? Using the app designer + env variables gives the “Only absolute URLs are supported” error, so I guess that’s out.
Hi
When you get the “Only absolute URLs are supported” error, it means that you’re using a relative URL path. You can use environment variables to set the base URL to use, then concatenate the base and relative URLs to construct the complete path. e.g.
z.request({
url: process.env.BASE_URL + "/user/profile",
// ...
})
Tips:
- When you want to make it easy for you to change the API URL without having to update it in each trigger or action, you can define it as an environment variable from the Advanced -> Environment section and in your code, you can reference it as process.env.API_URL (if you set the variable name to API_URL).
Example:
z.request({
url: process.env.API_URL + "/user/profile",
// ...
})
- If you want to prompt the user for their API URL so that each user connects to a different API server, you will need to add an authentication field to store it then you will be able to reference it as bundle.authData.api_url (if the field key is api_url)
Example:
z.request({
url: bundle.authData.api_url + "/user/profile",
// ...
})
Note: Zapier will throw the error "Only absolute URLs are supported" if the API base URL is not defined because in that case, it will only see the path name part of the URL (e.g. /user/profile ).
BACKEND_URL
in the environment variables page.
Thanks
Once declared it works.
Real neat, the whole Zapier development environment.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.