Reputation: 1493
I have a scheduled job in GCP that POSTs to the endpoint of a REST service. The payload expected by the url is
{"foo": ["bar"]}
I specified "{\"foo\": \[\"bar\"\]}"
in the Body field in the web console :
AND specified application/json
in the Content-Type
header.
But I get 400 error from the endpoint (Bad request). The endpoint is working perfectly fine when requested from the swagger, so I think the problem comes from how I specify the payload in the cron job.
How should I write the payload in Cloud Scheduler web interface ?
Upvotes: 1
Views: 1186
Reputation: 76000
Simply use you raw JSON {"foo": ["bar"]}
. The escape characters are for gcloud CLI.
Upvotes: 4