I'm not sure if this is possible, but i am trying to curl a post, but with a json as the parameters, like such:
curl -X POST 'https://myserver/action?params={"field1":"something","whatever":10,"description":"body","id":"random","__oh__":{"session":"12345678jhgfdrtyui"}}'
however, i keep getting some error curl: (3) [globbing] nested braces not supported at pos
X
how do i do this?
To post JSON data using Curl, you need to set the Content-Type of your request to application/json and pass the JSON data with the -d command line parameter. The JSON content type is set using the -H "Content-Type: application/json" command line parameter. JSON data is passed as a string.
Users can send data with the POST request using the -d flag. The following POST request sends a user and a pass field along with their corresponding values. POSTing with curl's -d option will include a default header that looks like: Content-Type: application/x-www-form-urlencoded .
The curl error is due to braces {} and square brackets [] being special curl globbing characters. Use the -g option to turn off globbing and you should be fine.
Same issue as this post: How to PUT a json object with an array using curl
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With