How would I use a different endpoint for each integration user? I have a slightly different endpoint for each client and would like them to enter the URL (or part of the URL) as part of zap setup.
Bruce
How would I use a different endpoint for each integration user? I have a slightly different endpoint for each client and would like them to enter the URL (or part of the URL) as part of zap setup.
Bruce
{{bundle.authData.api_url}}
.
Thanks!
As an environment variable?
ThenI can reference that environment variable in the URL field?
As an environment variable, it will be the same for all the users. You’ll need to add it as an authentication field instead so that each connection has its own API URL.
That makes sense - I don’t see where to add that though, do I need to switch to ‘Code Mode’? There’s a ‘Connection Label’ item on that page but no variables to edit/add.
Add an authentication field, which will prompt the user as they are configuring their credentials for your app.
You can define an input mask as well to help your users understand what part of the URL you’re expecting them to enter.
Ah, that could be why I don’t see it - I’m using Basic Auth for this (as a sort of API key).
Is there still a way to do it?
If you name the Basic authentication fields username & password then the Authorization header should be assigned this value: "Basic " + Buffer.from(bundle.authData.username + ":" + bundle.authData.password).toString("base64")
Thanks again!
EDIT - damn. Somehow bundle.auth.api_url got inserted there, not bundle.authData.api_url.
Works great now!
That makes sense, and I edited the auth and test sections, got a good test, but when I try to test the API I get:
TypeError: Cannot read property 'api_url' of undefined at eval (eval at makeFunction (/var/task/node_modules/zapier-platform-core/src/tools/schema-tools.js:11:39), <anonymous>:4:20)
The code looks like this:
const options = {
url: bundle.auth.api_url,
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': "Basic " + Buffer.from(bundle.authData.username + ":" + bundle.authData.password).toString("base64"),
'X-VEVOMO-ATTENDEE-TYPE': bundle.inputData.vevomo_attendee_type
},
and I set a new ‘account’ to be sure that the URL was in there (same values that worked for the test).
Feels like it’s close but the auth isn’t there? The same code works in the test area.
bundle.authData.api_url
instead of bundle.auth.api_url.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.