Employees
This object represents a employee of your business that interacts with customers and that have sales associated to them.
Scopes
employees:read
employees:write
Core principles
Smartbills employees are customer facing employees that generate sales. You can associate receipts with employees. This is powerfull to enable in depth analytics about your employees and helps us generate in depth reports about how your customers engage with your employees.
SBEmployee
Attribute | Description | Type |
---|---|---|
id | Smartbills unique identifier of the employee | long |
firstName | First name of the employee. This is what the customer will see on his receipt. | string |
lastName | Last name of the employee | string |
locale | Locale the employee | string |
email | Email of the employee | string |
birthdate | Birthdate of the employee | date |
createdAt | The time the employee was created | date |
updatedAt | The time the employee was updated | date |
Create a employee
Create a new employee. Requires scope employees:write
POST https://api.smartbills.io/v1/employees
Request Body
Requires body of type EmployeeCreateRequest
EmployeeCreateRequest
Parameter | Description | Type | Required |
---|---|---|---|
firstName | First name of the employee | string | required |
lastName | Last name of the employee | string | |
locale | Locale the employee | string | |
email | Email of the employee | string | |
birthdate | Birthdate of the employee | date |
{
"firstName": "John",
"lastName": "Doe",
"email": "[email protected]",
"locale": "fr-CA",
"birthDate": "1990-01-01",
}
Response
Returns a SBEmployee
{
"id":1,
"firstName": "John",
"lastName": "Doe",
"email": "[email protected]",
"locale": "fr-CA",
"birthDate": "1990-01-01",
"createdAt":"2023-01-01",
"updatedAt":null,
}
Code example
import { SBClient, SBEmployee, EmployeeCreateRequest} from "@smartbills/sdk"
const client: SBClient = new SBClient();
const request: EmployeeCreateRequest = {
"firstName": "John",
"lastName": "Doe",
"email": "[email protected]",
"locale": "fr-CA",
"birthDate": "1990-01-01",
};
const employee: SBEmployee = await client.employees.create(request);
Retrieve employee
Retrieve a employee by ID. Requires scope employees:read
GET https://api.smartbills.io/v1/employees/:id
Path parameters
Parameter | Description | Type | Required |
---|---|---|---|
id | ID of the employee to retrieve | long | required |
Response
Returns a SBEmployee
{
"id":1,
"firstName": "John",
"lastName": "Doe",
"email": "[email protected]",
"locale": "fr-CA",
"birthDate": "1990-01-01",
"createdAt":"2023-01-01",
"updatedAt":"2023-01-06",
}
Code example
import { SBClient, SBEmployee, EmployeeCreateRequest} from "@smartbills/sdk"
const client:SBClient = new SBClient();
const employee: SBEmployee = await client.employees.getByIdAsync(1);
List employees
Retrieve a list of employees. Requires scope employees:read
GET https://api.smartbills.io/v1/employees?page=1&pageSize=100
Query parameters
Requires query parameters of type EmployeeListRequest
Parameter | Description | Type | Required | Default |
---|---|---|---|---|
page | Current page | long | required | 1 |
pageSize | Number of records to return | long | required | 100 |
orderBy | Order the results by a key of SBEmployee | keyof SBEmployee | createdAt | |
sortOrder | Order of the sort | asc or desc | desc |
{
"page": 1,
"pageSize": 100,
"orderBy": "createdAt",
"sortOrder": "desc",
}
Response
Returns a SBList<SBEmployee>
{
"data": [{
"id": 1,
"firstName": "John",
"lastName": "Doe",
"email": "[email protected]",
"locale": "fr-CA",
"birthDate": "1990-01-01",
"createdAt":"2023-01-01",
"updatedAt":"2023-01-06",
}],
"metadata": {
"page":1,
"pageSize":100,
"totalPages":1,
"count":1,
},
}
Code example
import { SBClient, SBEmployee, SBList, EmployeeListRequest} from "@smartbills/sdk"
const client = new SBClient();
const request: EmployeeListRequest = {
"page": 1,
"pageSize": 100,
"orderBy": "createdAt",
"sortOrder": "desc",
};
const employees: SBList<SBEmployee> = await client.employees.list(request);
Update a employee
Update information about a employee. Requires scope employees:write
PUT https://api.smartbills.io/v1/employees/:id
Path parameters
Parameter | Description | Type | Required |
---|---|---|---|
id | ID of the employee to update | long | required |
Body parameters
Requires a body of type EmployeeUpdateRequest
Parameter | Description | Type | Required |
---|---|---|---|
firstName | First name of the employee | string | required |
lastName | Last name of the employee | string | required |
email | Email of the employee | string | required |
locale | Locale the employee | string | required |
birthdate | Birthdate of the employee | date |
{
"firstName": "John",
"lastName": "Doe",
"email": "[email protected]",
"locale": "fr-CA",
"birthDate": "1990-01-01",
}
Response
Returns a SBEmployee
{
"id":1,
"firstName": "John",
"lastName": "Doe",
"email": "[email protected]",
"locale": "fr-CA",
"birthDate": "1990-01-01",
"createdAt":"2023-01-01",
"updatedAt":"2023-01-06",
}
Code example
import { SBClient, SBEmployee, EmployeeUpdateRequest} from "@smartbills/sdk"
const client:SBClient = new SBClient();
const request: EmployeeUpdateRequest = {
"firstName": "John",
"lastName": "Doe",
"email": "[email protected]",
"locale": "fr-CA",
"birthDate": "1990-01-01",
}
const employee:SBEmployee = await client.employeess.updateAsync(1, request);
Delete a employee
Delete a employee. Requires scope employees:write
DELETE https://api.smartbills.io/v1/employees/:id
Path parameters
Parameter | Description | Type | Required |
---|---|---|---|
id | ID of the employee to delete | long | required |
Response
Returns a SBEmployee
{
"id":1,
"firstName": "John",
"lastName": "Doe",
"email": "[email protected]",
"locale": "fr-CA",
"birthDate": "1990-01-01",
"createdAt":"2023-01-01",
"updatedAt":"2023-01-06",
}
Code example
import { SBClient, SBEmployee} from "@smartbills/sdk"
const client:SBClient = new SBClient();
const employee:SBEmployee = await client.employeess.deleteAsync(1);