Skip to main content

Ringostat API. Creating and adding an employee to a department

API method for creating and adding an employee to a department

Olga Kalchenko avatar
Written by Olga Kalchenko
Updated today

This method will enable automatically create new employees along with SIP accounts via API.

With this method you can:

- create a new employee.

- create a SIP account for this employee.

- associate an employee with one or more departments

Basic request parameters:

  • API request address: https://api.ringostat.net/a/v2

  • Method: POST

  • Json-rpc method: Api\\V2\\Staff.addStaff

  • Auth-key: electronic key for accessing your project in Ringostat.

  • projectId: project ID

Request headers:

  • Content-Type - application/json

  • auth-key is an electronic key for accessing your project in Ringostat

  • x-project-id - ID of your project

Body of the request:

Parameter name

Data type

Mandatory

Description

projectId

string

Yes

Project ID (specified in the access block)

creatorId

string

Yes

The ID of the user who creates the employee

access

string

Yes

Employee access level (1 - admin, 2 - analyst, 4 - manager)

wire

string

Yes

Full name of the employee

email

string

Yes

Email of the employee

extensionNumber

string

Yes

Employee internal number (2-5 digits)

directions

object

Yes

Setting employee directions

departments

array

Yes. Maybe = null

Array of department names (case insensitive)

isHasAccessToPowerDialer

boolean

No (default: false)

Has access to Power Dialer

Example for Node.js:

const https = require('https');
const data = JSON.stringify({
jsonrpc: "2.0",
method: "Api\\V2\\Staff.addStaff",
params: {
projectId: "123",
creatorId: "456",
access: "user",
fio: "Ivan Petrenko",
email: "[email protected]",
extensionNumber: "1001",
directions: {
main: [
{
type: "sip",
direction: "1001",
password: "securePassword123",
enabledForAwd: true,
isMobile: false
}
],
additional: []
},
departments: ["Main"],
isHasAccessToPowerDialer: true
},
id: 1
});
const config = {
host: 'api.ringostat.net',
path: '/v2',
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Content-Length': data.length,
'Auth-key': 'your_unique_auth_key'
}
};
const callback = (response) => {
thet result = Buffer.alloc(0);
response.on('data', chunk => {
result = Buffer.concat([result, chunk]);
});
response.on('end', () => {
console.log(result.toString());
});
};
const request = https.request(config, callback);
request.write(data);
request.end();

Example for Axios.js

const axios = require('axios');
axios({
url: 'https://api.ringostat.net/v2',
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Auth-key': 'your_unique_auth_key'
},
data: {
jsonrpc: "2.0",
method: "Api\\V2\\Staff.addStaff",
params: {
projectId: "123",
creatorId: "456",
access: "user",
fio: "Ivan Petrenko",
email: "[email protected]",
extensionNumber: "1001",
directions: {
main: [
{
type: "sip",
direction: "1001",
password: "securePassword123",
enabledForAwd: true,
isMobile: false
}
],
additional: []
},
departments: ["Secondary"],
isHasAccessToPowerDialer: true
},
id: 1
}
})
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error(error.response?.data || error.message);
});

Example for cURL

curl -X POST "https://api.ringostat.net/v2" \
-H "Content-Type: application/json" \
-H "Auth-key: your_unique_auth_key" \
-d '{
"jsonrpc": "2.0",
"method": "Api\\V2\\Staff.addStaff",
"params": {
"projectId": "123",
"creatorId": "456",
"access": "user",
"fio": "Ivan Petrenko",
"email": "[email protected]",
"extensionNumber": "1001",
"directions": {
"main": [
{
"type": "sip",
"direction": "1001",
"password": "securePassword1234!",
"enabledForAwd": true,
"isMobile": false
}
],
"additional": []
},
"departments": ["Main"],
"isHasAccessToPowerDialer": true
},
"id": 1
}'

Result:

{
"jsonrpc": "2.0",
"result": {
"result": true
},
"id": 1
}

Limitation:

A maximum of 6 directions per employee

A maximum of 3 SIP accounts in the main directions

A maximum of 3 SIP accounts in additional directions

A maximum of 3 phone numbers in the main directions

A maximum of 3 phone numbers in additional directions

Internal number: 2-5 digits

SIP password: minimum 14 characters

Name: Only letters and spaces

Email: valid email format

Did this answer your question?