Reputation: 765
I am trying to PUT json data through curl request. Currently I am getting "no data provided" error.
curl --header "Content-Type: application/json" --request PUT -d @a.json https://localhost:8200/api/login
{"errors":["no data provided"]}
cat a.json
{
"key1":"value1",
"key2":"value2"
}
While when I am Posting it with double quotes and not through file its working.
curl -H "Content-Type: application/json" --request PUT -d "{\"data\":{\"key1\":\"value1\",\"key2\":\"value2\"}} " https://localhost:8200/api/login
Upvotes: 2
Views: 2243
Reputation: 61
We need to pass data section in Json.
cat a.json
{
"data": {
"key1":"value1",
"key2":"value2"
}
}
Upvotes: 4