Home > OS >  How to add this request body to my CURL request
How to add this request body to my CURL request

Time:02-03

I have a post request that I am submitting using CURL:

curl -L -X POST https://pubsub.googleapis.com/v1/projects/projectName/subscriptions/subName:pull?key=redactedAPIKey

I need to add a request body to the request that looks like this:

‘{“returnImmediately”: true, “maxMessages”: 1}’

What is the proper syntax for achieving this?

I have tried:

curl -L -X POST https://pubsub.googleapis.com/v1/projects/projectName/subscriptions/subName:pull?key=redactedAPIKey -H 'Content-Type: application/json' -d ‘{“returnImmediately”: true, “maxMessages”: 1}’

Which failed.

CodePudding user response:

Try this

curl -XPOST -H "Content-type: application/json" -d '{'returnImmediately': true, maxMessages: 1}' 'urlHere'
  •  Tags:  
  • Related