Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-cloud-platform/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
发布到云数据流模板REST API时无法设置动态模板_Rest_Google Cloud Platform_Google Cloud Dataflow_Google Cloud Scheduler - Fatal编程技术网

发布到云数据流模板REST API时无法设置动态模板

发布到云数据流模板REST API时无法设置动态模板,rest,google-cloud-platform,google-cloud-dataflow,google-cloud-scheduler,Rest,Google Cloud Platform,Google Cloud Dataflow,Google Cloud Scheduler,我正试图通过发布到RESTAPI并通过OAUTH进行身份验证来使用云调度器安排数据流作业。我已经创建了一个模板,当我手动使用数据流“从模板创建作业”时,它就可以工作了。但是,当用作HTTP端点()时,它返回以下错误: { "error": { "code": 400, "message": "Invalid JSON payload received. Unknown name \"jobName

我正试图通过发布到RESTAPI并通过OAUTH进行身份验证来使用云调度器安排数据流作业。我已经创建了一个模板,当我手动使用数据流“从模板创建作业”时,它就可以工作了。但是,当用作HTTP端点()时,它返回以下错误:

{
  "error": {
    "code": 400,
    "message": "Invalid JSON payload received. Unknown name \"jobName\": Cannot bind query parameter. Field 'jobName' could not be found in request message.\nInvalid JSON payload received. Unknown name \"environment\": Cannot bind query parameter. Field 'environment' could not be found in request message.\nInvalid JSON payload received. Unknown name \"parameters\": Cannot bind query parameter. Field 'parameters' 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 \"jobName\": Cannot bind query parameter. Field 'jobName' could not be found in request message."
          },
          {
            "description": "Invalid JSON payload received. Unknown name \"environment\": Cannot bind query parameter. Field 'environment' could not be found in request message."
          },
          {
            "description": "Invalid JSON payload received. Unknown name \"parameters\": Cannot bind query parameter. Field 'parameters' could not be found in request message."
          }
        ]
      }
    ]
  }
}
以下是我的帖子正文:

{
  "jobName": "test",
  "parameters": {
    "region": "europe-west1"
  },
  "environment": {
    "tempLocation": "gs://${my.proj}/temp",
    "zone": "europe-west1"
  }
}

谢谢你的帮助,提前谢谢你

我验证了以下方法的有效性:

TEMPLATE_LOCATION="gs://${my.proj}/templates/${template.name}"
API_ROOT_URL="https://dataflow.googleapis.com/"
TEMPLATES_LAUNCH_API="${API_ROOT_URL}/v1b3/projects/${my.proj}/locations/europe-west1/templates:launch"

time curl -X POST -H "Content-Type: application/json" \
 -H "Authorization: Bearer $(gcloud auth print-access-token)" \
 "${TEMPLATES_LAUNCH_API}"`
 `"?gcsPath=${TEMPLATE_LOCATION}"`
 ` -d ' 
 {
    "jobName": "test",
    "parameters": {},
    "environment": {
        "tempLocation": "gs://${my.proj}/temp",
        "workerZone": "europe-west1-d",
    }
}' 

请注意,您不需要在参数中指定区域,它是workerZone而不是zone。

如何调用API?卷发?用你的代码?你能分享这部分吗?