Accounts¶
Getting accounts list¶
- GET /api/v2/accounts¶
Example request:
GET /api/v2/accounts HTTP/1.1 X-Access-Token: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE0NDIwMDIxNzkzNTh9.pKXWfzXqbp8FMbOKocNaSlT1bYq4Xqzol-0kEXOY0_s X-Key: 8fd26a17-eb28-4c74-aa6f-a3794f4f466c
Example response:
HTTP/1.1 200 OK { "status": "OK", "data": { "100": { "id": "100", "domain": "10.10.10.144", "scheme": "account", "online": false, "state": "nonreg" }, "101": { "id": "101", "domain": "10.10.10.144", "scheme": "account", "online": false, "state": "nonreg" } } }
- Request Headers
X-Key and X-Access-Token – Auth Token
- Status Codes
200 OK – No error
400 Bad Request – Bad request
CURL example:
curl -XGET -H 'X-Access-Token: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE0NDIxNzA0NDk2NTB9.WqTx_dpbuTyp-l8w6rmQhzoatI-qPRkoM-hmxXTAzaU' -H 'X-Key: bed5ea60-84e7-4eba-b6ad-e3a23f220be1' "https://cloud.webitel.com/engine/api/v2/accounts"
Get an account info¶
- GET /api/v2/accounts/(account_id)¶
Example request:
GET /api/v2/accounts/100 HTTP/1.1 X-Access-Token: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE0NDIwMDIxNzkzNTh9.pKXWfzXqbp8FMbOKocNaSlT1bYq4Xqzol-0kEXOY0_s X-Key: 8fd26a17-eb28-4c74-aa6f-a3794f4f466c
Example response:
HTTP/1.1 200 OK { "status":"OK", "data":{ "a1-hash":"dbe77b19c3d79717d910900a2595bed7", "dial-string":"{webitel_call_uuid=${create_uuid()},sip_invite_domain=10.10.10.144}${sofia_contact(\*/100@10.10.10.144)},${verto_contact(100@10.10.10.144)}", "jsonrpc-allowed-event-channels":"demo,conference,presence", "jsonrpc-allowed-methods":"verto,fsapi", "jsonrpc-password":"100", "jsonrpc-allowed-fsapi":"version", "cc-agent":"true", "cc-agent-type":"callback", "vm-enabled":"true", "vm-password":"1234", "cc-agent-contact":"{presence_id=100@10.10.10.144}{webitel_call_uuid=${create_uuid()},sip_invite_domain=10.10.10.144}${sofia_contact(\*/100@10.10.10.144)},${verto_contact(100@10.10.10.144)}", "cc-agent-max-no-answer":"3", "webitel-extensions":"100", "http-allowed-api":"voicemail", "webitel-admin":"true", "variable_w_domain":"10.10.10.144", "variable_user_scheme":"account", "variable_user_context":"default", "variable_effective_caller_id_name":"Igor", "variable_outbound_caller_id_name":"100", "variable_account_role":"admin", "variable_default_language":"ru" } }
- Parameters
account_id (string) – Webitel Account ID
- Request Headers
X-Key and X-Access-Token – Auth Token
- Status Codes
200 OK – No error
400 Bad Request – Bad request
404 Not Found – Not found
CURL example:
curl -XGET -H 'X-Access-Token: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE0NDIxNzA0NDk2NTB9.WqTx_dpbuTyp-l8w6rmQhzoatI-qPRkoM-hmxXTAzaU' -H 'X-Key: bed5ea60-84e7-4eba-b6ad-e3a23f220be1' "https://cloud.webitel.com/engine/api/v2/accounts/100"
Creat an account¶
- POST /api/v2/accounts¶
Example request:
POST /api/v2/accounts HTTP/1.1 Content-Type: application/json X-Access-Token: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE0NDIwMDIxNzkzNTh9.pKXWfzXqbp8FMbOKocNaSlT1bYq4Xqzol-0kEXOY0_s X-Key: 8fd26a17-eb28-4c74-aa6f-a3794f4f466c { "login": "109", "password": "109", "role": "user", "domain": "10.10.10.144", "parameters": ["vm-enabled=true", "webitel-extensions=109"], "variables": ["default_language=ru"] }
Example response:
HTTP/1.1 200 OK { "status": "OK", "data": { "a1-hash":"5a3b8a1408181a5a9613b639cf2f65f6", "dial-string":"{webitel_call_uuid=${create_uuid()},sip_invite_domain=10.10.10.144}${sofia_contact(\*/109@10.10.10.144)},${verto_contact(109@10.10.10.144)}", "webitel-admin":"true", "jsonrpc-allowed-event-channels":"demo,conference,presence", "jsonrpc-allowed-methods":"verto", "jsonrpc-password":"109", "cc-agent":"true", "webitel-extensions":"109", "vm-enabled":"false", "variable_w_domain":"10.10.10.144", "variable_user_scheme":"account", "variable_user_context":"default", "variable_effective_caller_id_name":"109", "variable_outbound_caller_id_name":"109", "variable_account_role":"admin", "variable_default_language":"ru" } }
- Request JSON Object
login (string) – Webitel User ID
password (string) – User password
role (string) – admin or user role
domain (string) – The domain name
variables (array) – Additional variables
parameters (array) – Additional parameters
- Request Headers
X-Key and X-Access-Token – Auth Token
Content-Type – application/json
- Status Codes
200 OK – No error
400 Bad Request – Bad request
CURL example:
curl -XPOST -H 'X-Access-Token: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE0NDIxNzA0NDk2NTB9.WqTx_dpbuTyp-l8w6rmQhzoatI-qPRkoM-hmxXTAzaU' -H 'X-Key: bed5ea60-84e7-4eba-b6ad-e3a23f220be1' -H 'Content-Type: application/json' -d '{"login": "109","password": "109","role": "user","domain": "10.10.10.144", "parameters": ["vm-enabled=true", "webitel-extensions=109"], "variables": ["default_language=ru"]}' "https://cloud.webitel.com/engine/api/v2/accounts"
Updating accounts¶
- PUT /api/v2/accounts/(account_id)¶
Example request:
PUT /api/v2/accounts/103 HTTP/1.1 Content-Type: application/json X-Access-Token: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE0NDIwMDIxNzkzNTh9.pKXWfzXqbp8FMbOKocNaSlT1bYq4Xqzol-0kEXOY0_s X-Key: 8fd26a17-eb28-4c74-aa6f-a3794f4f466c { "password": "103", "variables": ["default_language=ru"] }
Example response:
HTTP/1.1 200 OK { "status":"OK", "info":{ "a1-hash":"5a3b8a1408181a5a9613b639cf2f65f6", "dial-string":"{webitel_call_uuid=${create_uuid()},sip_invite_domain=10.10.10.144}${sofia_contact(\*/103@10.10.10.144)},${verto_contact(103@10.10.10.144)}", "webitel-admin":"true", "jsonrpc-allowed-event-channels":"demo,conference,presence", "jsonrpc-allowed-methods":"verto", "jsonrpc-password":"103", "cc-agent":"true", "webitel-extensions":"103", "vm-enabled":"false", "variable_w_domain":"10.10.10.144", "variable_user_scheme":"account", "variable_user_context":"default", "variable_effective_caller_id_name":"103", "variable_outbound_caller_id_name":"103", "variable_account_role":"admin", "variable_default_language":"ru" } }
- Parameters
account_id (string) – Webitel Account ID
- Request Headers
X-Key and X-Access-Token – Auth Token
Content-Type – application/json
- Status Codes
200 OK – No error
400 Bad Request – Bad request
404 Not Found – Not found
curl -XPUT -H 'X-Access-Token: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE0NDIxNzA0NDk2NTB9.WqTx_dpbuTyp-l8w6rmQhzoatI-qPRkoM-hmxXTAzaU' -H 'X-Key: bed5ea60-84e7-4eba-b6ad-e3a23f220be1' -H 'Content-Type: application/json' -d '{"password": "103","variables": ["default_language=ru"]}' "https://cloud.webitel.com/engine/api/v2/accounts/103"
Deleting accounts¶
- DELETE /api/v2/accounts/(account_id)¶
Example request:
DELETE /api/v2/accounts/109 HTTP/1.1 X-Access-Token: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE0NDIwMDIxNzkzNTh9.pKXWfzXqbp8FMbOKocNaSlT1bYq4Xqzol-0kEXOY0_s X-Key: 8fd26a17-eb28-4c74-aa6f-a3794f4f466c
Example response:
HTTP/1.1 200 OK { "status":"OK", "info":"+OK destroyed!\n" }
- Parameters
account_id (string) – Webitel Account ID
- Request Headers
X-Key and X-Access-Token – Auth Token
- Status Codes
200 OK – No error
400 Bad Request – Bad request
curl -XDELETE -H 'X-Access-Token: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE0NDIxNzA0NDk2NTB9.WqTx_dpbuTyp-l8w6rmQhzoatI-qPRkoM-hmxXTAzaU' -H 'X-Key: bed5ea60-84e7-4eba-b6ad-e3a23f220be1' "https://cloud.webitel.com/engine/api/v2/accounts/109"