Delete a Deal returns 204 every time


#1

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?


#2

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


#3

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.


#4

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


#5

I am using my own testing portal
https://api.hubapi.com/deals/v1/deal/111?hapikey=REDACTEDgives 204
and https://api.hubapi.com/deals/v1/deal/abc?hapikey=REDACTED gives 200


#6

@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'


#7

@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.)


#8

@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.