I am trying to schedule a dataflow job with Cloud Scheduler by posting to REST API and authenticate by OAUTH. I have created a template and it works when I manually use Dataflow 'Create job from template'. However, when being used as a HTTP endpoint (https://dataflow.googleapis.com/v1b3/projects/${my.proj}/locations/europe-west1/templates:launch?gcsPath=gs://${my.proj}/templates/${template.name}), it returns the following error:
{
"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."
}
]
}
]
}
}
Following is my POST body:
{
"jobName": "test",
"parameters": {
"region": "europe-west1"
},
"environment": {
"tempLocation": "gs://${my.proj}/temp",
"zone": "europe-west1"
}
}
I appreciate any help, thank you in advance!!