根据Google Cloud Console>端点>服务>部署历史记录,这是当前部署的API规范:
swagger: "2.0"
info:
title: "JSON Ingester"
description: "Receive JSON files, transform and load them."
version: "1.0.0"
host: "project-id-123.appspot.com"
schemes:
- "https"
paths:
"/upload":
post:
summary: "ETL JSON file."
security:
- api_key: []
operationId: "upload"
consumes:
- multipart/form-data
parameters:
- in: formData
name: file
type: string
responses:
200:
description: "File uploaded."
schema:
type: string
400:
description: "Error during file upload."
securityDefinitions:
api_key:
type: "apiKey"
name: "apikey"
in: "query"
但是键“ apikey”不被接受-而是需要在几个小时前部署的openapi.yaml中指定的“键”。
这行之有效,但不应:
$ curl -X POST -F "file=@data/file_6.json" https://project-id-123.appspot.com/upload\?key\=AIzaS...Eaoog
这在应该的时候不起作用
$ curl -X POST -F "file=@data/file_6.json" https://project-id-123.appspot.com/upload\?apikey\=AIzaS...Eaoog
{
"code": 16,
"message": "Method doesn't allow unregistered callers (callers without established identity). Please use API Key or other form of API consumer identity to call this API.",
"details": [
{
"@type": "type.googleapis.com/google.rpc.DebugInfo",
"stackEntries": [],
"detail": "service_control"
}
]
}
我是否需要清除缓存或其他内容?
我使用以下API来部署API:
gcloud endpoints services deploy "./openapi.yaml"
有什么想法吗?
答案 0 :(得分:0)
部署ESP时使用了什么rollout_strategy?如果未指定,则默认为“固定”。您应该使用“托管”
还请通过CLI“ gcloud端点配置描述”检查生成的服务配置。检查其system_parameters字段,以查看是否正确创建了新的“ apikey”。