POST - Create new user
Create new user
Request
- Method:
POST - Endpoint:
/users - Base URL:
https://api.targpatrol.com/api/v1 - Operation ID:
create-new-user
Authorization
This endpoint requires an external API key.
x-api-key: {your_external_api_key}
Request Body
Required: yes
Content-Type: application/json
Schema: UserRequest
Schema
{
"$ref": "#/components/schemas/UserRequest"
}
Example: example-1
{
"firstName": "John",
"middleName": "Lee",
"lastName": "Fox",
"employeeNo": "1234",
"employeePin": "4321",
"email": "fox.john@gmail.com",
"phone": "80291110099",
"locale": "en-US",
"role": "ADMIN",
"photoId": "a7c6f740-2a42-449c-a03b-b8d36aa4709a",
"locationIds": [
"99b770c0-2396-43d3-b109-85a9d73df7b1",
"e1dfeaba-4318-4411-be91-f8af5214dd02"
],
"tags": [
"tag1",
"tag2"
],
"externalId": "external-user-1",
"gpsTracking": true
}
Responses
201 OK
Content-Type: application/json
Schema: UserResponse
Schema
{
"$ref": "#/components/schemas/UserResponse"
}
Example: example-1
{
"id": "be63c536-6cf3-4866-8970-37a956e3f403",
"firstName": "John",
"middleName": "Lee",
"lastName": "Fox",
"employeeNo": "1234",
"employeePin": "4321",
"email": "fox.john@gmail.com",
"phone": "80291110099",
"locale": "en-US",
"role": "ADMIN",
"status": "ACTIVE",
"photoId": null,
"locationIds": [
"99b770c0-2396-43d3-b109-85a9d73df7b1",
"e1dfeaba-4318-4411-be91-f8af5214dd02"
],
"tags": [
"tag1",
"tag2"
],
"userLinked": true,
"externalId": "external-user-1",
"gpsTracking": true
}
400 Bad request
Content-Type: application/json
Schema: ErrorResponse
Schema
{
"$ref": "#/components/schemas/ErrorResponse"
}
Example: example-1
{
"message": "validation failed",
"code": "validation.failed",
"timestamp": "2023-03-07T05:57:59.315Z",
"details": [
{
"message": "must not be null",
"code": "validation.notnull.failed",
"identifier": "role"
}
]
}
401 Unauthorized
406 Not Acceptable
Content-Type: application/json
Schema: ErrorResponse
Schema
{
"$ref": "#/components/schemas/ErrorResponse"
}
Example: example-1
{
"message": "mismatch in the types of content",
"code": "not.acceptable",
"timestamp": "2023-03-07T05:57:59.315Z"
}
500 Internal Server Error
Content-Type: application/json
Schema: ErrorResponse
Schema
{
"$ref": "#/components/schemas/ErrorResponse"
}
Example: example-1
{
"message": "internal server error",
"code": "internal.server.error",
"timestamp": "2023-03-07T05:57:59.315Z"
}