APIs & Integrations

Not applicable

Delete a Deal returns 204 every time

Hi,
I found even if dealId doesn't exist in the backend, DELETE /deals/v1/deal/:dealId is returning 204 response code everytime. This case for some other objects too. Is it normal behaviour? Shouldn't it return 404 code?

0 Upvotes
7 Replies 7
Not applicable

Delete a Deal returns 204 every time

0 Upvotes
3PETE
HubSpot Employee
HubSpot Employee

Delete a Deal returns 204 every time

@Prasad_Satalkar1 A 204 is the correct response for deleting a deal. I am guessing you are getting a 200 because we would never have a non-numerical deal ID. You might be confusing our servers a bit as there would never even be a deal with the ID of 'abc'

0 Upvotes
Not applicable

Delete a Deal returns 204 every time

@pmanca What about DELETE https://api.hubapi.com/deals/v1/deal/111?hapikey=REDACTED request?
In the above request, dealId is 111 but such deal with id 111 doesn't exist in the backend, still, it returns 204 response. Shouldn't it return 400/404 resposne code if deal with id 111 doesn't exist? (consider 111 any random number and it is negative test case.)

0 Upvotes
3PETE
HubSpot Employee
HubSpot Employee

Delete a Deal returns 204 every time

@Prasad_Satalkar1 That is working as designed, We have our APIs set up to respond with a success if you make a false request and there is no dealID or '111'. The only time you would receive a 400 level error was if you didn't format the call correctly and a 500 level error if we couldn't delete a legitimate deal for what ever reason.

0 Upvotes
Not applicable

Delete a Deal returns 204 every time

Curl -X delete https://api.hubapi.com/deals/v1/deal/10444744?hapikey=demo will give 204 code although deal with that id doesn't exist.
Curl -X delete https://api.hubapi.com/deals/v1/deal/abc?hapikey=demo will give you 200 code which is wrong.

0 Upvotes
3PETE
HubSpot Employee
HubSpot Employee

Delete a Deal returns 204 every time

@Prasad_Satalkar1 Are you using your own hapikey or the demo one? The demo one really doesn't work anymore.

0 Upvotes
3PETE
HubSpot Employee
HubSpot Employee

Delete a Deal returns 204 every time

@Prasad_Satalkar1 Can you share with me an example of this happening?

0 Upvotes