API POST Or PUT?

SOLVE
Highlighted
Occasional Contributor

Hi!

 

With reference to https://developers.hubspot.com/docs/methods/deals/update_deal

 

The above page instruction say to use "PUT" but when using PostMan and "Put" I get the following:

405 Method Not Allowed

 

If I change the method to "POST" I get 200 OK with an export of data on what has been changed, but yet, I don't see these changes within the HubSpot portal. 

 

So not sure what I'm missing here

Reply
0 Upvotes
1 Accepted solution

Accepted Solutions
HubSpot Employee

Hi @grantduke,

 

You have a typo in your request URL. You are doing the following, notice you have an extra "?" before the deal ID. 

 

https://api.hubapi.com/deals/v1/deal/?1242828230?hapikey={{apikey}}
 
Whereas it should be:
 
 
Notice I've removed the extra "?" you have before the deal ID. This will ensure the PUT works successfuly. 
 
 Regards,
Jack
 
Jack Coldrick
Solutions Engineer @ HubSpot
Add me on LinkedIn
3 Replies 3
HubSpot Employee

Hi @grantduke,

 

I am unable to reproduce that. When using PUT I get a 200 OK response and the deal is updated as per the documentation. If I try to do a POST I get a 405 METHOD NOT ALLOWED. Are you also encoding the body in JSON? See my postman examples below:

 

PUT REQUEST: 200

put.png

 

POST REQUEST: 405

post.png

 

Regards,

Jack

Jack Coldrick
Solutions Engineer @ HubSpot
Add me on LinkedIn
Reply
0 Upvotes
Occasional Contributor

Hi Jack

 

As you can see below. I get 405 when using PUT

API Push.jpg

Reply
0 Upvotes
HubSpot Employee

Hi @grantduke,

 

You have a typo in your request URL. You are doing the following, notice you have an extra "?" before the deal ID. 

 

https://api.hubapi.com/deals/v1/deal/?1242828230?hapikey={{apikey}}
 
Whereas it should be:
 
 
Notice I've removed the extra "?" you have before the deal ID. This will ensure the PUT works successfuly. 
 
 Regards,
Jack
 
Jack Coldrick
Solutions Engineer @ HubSpot
Add me on LinkedIn