Search code examples
google-cloud-platformcroncloudscheduled-taskscron-task

Cloud scheduler - HTTP - list in payload/body


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 : enter image description here

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 ?


Solution

  • Simply use you raw JSON {"foo": ["bar"]}. The escape characters are for gcloud CLI.