Update a Credential

patch

/api/v2/credentials/{id}/

Make a PUT or PATCH request to this resource to update this credential. The following fields may be modified:

  • name: Name of this credential. (string, required)
  • description: Optional description of this credential. (string, default="")
  • organization: (id, default=None)
  • credential_type: Specify the type of credential you want to create. Refer to the Ansible Tower documentation for details on each type. (id, required)

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

For a PATCH request, include only the fields that are being modified.

Request

Supported Media Types
Path Parameters
Query Parameters
Body ()
Root Schema : schema
Example:
{
    "inputs":{
        "password":"$encrypted$",
        "username":"joe"
    }
}
Back to Top

Response

Supported Media Types

200 Response

Body
Example Response (application/json)
{
    "cloud":false,
    "created":"2018-02-01T08:00:00.000000Z",
    "credential_type":1,
    "description":"",
    "id":1,
    "inputs":{
        "password":"$encrypted$",
        "username":"joe"
    },
    "kind":"ssh",
    "kubernetes":false,
    "managed_by_tower":false,
    "modified":"2018-02-01T08:00:00.000000Z",
    "name":"Best credential ever",
    "organization":1,
    "related":{
        "access_list":"/api/v2/credentials/1/access_list/",
        "activity_stream":"/api/v2/credentials/1/activity_stream/",
        "copy":"/api/v2/credentials/1/copy/",
        "credential_type":"/api/v2/credential_types/1/",
        "input_sources":"/api/v2/credentials/1/input_sources/",
        "object_roles":"/api/v2/credentials/1/object_roles/",
        "organization":"/api/v2/organizations/1/",
        "owner_teams":"/api/v2/credentials/1/owner_teams/",
        "owner_users":"/api/v2/credentials/1/owner_users/"
    },
    "summary_fields":{
        "credential_type":{
            "description":"",
            "id":1,
            "name":"Machine"
        },
        "object_roles":{
            "admin_role":{
                "description":"Can manage all aspects of the credential",
                "id":15,
                "name":"Admin"
            },
            "read_role":{
                "description":"May view settings for the credential",
                "id":17,
                "name":"Read"
            },
            "use_role":{
                "description":"Can use the credential in a job template",
                "id":16,
                "name":"Use"
            }
        },
        "organization":{
            "description":"test-org-desc",
            "id":1,
            "name":"test-org"
        },
        "owners":[
            {
                "description":"test-org-desc",
                "id":1,
                "name":"test-org",
                "type":"organization",
                "url":"/api/v2/organizations/1/"
            }
        ],
        "user_capabilities":{
            "copy":true,
            "delete":true,
            "edit":true,
            "use":true
        }
    },
    "type":"credential",
    "url":"/api/v2/credentials/1/"
}

400 Response

Body
Example Response (application/json)
{
    "credential_type":[
        "You cannot change the credential type of the credential, as it may break the functionality of the resources using it."
    ]
}
Back to Top