APIs & Integrations

grantduke
Participant

API POST Or PUT?

SOLVE

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

0 Upvotes
1 Accepted solution
jackcoldrick
Solution
HubSpot Employee
HubSpot Employee

API POST Or PUT?

SOLVE

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

View solution in original post

3 Replies 3
jackcoldrick
HubSpot Employee
HubSpot Employee

API POST Or PUT?

SOLVE

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
0 Upvotes
grantduke
Participant

API POST Or PUT?

SOLVE

Hi Jack

 

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

API Push.jpg

0 Upvotes
jackcoldrick
Solution
HubSpot Employee
HubSpot Employee

API POST Or PUT?

SOLVE

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