我正在尝试使用Google Cloud API Explorer
服务> Cloud Pub / Sub API v1> pubsub.projects.subscriptions.pull
请求
开机自检 https://pubsub.googleapis.com/v1/projects/mimic-integration-10-2019/subscriptions/telemetry:pull?key= {YOUR_API_KEY}
{}
并且失败
响应
400错误的请求
- 显示标题-
{“错误”:{“代码”:400,“消息”:“您传递了无效的 服务的参数(argument = max_messages)。“,”状态“: “ INVALID_ARGUMENT”}}
我在做什么错?其他调用如服务> Cloud Pub / Sub API v1> pubsub.projects.subscriptions.list 可以正常工作。
答案 0 :(得分:0)
查看API
https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.subscriptions/pull
更加紧密,并且有2个隐藏参数。如果资源管理器会很好 没有隐藏它们。
工程,一旦我提供了参数:
请求
开机自检 https://pubsub.googleapis.com/v1/projects/mimic-integration-10-2019/subscriptions/telemetry:pull?key= {YOUR_API_KEY}
{“ returnImmediately”:true,“ maxMessages”:10}
响应
200好
- 显示标题-
{“ receivedMessages”:[{“ ackId”: “ WBFOBCEhPjA-RVNEUAYWLF1GSFE3GQhoUQ5PXiM_NSAoRRULUxNRXHUCRRBsVTN1B1ENGXN7NSY7UhsCBUcBdF9RGx9ZXH5KAFkEGHZ7ZXNiXBIACKNWK9KGKKWKVK9KGKWKVK9KAQK7KWKVK9K5K “信息”: { “数据”: “eyJzbiI6IjIwOjE5OkFCOkY0OjI3OjFCIiwiZGF0YSI6eyJhY2MiOnsieCI6MjYsInkiOjMyLCJ6IjoxMDEyLCJ1bml0IjoibUcifSwiZ3lybyI6eyJ4IjoxMjIwLCJ5IjotNjgzNSwieiI6LTIzMTksInVuaXQiOiJtZGVnL3MifSwibWFnIjp7IngiOjQwLCJ5IjoxLCJ6IjotNCwidW5pdCI6InVUIn0sImxpZ2h0Ijp7InZhbHVlIjoxMzU1NywidW5pdCI6Im1MdXgifSwidGVtcCI6eyJ2YWx1ZSI6NTAwMDAsInVuaXQiOiJtQ2Vsc2l1cyJ9LCJwcmVzc3VyZSI6eyJ2YWx1ZSI6OTg4OTcsInVuaXQiOiJQYXNjYWwifSwiaHVtaWRpdHkiOnsidmFsdWUiOjM5LCJ1bml0IjoiJXJoIn19fQ ==” “属性”:{ “ projectId”:“ mimic-integration-10-2019”, “ deviceId”:“ mimic1”, “ deviceNumId”:“ 2683064391811245”, “ deviceRegistryId”:“模拟注册表”, “ deviceRegistryLocation”:“ us-central1”, “ subFolder”:“” }, “ messageId”:“ 789146468611865”, “ publishTime”:“ 2019-10-14T13:49:47.862Z”}}]}