Ask Your Question

when i am sending a curl to test keystone configuration i am receiving "Expecting to find valid JSON in request body" [closed]

asked 2016-01-05 00:47:50 -0600

vibhu gravatar image

updated 2016-01-05 11:42:04 -0600

smaffulli gravatar image

curl request:

sudo curl -d '{"auth":{"passwordCredentials": {"username": "admin" "password": "admin"}}}' -H "Content-type: application/json" http://localhost:5000/v2.0/tokens

error :

 {"error": {"message": "Expecting to find valid JSON in request body. The server could not comply with the request since it is either malformed or otherwise incorrect. The client is assumed to be in error.", "code": 400, "title": "Bad Request"}}
edit retag flag offensive reopen merge delete

Closed for the following reason duplicate question by vibhu
close date 2016-01-05 22:17:42.791958

2 answers

Sort by ยป oldest newest most voted

answered 2016-01-05 04:39:00 -0600

updated 2016-01-05 04:43:23 -0600

Please follow this link for a proper request: Apart from that add tenant to the request. You can use a request like this:

curl -d '{"auth":{"passwordCredentials":{"username": "admin", "password": "admin"},"tenantName": "admin"}}' -H "Content-Type: application/json" http://localhost:5000/v2.0/tokens
edit flag offensive delete link more


thanks man, it worked :)

vibhu gravatar imagevibhu ( 2016-01-05 22:16:43 -0600 )edit

good to know, Mark the answer as correct for the other users to find it useful.

Syed Awais Ali gravatar imageSyed Awais Ali ( 2016-01-06 03:41:54 -0600 )edit

answered 2016-01-05 03:19:33 -0600

cihand gravatar image

You are missing a comma after the value for the username key. The payload should be

 '{"auth":{"passwordCredentials": {"username": "admin", "password": "admin"}}}'

On an unrelated note, I don't think that that you need to execute curl with sudo.

edit flag offensive delete link more


thanks for the answer :) it was hard to catch error

vibhu gravatar imagevibhu ( 2016-01-05 22:22:27 -0600 )edit

thanks very much

bojue213 gravatar imagebojue213 ( 2017-08-14 04:35:45 -0600 )edit

Get to know Ask OpenStack

Resources for moderators

Question Tools


Asked: 2016-01-05 00:47:50 -0600

Seen: 1,822 times

Last updated: Jan 05 '16