• Relational Database Service

rds
  1. Help Center
  2. Relational Database Service
  3. API Reference
  4. API Calling
  5. Examples
  6. Obtaining a Token

Obtaining a Token

All the RDS API requests need to be authenticated. If RDS APIs use tokens for authentication, the user's token must be obtained and X-Auth-Token must be added to the request header of a service API when this API is invoked.

To obtain the token, see section "Obtaining the User Token" in the Identity and Access Management API Reference. If the request is successfully processed, the value of X-Subject-Token included in the response header is the token value.

Run the curl command to obtain the token:

curl -i -X POST $TOKEN_URL -H "Content-Type: application/json" -d '{"auth": {"identity": {"methods": ["password"], "password": {"user": {"name": "'"$OS_USERNAME"'", "password": "'"$OS_PASSWORD"'", "domain": {"name": "'"$OS_DOMAINNAME"'"}}}}, "scope": {"project":{"name":"'"$OS_REGIONCODE"'","domain":{"name":"'"$OS_DOMAINNAME"'"}}}}}'

Example response:

{
    "token": {
        "expires_at": "2016-06-21T10:02:13.752000Z",
        "issued_at": "2016-06-20T10:02:13.752000Z",
        "methods": [
            "password"
        ],
        "project": {
            "name": "projectname",
            "id": "project_id",
            "domain": {
                "name": "domainname",
                "id": "domainid"
            }
        },
        "user": {
            "domain": {
                "name": "domainname",
                "id": "domainid"
            },
            "id": "userid",
            "name": "username"
        },
        "catalog": [],
        "roles": [
            {
                "name": "rolesname1",
                "id": " rolesid1"
            },
            {
                "id": " rolesid2",
                "name": " rolesname2"
            }
        ]
    }
}