Help

Re: Simple external API call hits 405 (Method not allowed)

905 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Roy_Golan
5 - Automation Enthusiast
5 - Automation Enthusiast

I'm trying to execute a simple API call to Fireberry:

 

 

 

const options = {
  method: 'POST',
  headers: {
    accept: 'application/json',
    'content-type': 'application/json',
    tokenid: '...'
  },
  body: JSON.stringify({accountname: 'Test'})
};

fetch('https://api.powerlink.co.il/api/record/account', options)
  .then(response => response.json())
  .then(response => console.log(response))
  .catch(err => console.error(err));

 

 

 


This exact call works in Make, but in Airtable it throws a 405 - 'Method not allowed'. It seems impossible to complete thi task without another tool like Make. Is there a fix / workaround?

2 Replies 2

Hi,
to be honest, I don't know the reason, and what such error means.
it helped me with my problem, so maybe worth a try.
add redirect option:

const options = {
  method: 'POST',
  headers: {
    accept: 'application/json',
    'content-type': 'application/json',
    tokenid: '...'
  },
  redirect: 'manual',
  body: JSON.stringify({accountname: 'Test'})
};   
Roy_Golan
5 - Automation Enthusiast
5 - Automation Enthusiast

Thanks @Alexey_Gusev , I have not yet test this solution but this will probably help someone in the future. Eventually I've ran the script inside an automation. This worked well and was accidentally a better fit to my Project.