cmd中curl,错误“未知名称”(云锚点管理API)

问题描述 投票:0回答:0

我正在尝试云锚点管理API,但使用curl时出现错误。 列表、删除等都可以正常工作,但只有与 TTL 更新相关的命令不起作用。 我不知道使用什么工具来使用该代码,因此我在 Windows cmd(命令提示符)中输入它并使用它。 你知道在哪里输入原始命令吗?或者如何修复cmd命令?

我正在使用翻译器,所以如果我的英语很奇怪,我真的很抱歉。

TTL更新原文

export BEARER_TOKEN=`(oauth2l fetch --json creds.json arcore.management)`
curl -H "Authorization: Bearer $BEARER_TOKEN" -H "Content-Type: application/json" -X "PATCH" \
   "https://arcore.googleapis.com/v1beta2/management/anchors/your-anchor-id-here?updateMask=expire_time" \
    -d '{ expireTime: "2021-06-29T21:00:00Z" }'

我的命令

curl https://arcore.googleapis.com/v1beta2/management/anchors/ua-f5f6649027a6e12dbd16e00fb9563c61?updateMask=expire_time ^
-H "Authorization: Bearer (I input Token here)" ^
-H 'Content-Type: application/json' ^
-X PATCH ^
-d expireTime=2024-07-31T02:00:00Z

我尝试使用原文稍作修改,以便在cmd中使用。如果你参考图片,你可以看到我实际输入的代码。 我尝试生成令牌、检查列表并更新 TTL。 我是 cmd 命令的新手,所以我认为会有语法错误,但我不确定。对不起。

My Try Command and Result Image

C:\Users\admin\Downloads\windows_amd64>curl -H "Authorization: Bearer (I input Token here)" ^
More? -H 'Content-Type: application/json' ^
More? -X PATCH ^
More? https://arcore.googleapis.com/v1beta2/management/anchors/ua-f5f6649027a6e12dbd16e00fb9563c61?updateMask=expire_time ^
More? -d expireTime="2024-07-31T02:00:00Z"
curl: (6) Could not resolve host: application
{
  "error": {
    "code": 400,
    "message": "Invalid JSON payload received. Unknown name \"expireTime\": Cannot bind query parameter. Field 'expireTime' could not be found in request message.",
    "status": "INVALID_ARGUMENT",
    "details": [
      {
        "@type": "type.googleapis.com/google.rpc.BadRequest",
        "fieldViolations": [
          {
            "description": "Invalid JSON payload received. Unknown name \"expireTime\": Cannot bind query parameter. Field 'expireTime' could not be found in request message."
          }
        ]
      }
    ]
  }
}
google-cloud-platform curl cmd arcore
© www.soinside.com 2019 - 2024. All rights reserved.