Create a client
Request to create a new client:
POST /api/v2/clients.json
The request body contains the client object. name and at least one
contact are required. When tenant_id is omitted, the client is created in the tenant of the API
user.
For example:
{
"client": {
"tenant_id": "156340bf-8b47-21e4-95a4-e03f497dbd44",
"name": "Contoso",
"contacts": [
{"phone_number": "1234567890", "name": null}
]
}
}
Response contains HTTP status code as shown in the following table.
| Response | Description |
|---|---|
| 201 Created | The client has been successfully created. The |
| Location: /api/v2/clients/e011c408-f288-11e4-9b73-e03f497dbdff.json |
{"url": "/api/v2/clients/e011c408-f288-11e4-9b73-e03f497dbdff.json"} | | 400 Bad Request |
The request cannot be completed because the supplied JSON object has invalid data.
The response contains a detailed description of the error, like:
{"error": "InvalidRecord", "explanation": "Record Validation errors", "details": {"contacts": "Required"}} |
| 403 Forbidden | The request cannot be completed because API user has no permission to create clients |