此 Google Analytics API 调用 https://developers.google.com/apis-explorer/#search/analytics/analytics/v3/analytics.management.uploads.deleteUploadData返回 204,没有消息正文。至少它返回一些 header :
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
与 googleapis@17.1.0 node module 的行为相同.
编辑: 如mentioned通过 m90 ,这应该表明服务器已满足请求,但在我的 Analytics 帐户中没有上传项目被删除。
最佳答案
204
状态代码翻译为 "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.
在 RESTful 服务中,删除实体时响应 204 和空正文是一种常见模式,就像您描述的调用一样(引用 Custom data source Id for the uploads to be deleted. (string)
)。本问题:REST API error return good practices有关如何从 RESTful 服务读取状态代码的详细信息。
关于javascript - Google Analytics API 返回没有正文的 204 响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45569386/