SBEmployee

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

AttributeDescriptionType
idSmartbills unique identifier of the employeelong
firstNameFirst name of the employee. This is what the customer will see on his receipt.string
lastNameLast name of the employeestring
localeLocale the employeestring
emailEmail of the employeestring
birthdateBirthdate of the employeedate
createdAtThe time the employee was createddate
updatedAtThe time the employee was updateddate

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

ParameterDescriptionTypeRequired
firstNameFirst name of the employeestringrequired
lastNameLast name of the employeestring
localeLocale the employeestring
emailEmail of the employeestring
birthdateBirthdate of the employeedate
EmployeeCreateRequest
{
    "firstName": "John",
    "lastName": "Doe",
    "email": "[email protected]",
	"locale": "fr-CA",
	"birthDate": "1990-01-01",
}

Response

Returns a SBEmployee

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

ParameterDescriptionTypeRequired
idID of the employee to retrievelongrequired

Response

Returns a SBEmployee

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

ParameterDescriptionTypeRequiredDefault
pageCurrent pagelongrequired1
pageSizeNumber of records to returnlongrequired100
orderByOrder the results by a key of SBEmployeekeyof SBEmployeecreatedAt
sortOrderOrder of the sortasc or descdesc
EmployeeListRequest
{
    "page": 1,
    "pageSize": 100,
	"orderBy": "createdAt",
	"sortOrder": "desc",
}

Response

Returns a SBList<SBEmployee>

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

ParameterDescriptionTypeRequired
idID of the employee to updatelongrequired

Body parameters

Requires a body of type EmployeeUpdateRequest

ParameterDescriptionTypeRequired
firstNameFirst name of the employeestringrequired
lastNameLast name of the employeestringrequired
emailEmail of the employeestringrequired
localeLocale the employeestringrequired
birthdateBirthdate of the employeedate
EmployeeUpdateRequest
{
    "firstName": "John",
    "lastName": "Doe",
    "email": "[email protected]",
	"locale": "fr-CA",
	"birthDate": "1990-01-01",
}

Response

Returns a SBEmployee

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

ParameterDescriptionTypeRequired
idID of the employee to deletelongrequired

Response

Returns a SBEmployee

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);