APIs & Integrations

WZone
Member

Why am I getting error 405 when doing a PUT request and not when doing a GET or POST

I'm working on a backend server with Hubspot API, recently I've been doing GET and POST request and everything works properly.

Now I'm trying to do a PUT request but get the error of Error: Request failed with status code 405 Link

I am using the same code as the working POST request, just changed the method and still throws error.

app.get('/createDeal', async function(req, res) {
  axios.put('https://api.hubapi.com/crm/v3/objects/contacts/{contactID}?hapikey={key}', {
    "properties": {
      "hs_lead_status": "Open",
    }
  })
  .then(function (response) {
    console.log(response);
  })
  .catch(function (error) {
    console.log(error);
  });
})

 

0 Upvotes
1 Reply 1
vbrech
HubSpot Employee
HubSpot Employee

Why am I getting error 405 when doing a PUT request and not when doing a GET or POST

Sorry maybe I misunderstand, but the v3 contacts API has no documented PUT method for that endpoint, so an error would be expected. It does have a PATCH method though: https://developers.hubspot.com/docs/api/crm/contacts

0 Upvotes