Clients endpoint

GET /pro/api/clients

Retrieves all clients, ordered by name.

Sample request:

$ curl \
   -H 'Authorization: Token token="xMsNwttqN5bVNEYcrIF01s65"' \
   https://dradis-pro.dev/pro/api/clients

Result:

[
  {
    "id": 1,
    "name": "Test Client 1",
    "client_sice": "2015-05-21",
    "created_at": "2015-05-21T16:30:45Z",
    "updated_at": "2015-07-29T11:01:37Z",
    "projects": [
      {
        "id": 1,
        "name": "Test Project"
      },
      {
        "id": 2,
        "name": "Test Project 2"
      },
      {
        "id": 3,
        "name": "Test Project 3"
      }
    ]
  },
  {
    "id": 2,
    "name": "Test Client 2",
    "client_sice": "2015-07-29",
    "created_at": "2015-07-29T11:00:24Z",
    "updated_at": "2015-07-29T11:02:02Z",
    "projects": [

    ]
  },
  {
    "id": 3,
    "name": "Test Client 3",
    "client_sice": "2015-07-29",
    "created_at": "2015-07-29T11:02:11Z",
    "updated_at": "2015-07-29T11:02:11Z",
    "projects": [

    ]
  }
]

GET /pro/api/clients/:id

Retrieves a single client.

Sample request:

$ curl \
  -H 'Authorization: Token token="xMsNwttqN5bVNEYcrIF01s65"' \
  https://dradis-pro.dev/pro/api/clients/1

Result:

{
  "id": 1,
  "name": "Test Client 1",
  "client_sice": "2015-05-21",
  "created_at": "2015-05-21T16:30:45Z",
  "updated_at": "2015-07-29T11:01:37Z",
  "projects": [
    {
      "id": 1,
      "name": "Test Project"
    },
    {
      "id": 2,
      "name": "Test Project 2"
    },
    {
      "id": 3,
      "name": "Test Project 3"
    }
  ]
}

POST /pro/api/clients

Creates a client. The attributes for the client must be provided in the POST body as JSON. HTTP status 201 will be returned if the creation completes successfully, and a Location header will be sent with the response, set to the URL of the newly created resource.

Accepted Parameter Use
client Pass it the name parameter
name Pass it the name of the client you want to create within Dradis

Sample request:

$ curl \
  -H 'Authorization: Token token="xMsNwttqN5bVNEYcrIF01s65"' \
  -H 'Content-type: application/json' \
  -X POST \
  -d '{"client":{"name":"Test Client 4"}}' \
  https://dradis-pro.dev/pro/api/clients

Result:

{
  "id": 4,
  "name": "Test Client 4",
  "client_sice": "2015-07-29",
  "created_at": "2015-07-29T11:00:24Z",
  "updated_at": "2015-07-29T11:00:24Z",
  "projects": [

  ]
}

PUT /pro/api/clients/:id

Updates a client. The attributes to be updated must be provided in the POST body as JSON. HTTP status 200 will be returned if the update completes successfully.

See POST above for details on accepted parameters

Sample request:

$ curl \
  -H 'Authorization: Token token="xMsNwttqN5bVNEYcrIF01s65"' \
  -H 'Content-type: application/json' \
  -X PUT \
  -d '{"client":{"name":"Test Client 4 - Updated"}}' \
  https://dradis-pro.dev/pro/api/clients/4

Result:

{
  "id": 4,
  "name": "Test Client 4 - Updated",
  "client_sice": "2015-07-29",
  "created_at": "2015-07-29T11:26:50Z",
  "updated_at": "2015-07-29T11:27:15Z",
  "projects": [

  ]
}

DELETE /pro/api/clients/:id

Deletes a client. HTTP status 204 will be returned if the deletion completes successfully.

Sample request:

$ curl \
  -H 'Authorization: Token token="xMsNwttqN5bVNEYcrIF01s65"' \
  -X DELETE \
  https://dradis-pro.dev/pro/api/clients/4

Result:

HTTP/1.1 204 No Content

Next help article: Projects endpoint →