Here’s an example of working code used on PipeDream to fetch API data from frame.io:
async(events, steps, auths) =>{
return await require("@pipedreamhq/platform").axios(this, {
url: `https://api.frame.io/v2/accounts`,
headers: {
Authorization: `Bearer ${auths.frame.oauth_access_token}`,
},
}
My goal is to trigger a call to Google Analytics so my co-worker can know if their customer viewed the presentation link.
I would think a record of views can be found in the audit log, so I’m trying to–at a minimum–refresh the page impression count in Google Analytics. I may give up on the API and just iframe
-wrap frame.io into my client’s website and call Analytics in the wrapper. But it would be cool if I can get this to work.
I took the working code from above and changed out the URL in a few different ways as recommended by the docs (the docs have different URLs so I tried the likely candidates. It’s not clear to me if .../:id/...
should have a colon or if that is denoting a variable. I swapped out the URL parameter with the following guesses one-by-one but was met with a 404 when tried with the GET endpoints listed below (Assume ${auths.frame.id}
is a template-string-variable that returns my correct Admin ID):
`https://api.frame.io/v2/accounts/:id/audit_logs`
`https://api.frame.io/v2/accounts/:account_id/audit_logs`
`https://api.frame.io/v2/accounts/:${auths.frame.id}/audit_logs`
`https://api.frame.io/v2/accounts/:${auths.frame.account_id}/audit_logs`
`https://api.frame.io/v2/accounts/${auths.frame.id}/audit_logs`
`https://api.frame.io/v2/accounts/${auths.frame.account_id}/audit_logs`
`https://api.frame.io/v2/accounts/:b993fee4-xxxx-xxxx-xxxx-myAdminID-b1a4ecf6caff/audit_logs`
`https://api.frame.io/v2/accounts/b993fee4-xxxx-xxxx-xxxx-myAdminID-b1a4ecf6caff/audit_logs`
`https://api.frame.io/accounts/:id/audit_logs`
`https://api.frame.io/accounts/:account_id/audit_logs`
`https://api.frame.io/accounts/:${auths.frame.id}/audit_logs`
`https://api.frame.io/accounts/:${auths.frame.account_id}/audit_logs`
`https://api.frame.io/accounts/${auths.frame.id}/audit_logs`
`https://api.frame.io/accounts/${auths.frame.account_id}/audit_logs`
`https://api.frame.io/accounts/:b993fee4-xxxx-xxxx-xxxx-myAdminID-b1a4ecf6caff/audit_logs`
`https://api.frame.io/accounts/b993fee4-xxxx-xxxx-xxxx-myAdminID-b1a4ecf6caff/audit_logs`
Perhaps someone who is more familiar with standard API URL conventions (ie are colons denoting account variables here? How is the actual variable provided and when?) Is the variable consumed in the context of the id by the API or should that “:id” be literally be replaced by the string that is the ID before it arrives to be processed by the API??