0

I used below method to get Auth-token and i got the output as below.But if use that id as Auth-token for PUT method it's not working it's showing as explained below.

curl -sd '{"auth":{"passwordCredentials":{"username": "admin", "password": "password"}}}' -H "Content-type: application/json" http://169.0.0.11:5000/v2.0/tokens | python -m json.tool

{
"access": {
    "metadata": {
        "is_admin": 0,
        "roles": []
    },
    "serviceCatalog": [],
    "token": {
        "audit_ids": [
            "GgpxHyihQVyuI1ryerQZVw"
        ],
        "expires": "2016-08-15T16:11:49Z",
        "id": "bcced26a96304e8197fa85e110df9aa2",
        "issued_at": "2016-08-15T15:11:49.386446"
    },
    "user": {
        "id": "a5064af3b125449a9a09e9b69966f843",
        "name": "admin",
        "roles": [],
        "roles_links": [],
        "username": "admin"
    }
}

}

curl -i -X PUT "X-Auth-Token:bcced26a96304e8197fa85e110df9aa2" http://169.0.0.11/dashboard/project/containers/test/mymusic/
but its saying that Could not resolve host: X-AUTH-TOKEN HTTP/1.1 301 MOVED PERMANENTLY
can any one help me to solve this problem please.

chetan t
  • 21
  • 1
  • 3

1 Answers1

0

I believe you have missed to add -H for Header, rest looks fine.

curl -i -X PUT -H "X-Auth-Token:bcced26a96304e8197fa85e110df9aa2" http://169.0.0.11/dashboard/project/containers/test/mymusic/
Karthik Prasad
  • 9,662
  • 10
  • 64
  • 112
  • thanks.Yes after using H also i am getting the same error 301 moved permenently – chetan t Aug 17 '16 at 11:32
  • Can you login to Dashboard from browser and then paste the URL? is it accessible?, generally when accessing REST API, you need to provide ports, as services run in different port such as glance in 9292 etc? – Karthik Prasad Aug 17 '16 at 11:54
  • Ya .I can login through browser and I used that URL only – chetan t Aug 18 '16 at 19:45