Create a Credential Type

post

/api/v2/credential_types/

Make a POST request to this resource with the following credential type fields to create a new credential type:

  • name: Name of this credential type. (string, required)
  • description: Optional description of this credential type. (string, default="")
  • kind: (choice, required)

    • net: Network
    • cloud: Cloud
  • inputs: Enter inputs using either JSON or YAML syntax. Refer to the Ansible Tower documentation for example syntax. (json, default={})

  • injectors: Enter injectors using either JSON or YAML syntax. Refer to the Ansible Tower documentation for example syntax. (json, default={})

Request

Supported Media Types
Body ()
Root Schema : schema
Example:
{
    "injectors":{
        "env":{
            "AWX_MY_CLOUD_TOKEN":"{{api_token}}"
        }
    },
    "inputs":{
        "fields":[
            {
                "id":"api_token",
                "label":"API Token",
                "secret":true,
                "type":"string"
            }
        ]
    },
    "kind":"cloud",
    "name":"MyCloud"
}
Back to Top

Response

Supported Media Types

201 Response

Body
Example Response (application/json)
{
    "created":"2018-02-01T08:00:00.000000Z",
    "description":"",
    "id":1,
    "injectors":{
        "env":{
            "AWX_MY_CLOUD_TOKEN":"{{api_token}}"
        }
    },
    "inputs":{
        "fields":[
            {
                "id":"api_token",
                "label":"API Token",
                "secret":true,
                "type":"string"
            }
        ]
    },
    "kind":"cloud",
    "managed_by_tower":false,
    "modified":"2018-02-01T08:00:00.000000Z",
    "name":"MyCloud",
    "namespace":null,
    "related":{
        "activity_stream":"/api/v2/credential_types/1/activity_stream/",
        "credentials":"/api/v2/credential_types/1/credentials/"
    },
    "summary_fields":{
        "user_capabilities":{
            "delete":true,
            "edit":true
        }
    },
    "type":"credential_type",
    "url":"/api/v2/credential_types/1/"
}

400 Response

Body
Example Response (application/json)
{
    "injectors":[
        "AWX_MY_CLOUD_TOKEN uses an undefined field ('api_tolkien' is undefined)"
    ]
}

401 Response

Body
Example Response (application/json)
{
    "detail":"Authentication credentials were not provided. To establish a login session, visit /api/login/."
}

403 Response

Body
Example Response (application/json)
{
    "detail":"You do not have permission to perform this action."
}
Back to Top