Google Analytics API returns 204 response without body
This Google Analytics API call https://developers.google.com/apis-explorer/#search/analytics/analytics/v3/analytics.management.uploads.deleteUploadData returns 204 without message body. At least it returns some headers:
cache-control: no-cache, no-store, max-age=0, must-revalidate
date: Tue, 08 Aug 2017 12:44:42 GMT
etag: "sP5LBgqDii7ksJERAgMB0CpTbRM/vyGp6PvFo4RvsFtPoIWeCReyIC8"
expires: Mon, 01 Jan 1990 00:00:00 GMT
pragma: no-cache
server: GSE
vary: Origin, X-Origin
Same behaviour with googleapis@17.1.0 node module.
Edit: As mentioned by m90, this should indicate that the server has fulfilled the request but in my Analytics account no upload items are beeing deleted.
204
status code translates to "No Content"
The server has fulfilled the request but does not need to return an entity-body, and might want to return updated metainformation. The response MAY include new or updated metainformation in the form of entity-headers, which if present SHOULD be associated with the requested variant.
In RESTful services it is a common pattern to respond with 204 and an empty body upon deletion of an entity, just like the call you are describing (quoting Custom data source Id for the uploads to be deleted. (string)
). This question: REST API error return good practices has good info on how to read status codes from RESTful services.
上一篇: REST API使用POST而不是GET