Relative novice Coda Pack developer with packs that are used internally and am able to receive data in sync tables but came across this error recently.
I’m making a call to an api and getting an “Authentication Denied”.
I send data in the fetcher as shown below, expecting it to be formatted as in a successful curl call passing the data in curl -d
The Authentication Denied error occurs when sending data in the body of the call like this:
const SIMIAN_API_KEY = '------------------------'
const BODY = {'auth_token': SIMIAN_API_KEY,
'output_format': 'json'}
pack.addSyncTable({
name: "SimianOpenTickets",
description: "Simian Media",
identityName: "SimianMedia",
schema: SimianMediaSchema,
formula: {
name: "SyncSimianMedia",
description: "Syncs media from Simian.",
parameters: [],
execute: async function ([], context) {
let response = await context.fetcher.fetch({
method: "POST",
url: `${URL}`,
body: JSON.stringify(BODY)
});
let results = response.body.results;
return {
result: results,
};
},
},
});
I can mimic the failure in curl this way:
curl “https://buck.gosimian.com/api/simian/get_media?auth_token=-------------------&output_format=json”
<?xml version="1.0"?> %I get successful data when using curl like this (and when using python requests in a different application):
curl https://buck.gosimian.com/api/simian/get_media -d “auth_token=-----------------------&output_format=json”
Thanks, any guidance appreciated!
Rob