Skip to content

02.Restful API docs

Gruz edited this page Jan 2, 2021 · 41 revisions

Table of Contents generated with DocToc

Create a domain

Domain name convention

When creating a domain it checks for a dot in domain_name parameter. If there is a dot, it creates a separate doman. If there is no a dot, it creates a subdomain of the main system domain.

E.g. "domain_name":"test01", will create text01.enli01.tk domain.

E.g. "domain_name":"text01.enli01.tk", will create text01.enli01.tk domain.

E.g. "domain_name":"test01.com", will create text01.com domain.

Create a domain using a subdomain at the default domain

curl -kX POST https://enli01.tk:444/signup -H 'Content-Type:application/json' -d '
{
    "team":{
        "domain_name":"test01",
        "email":"[email protected]",
        "password":"12341234",
        "username":"gruzua"
    }
}'

Create a domain name team using own domain

curl -kX POST https://enli01.tk:444/signup -H 'Content-Type:application/json' -d '
{
    "team":{
        "domain_name":"test8.com",
        "email":"[email protected]",
        "password":"12341234",
        "username":"gruzua"
    }
}'

Response example

{
  "domain_name": "test08.com",
  "domain_enabled": "true",
  "domain_description": "Created via api at 2017-05-17 14:30:10",
  "domain_uuid": "54cd6070-3b0d-11e7-bf5a-4be762d404ce",
  "message": "Team created. Login using username <b>gruzua</b>, domain name <b>test08.com</b> and password <b>12341234</b>",
  "admin_user": {
    "username": "gruzua",
    "user_enabled": "true",
    "add_user": "admin",
    "add_date": "2017-05-17 14:30:10",
    "user_uuid": "54ce8460-3b0d-11e7-8738-a1191cdaea1b",
    "contact": {
      "contact_type": "user",
      "contact_nickname": "[email protected]",
      "contact_uuid": "54cdc4b0-3b0d-11e7-888f-c38f274a1cd2",
      "contact_email": {
        "email_primary": 1,
        "email_address": "[email protected]",
        "contact_email_uuid": "54ce1c30-3b0d-11e7-8f5b-d30c8be8c26e"
      }
    }
  }
}

Register a user to a domain

A user is created being disabled. It's assumed later an admin enables it.

An extension number is autoassigned to the newly created user. The number is chosen as the max number among existing ones plus 1, but not less then 100.

So the first user gets 100 number. The next one gets 101 etc.

Create a user request

domain name parameter respect Domain name convention

curl -kX POST https://enli01.tk:444/signup -H 'Content-Type:application/json' -d '
{
    "user":{
        "domain_name":"test15",
        "email":"[email protected]",
        "password":"12341234",
        "username":"gruzua4"
    }
}'

Response example

{
  "username": "gruzua4",
  "user_enabled": "false",
  "add_user": "admin",
  "add_date": "2017-05-25 00:49:44",
  "user_uuid": "0b6ebc60-40e4-11e7-9322-f96e29d0614c",
  "contact": {
    "contact_type": "user",
    "contact_nickname": "[email protected]",
    "contact_uuid": "0b6e63f0-40e4-11e7-957a-a301cb36ddc3",
    "contact_email": {
      "email_primary": 1,
      "email_address": "[email protected]",
      "contact_email_uuid": "0b6e9890-40e4-11e7-8a3f-650993e0fa37"
    }
  },
  "domain": {
    "domain_uuid": "eb0ae200-40e3-11e7-8cc2-c9fa6462581d",
    "domain_parent_uuid": null,
    "domain_name": "test15.fusion02.realuc.io",
    "domain_enabled": "true",
    "domain_description": "Created via api at 2017-05-25 00:48:50"
  },
  "extension": {
    "directory_visible": "true",
    "directory_exten_visible": "true",
    "limit_max": 5,
    "limit_destination": "error/user_busy",
    "call_timeout": 30,
    "call_screen_enabled": "false",
    "hold_music": "local_stream://default",
    "nibble_account": null,
    "sip_force_expires": null,
    "mwi_account": null,
    "unique_id": null,
    "dial_string": null,
    "dial_user": null,
    "dial_domain": null,
    "do_not_disturb": null,
    "forward_all_destination": null,
    "forward_all_enabled": null,
    "forward_busy_destination": null,
    "forward_busy_enabled": null,
    "forward_no_answer_destination": null,
    "forward_no_answer_enabled": null,
    "forward_user_not_registered_destination": null,
    "forward_user_not_registered_enabled": null,
    "follow_me_uuid": null,
    "enabled": "true",
    "forward_caller_id_uuid": null,
    "absolute_codec_string": null,
    "extension": 102,
    "password": "59262a28a4b71",
    "accountcode": "test15.fusion02.realuc.io",
    "user_context": "test15.fusion02.realuc.io",
    "domain_uuid": "eb0ae200-40e3-11e7-8cc2-c9fa6462581d",
    "extension_uuid": "0b713f10-40e4-11e7-8a47-7de611d5c22c"
  }
}

Login and authentication

Login will return 2 tokens: Access token and Refresh token.

Access token is returned as JSON, while Refresh token is written to cookie.

Access token is short-lived. Refresh token is used to get new Access token before it's expired.

To authenticate Access token is sent in each request header like Authorization: Bearer TOKEN

Login

Login request example

curl -kX POST https://enli01.tk:444/login -b cookies.txt -c cookies.txt -D headers.txt -H 'Content-Type:application/json' -d '
{
    "username":"gruzua",
    "password":"12341234",
    "domain_name":"test01.enli01.tk"
}'

Login response example

Cookie part example:

HTTP/1.1 200 OK
Server: nginx/1.10.3
Content-Type: application/json
Transfer-Encoding: chunked
Connection: keep-alive
Cache-Control: no-cache, private
Date: Wed, 17 May 2017 17:08:09 GMT
Set-Cookie: refreshToken=eyJpdiI6InkyR1pWc0VNcGdxcnBObTBkUE1Qd0E9PSIsInZhbHVlIjoib1RpRjNLUXBSWitnSDNoaGg1bHdnWmhJOWRMTmp6WFkxc0pCRk5PVDhVcVpcL0MrQk41U0phM0E3THdCVHB3OVpGNUVaTnFsMDNBWjdFZVhGUHhJQ29LOFRMQ0NtVEFkaGQyMkJ5T2pTck91eVNldWVaTWVsU1AzQ1N5ejBFeCtMcHpITkV4dkJaMEp0cXM2bjRFUVwvZTZQdmRLREpUYndDbVZDbXNzUUowWEg5elZOc2dDZW85RHhLbGxUaHpwRjk3U3IwU1BTT3BCTDZSbXBPbE1LaU1GRmNnSTZWSFlHdlV5ZmFCOVk4YmhTR3A5ZnY5c2VmSWJBcFlyY3dCNXo3dWI2MVdcL3lsMXE3eEFuOGRmUE9XZ2RIT0ZKTTZXbU90VHBZKzcyZEpYOHZBQWgyYTJBQkFCNkNIWkVGRmhSUk5lSTFNcHBwUkNOQ0d5ODg2cWN4S2pSXC9sRm9JVVV3UVBuTFFoWXpHamdDTXMzd0tPTjBFWTVqNGJjK3hwRjdreU9BRUVtT0JDM1wvVmZ4QVRQa2VKeEVHeCtVNVRETGtNcVVBeVZDQytBZ1ZZQTZpV1FDREVrV3p1ZUJ1V2dyb0Fmb21nVzhuRmRVWVl2U0swY2xScmNkT2ZwQjMrWUZoTk5CTVROT3ZzdHVlRFJSSlhtZk41OFVnd080R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QiOjE0OTUwNDA4ODksIm5iZiI6MTQ5NTA0MDg4OSwiZXhwIjoxNDk1MDQxNDg5LCJzdWIiOiIyNzkwYzAwMC0zNzdiLTExZTctOTY4MC0yN2RjMjdlOWViY2EiLCJzY29wZXMiOltdfQ.BydfrENxU85RjpF0-rEyolFDIfN9-i37dmgrKG25XHYF8YvBWlSBj_a_BLfW5gA6tRWNeNVVxULJ93X5N2aaV4CG1R7HEAiCYDYioHaSKIU-6lAP-BlXBM4O4Xh51qjihZcV2Zc_B7f6KtwRN0Ex_vUvaP76THZWMLg-UYd0_x8MblWMpOEVTr6uIMIq1kfFkDc81SO7TaU_8C-VPPu0HGemeEYhjJ_gNeyBWGujPebOe1O01TwTPVNWm4iXW7o9ovzCoCNGKtyi8a-o9ir4YT86e5ydXPjTl0ASENv-IP7DiABFGcV7ikcuq5SqpWCfoDd3ltSbu1mkRBPM4m8y_mG-cv4TUCk1rNGe6lDU0NwZCzuDfTxNNVXC-uUf5x9xI9dGshKeRnP3J5Im_mg6MiDqP5TQY-EApOtL0sFdWwb8sVoGFpGgowom3WKtWblbeHbjwy_i2xiIrrTQWZMVP4k2rcLysvQts_AUj7HjJwe_ZFRl8wDYvyNMmPZkVw5QFfPzh0x8rjI_CswI0mRUi-QUdLPkajoPvpIpTCxbAMaNuPeD-2FHFLqq67WQg7QGtXduFJk6pRIiHRJ8S8-6QrB3U1Ftps7_TbTO2WHZa9u0cvxiSvdV4SWmO41bQZr-szIZiVCQ3_6A8k4mCEiVULcqRwfFvYPLLGeBiHL2O30",
    "expires_in":600,
    "user_uuid":"2790c000-377b-11e7-9680-27dc27e9ebca"
}

Authentication

Authenticated request example

Let's request logged in user's information using the access token.

In the example we get current user information (the logged in user is determined by the Access token) based on an access token.

curl -kX GET https://enli01.tk:444/user  -H 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6ImM5Yzk1YzEzZWVkZWNiMDUxY2QxYTBiYzk3YzE5NTc5MTU0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-11e7-9680-27dc27e9ebca",
    "domain_uuid":"278ece70-377b-11e7-a380-035c4b522c13",
    "username":"gruzua",
    "contact_uuid":"278fb7b0-377b-11e7-b558-9f39190a83d5",
    "user_status":null,
    "api_key":null,
    "user_enabled":"true",
    "add_user":"admin",
    "add_date":"2017-05-13 01:26:14"

}

Refresh

Refresh token request example

Remember, we saved cookies when logging in with keys -b cookies.txt -c cookies.txt

Not it's time to get the cookie to use the refresh token.

curl -kX POST https://enli01.tk:444/login/refresh -b cookies.txt -c cookies.txt

Refresh token response example

{
    "access_token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6ImIyMmIxNzg1NzE4YzAwOTI2OWU4Y2ZkNWI3OTAwY2IzODMzMzI1Y2Y5YWM2YzAzYzc1ODk5ZGJlZWY5M2M2MWU1OWRiNjljNzAwMGY1Y2RjIn0.eyJhdWQiOiIyIiwianRpIjoiYjIyYjE3ODU3MThjMDA5MjY5ZThjZmQ1Yjc5MDBjYjM4MzMzMjVjZjlhYzZjMDNjNzU4OTlkYmVlZjkzYzYxZTU5ZGI2OWM3MDAwZjVjZGMiLCJpYXQiOjE0OTUxOTMxOTcsIm5iZiI6MTQ5NTE5MzE5NywiZXhwIjoxNDk1MTkzNzk3LCJzdWIiOiIyNzkwYzAwMC0zNzdiLTExZTctOTY4MC0yN2RjMjdlOWViY2EiLCJzY29wZXMiOltdfQ.DYDvHfbBrcZJ0PWryn_KUaUfRoMVQmx2Z9Ym6tdUjTviDRgOOiFpqNFuNnl2bJqZK8xnP4JD219V9YAra0lr71or74p1SmE5qQ5lE2uN0_RhKRAymZU-WoyOiZwrxNQLaJcZPwvK5os0NmppeKlRo5xysn6IkpazP4fgyL84ud_4RfVfO3AriNbC_YKB2wxY_JQLW9Iz68oql8YOPP81HIKhV-HUp8mwd0iZpxRnrnQ94U5zO1a8Gif2SjsF7vO83U3qDJfB5MyAHUDknT4xvNGwbVILDzDe2c69Pj4vBFRfu1BeR9Rs1aG5dKnB22MTi1iYVsUt5ExaIBP02KVky4ntUmEHCr-U6xi9RSRvBFNZaUeHkQslLQh2LQWyIS0eE4dlG73szkvb93QhAW0SX1YqEILODhOT_om80FVXcDp0CqTPK5op3DI45Px4zxd6v7qCcm6ZzzeIo2Jga4JdLI5-mGTaLe_8xtfAe7_S28_nKmZkoCsx56XXVqiqag1Rqq3yepwSZRYXtTq9wmM2NssuXd6JuBL_1xnu2cClx8S9s5xw5elY_Z5O_jke8XCj9kr2hnuPbTL3PayCgF779gE08ptO4OoeMbXvg-NtI2YB_9H245iez9ClKADct6wstH_KalXw8vn9fcJPurLwvsCgwo0nXGXMkHLgY6ZDsEs",
    "expires_in":600
}

Create an extension (SIP phone number)

Currently not used. To make extension number autoassign

This will register an extension to the logged in user inside the user domain context. Which user is logged in and into which domain is determined by the Access token (See # Login and authentication how to get the access token).

The following example will create an extension (SIP phone number) 100 with password 100

curl -kX POST https://enli01.tk:444/extension  -H 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IjIzZTZhZGExM2FhYzM2YTVkNmQxZWM1MDY5YTM3MGYxOGU3MzdjMDhmOGFmN2FiMzI5MGI0N2I2NGI1YzU4Mjg2MTMxNWUyMTNiNzcwMTBmIn0.eyJhdWQiOiIyIiwianRpIjoiMjNlNmFkYTEzYWFjMzZhNWQ2ZDFlYzUwNjlhMzcwZjE4ZTczN2MwOGY4YWY3YWIzMjkwYjQ3YjY0YjVjNTgyODYxMzE1ZTIxM2I3NzAxMGYiLCJpYXQiOjE0OTQ2Mzk3MTcsIm5iZiI6MTQ5NDYzOTcxNywiZXhwIjoxNDk0NjQwMzE3LCJzdWIiOiI1MjEzMTEwMC0zNzdkLTExZTctYTdmZS1mN2JjZTJlNDIyM2EiLCJzY29wZXMiOltdfQ.qiA48iJtZzLtIzLVMzp57Ac8g-ZJd0uGpL4fiShVSbVwRnVn2c6oVqdIR599gRuuMLjqRi6RIDcOSh_8lBwCP-8uSOmjsU-IHaPdUnXdfXKmA8CMWdWroPBVsgY4kF0sCRpY6X_lvrJ1YOufaPTzmKiEli6fgYTGxxLuUWG4X4ReG3bJc5CbCIAUQnp38pke_IHcLwJ1RFVIKSUIdM3bwBR1iNd1TcnfVTW7p1TCXKy44xAuARL_htHGIwYbBQcS3mHMGGKdIW3l0Ou2pXjMbJUFRVIYioOteMerP-51GWDhzuQkZjKMneDd4mDqg8-ZnvGkmMC6CJ_HHcfO97Ct9R2E1Y3smEdnaOP9FHklj4nY33Si2BJVYWYASBgS2igIQdQ9GitE4FxFtVRSsrpQ4YFTtx4xtiAxBpJOv-9t-ixRFZBC22jyJVuU93MNf1iLIkWG5vtKeW7o7gAsnpHxTVqLCEYvfVan5aHg_ks-nGU-N5GgCOUR4bD6LGOpVEseOJL6f7r53ONP9-Fa4O9n0E2ZCq3oqhm9Vkl6pRegimsPa7O5HIadVYeiXZlqhyKVeMDGY10A4hr5njh8QyI3J-mBZdaUU55jVUh04ojcrTrSYu-Kj7-M2g0EsQRhNtigfRx3OegUmmvUXSG1iQ-XnOpovEUOYFU53kxfCTeThqc\
Content-Type:application/json' -d '
{
"extension":{
    "extension":"100",
    "password":"100"
}
}'

Get user information

Get own user information

Request example

curl -kX GET https://enli01.tk:444/user  -H 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IjIzZTZhZGExM2FhYzM2YTVkNmQxZWM1MDY5YTM3MGYxOGU3MzdjMDhmOGFmN2FiMzI5MGI0N2I2NGI1YzU4Mjg2MTMxNWUyMTNiNzcwMTBmIn0.eyJhdWQiOiIyIiwianRpIjoiMjNlNmFkYTEzYWFjMzZhNWQ2ZDFlYzUwNjlhMzcwZjE4ZTczN2MwOGY4YWY3YWIzMjkwYjQ3YjY0YjVjNTgyODYxMzE1ZTIxM2I3NzAxMGYiLCJpYXQiOjE0OTQ2Mzk3MTcsIm5iZiI6MTQ5NDYzOTcxNywiZXhwIjoxNDk0NjQwMzE3LCJzdWIiOiI1MjEzMTEwMC0zNzdkLTExZTctYTdmZS1mN2JjZTJlNDIyM2EiLCJzY29wZXMiOltdfQ.qiA48iJtZzLtIzLVMzp57Ac8g-ZJd0uGpL4fiShVSbVwRnVn2c6oVqdIR599gRuuMLjqRi6RIDcOSh_8lBwCP-8uSOmjsU-IHaPdUnXdfXKmA8CMWdWroPBVsgY4kF0sCRpY6X_lvrJ1YOufaPTzmKiEli6fgYTGxxLuUWG4X4ReG3bJc5CbCIAUQnp38pke_IHcLwJ1RFVIKSUIdM3bwBR1iNd1TcnfVTW7p1TCXKy44xAuARL_htHGIwYbBQcS3mHMGGKdIW3l0Ou2pXjMbJUFRVIYioOteMerP-51GWDhzuQkZjKMneDd4mDqg8-ZnvGkmMC6CJ_HHcfO97Ct9R2E1Y3smEdnaOP9FHklj4nY33Si2BJVYWYASBgS2igIQdQ9GitE4FxFtVRSsrpQ4YFTtx4xtiAxBpJOv-9t-ixRFZBC22jyJVuU93MNf1iLIkWG5vtKeW7o7gAsnpHxTVqLCEYvfVan5aHg_ks-nGU-N5GgCOUR4bD6LGOpVEseOJL6f7r53ONP9-Fa4O9n0E2ZCq3oqhm9Vkl6pRegimsPa7O5HIadVYeiXZlqhyKVeMDGY10A4hr5njh8QyI3J-mBZdaUU55jVUh04ojcrTrSYu-Kj7-M2g0EsQRhNtigfRx3OegUmmvUXSG1iQ-XnOpovEUOYFU53kxfCTeThqc'

Response example

{
  "user_uuid": "7814bee0-3bc5-11e7-8cae-67fa506d780a",
  "domain_uuid": "781418b0-3bc5-11e7-a637-3764c614dfb6",
  "username": "gruzua",
  "contact_uuid": "78146650-3bc5-11e7-b828-415a12fe2824",
  "user_status": null,
  "api_key": null,
  "user_enabled": "true",
  "add_user": "admin",
  "add_date": "2017-05-18 12:28:16"
}

Get another user information

Route is /user/{id}

curl -kX GET https://192.168.0.100:444/user/3148615c-0094-4722-a0e4-38f2c32be02a  -H 'Authorization: Bearer ACCESS_TOKEN'

Response example

{
  "user_uuid": "3148615c-0094-4722-a0e4-38f2c32be02a",
  "domain_uuid": "49f095be-e6ae-4978-97be-17ca4bd638b9",
  "username": "gruzua2",
  "contact_uuid": "047eff79-7da9-4a3f-891b-eca0f6fd3b4a",
  "user_status": null,
  "api_key": null,
  "user_enabled": "true",
  "add_user": "admin",
  "add_date": "2017-05-30 20:46:03.78984-04"
}

Use includes to get additional information

curl -kX GET https://192.168.0.100:444/user/3148615c-0094-4722-a0e4-38f2c32be02a?includes[]=extensions  -H 'Authorization: Bearer ACCESS_TOKEN'

Response example

{
  "user_uuid": "3148615c-0094-4722-a0e4-38f2c32be02a",
  "domain_uuid": "49f095be-e6ae-4978-97be-17ca4bd638b9",
  "username": "gruzua2",
  "contact_uuid": "047eff79-7da9-4a3f-891b-eca0f6fd3b4a",
  "user_status": null,
  "api_key": null,
  "user_enabled": "true",
  "add_user": "admin",
  "add_date": "2017-05-30 20:46:03.78984-04",
  "extensions": [
    {
      "extension_uuid": "6de6d910-3762-11e7-8e66-cfaf2e642b15",
      "domain_uuid": "49f095be-e6ae-4978-97be-17ca4bd638b9",
      "extension": "101",
      "number_alias": "",
      "accountcode": "test01.enli.phone",
      "effective_caller_id_name": "",
      "effective_caller_id_number": "",
      "outbound_caller_id_name": "",
      "outbound_caller_id_number": "",
      "emergency_caller_id_name": "",
      "emergency_caller_id_number": "",
      "directory_full_name": "",
      "directory_visible": "true",
      "directory_exten_visible": "true",
      "limit_max": "5",
      "limit_destination": "error/user_busy",
      "missed_call_app": "",
      "missed_call_data": "",
      "user_context": "test01.enli.phone",
      "toll_allow": "",
      "call_timeout": "30",
      "call_group": "",
      "call_screen_enabled": "false",
      "user_record": "",
      "hold_music": "local_stream://default",
      "auth_acl": "",
      "cidr": "",
      "sip_force_contact": "",
      "nibble_account": null,
      "sip_force_expires": null,
      "mwi_account": "",
      "sip_bypass_media": "",
      "unique_id": null,
      "dial_string": "",
      "dial_user": null,
      "dial_domain": null,
      "do_not_disturb": null,
      "forward_all_destination": null,
      "forward_all_enabled": null,
      "forward_busy_destination": null,
      "forward_busy_enabled": null,
      "forward_no_answer_destination": null,
      "forward_no_answer_enabled": null,
      "forward_user_not_registered_destination": null,
      "forward_user_not_registered_enabled": null,
      "follow_me_uuid": null,
      "enabled": "true",
      "description": "",
      "forward_caller_id_uuid": null,
      "absolute_codec_string": "",
      "force_ping": "",
      "pivot": {
        "user_uuid": "3148615c-0094-4722-a0e4-38f2c32be02a",
        "extension_uuid": "6de6d910-3762-11e7-8e66-cfaf2e642b15"
      }
    }
  ]
}

Get user list

Request example

curl -kX GET https://enli01.tk:444/users  -H 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IjIzZTZhZGExM2FhYzM2YTVkNmQxZWM1MDY5YTM3MGYxOGU3MzdjMDhmOGFmN2FiMzI5MGI0N2I2NGI1YzU4Mjg2MTMxNWUyMTNiNzcwMTBmIn0.eyJhdWQiOiIyIiwianRpIjoiMjNlNmFkYTEzYWFjMzZhNWQ2ZDFlYzUwNjlhMzcwZjE4ZTczN2MwOGY4YWY3YWIzMjkwYjQ3YjY0YjVjNTgyODYxMzE1ZTIxM2I3NzAxMGYiLCJpYXQiOjE0OTQ2Mzk3MTcsIm5iZiI6MTQ5NDYzOTcxNywiZXhwIjoxNDk0NjQwMzE3LCJzdWIiOiI1MjEzMTEwMC0zNzdkLTExZTctYTdmZS1mN2JjZTJlNDIyM2EiLCJzY29wZXMiOltdfQ.qiA48iJtZzLtIzLVMzp57Ac8g-ZJd0uGpL4fiShVSbVwRnVn2c6oVqdIR599gRuuMLjqRi6RIDcOSh_8lBwCP-8uSOmjsU-IHaPdUnXdfXKmA8CMWdWroPBVsgY4kF0sCRpY6X_lvrJ1YOufaPTzmKiEli6fgYTGxxLuUWG4X4ReG3bJc5CbCIAUQnp38pke_IHcLwJ1RFVIKSUIdM3bwBR1iNd1TcnfVTW7p1TCXKy44xAuARL_htHGIwYbBQcS3mHMGGKdIW3l0Ou2pXjMbJUFRVIYioOteMerP-51GWDhzuQkZjKMneDd4mDqg8-ZnvGkmMC6CJ_HHcfO97Ct9R2E1Y3smEdnaOP9FHklj4nY33Si2BJVYWYASBgS2igIQdQ9GitE4FxFtVRSsrpQ4YFTtx4xtiAxBpJOv-9t-ixRFZBC22jyJVuU93MNf1iLIkWG5vtKeW7o7gAsnpHxTVqLCEYvfVan5aHg_ks-nGU-N5GgCOUR4bD6LGOpVEseOJL6f7r53ONP9-Fa4O9n0E2ZCq3oqhm9Vkl6pRegimsPa7O5HIadVYeiXZlqhyKVeMDGY10A4hr5njh8QyI3J-mBZdaUU55jVUh04ojcrTrSYu-Kj7-M2g0EsQRhNtigfRx3OegUmmvUXSG1iQ-XnOpovEUOYFU53kxfCTeThqc'

Response example

{
  "users": [
    {
      "user_uuid": "709e8774-7889-433f-914d-2ed90683a335",
      "domain_uuid": "4249fbe0-3778-11e7-848f-f1767b017124",
      "username": "testuser",
      "contact_uuid": "871acba3-0909-4f13-820b-56613832ddcd",
      "user_status": null,
      "api_key": null,
      "user_enabled": "true",
      "add_user": "admin",
      "add_date": "2017-05-16 10:58:31.965474-04"
    },
    {
      "user_uuid": "44f5bd50-3778-11e7-8fec-75ee0510eff4",
      "domain_uuid": "4249fbe0-3778-11e7-848f-f1767b017124",
      "username": "gruzua",
      "contact_uuid": "44f48020-3778-11e7-a706-6f9c38124ddd",
      "user_status": null,
      "api_key": null,
      "user_enabled": "true",
      "add_user": "admin",
      "add_date": "2017-05-13 01:05:35"
    }
  ]
}

Request additional information

To request additional information to corresponding request you may add include to the url.

E.g. if you add ?includes[]=domain&includes[]=groups to a request to get user list like this

curl -kX GET https://enli01.tk:444/users?includes[]=domain&includes[]=groups -H 'Authorization: Bearer ACCESS_TOKEN'

you'd get a response including additional information on domain and groups the user belongs to

{
  "users": [
    {
      "user_uuid": "709e8774-7889-433f-914d-2ed90683a335",
      "domain_uuid": "4249fbe0-3778-11e7-848f-f1767b017124",
      "username": "testuser",
      "contact_uuid": "871acba3-0909-4f13-820b-56613832ddcd",
      "user_status": null,
      "api_key": null,
      "user_enabled": "true",
      "add_user": "admin",
      "add_date": "2017-05-16 10:58:31.965474-04",
      "domain": {
        "domain_uuid": "4249fbe0-3778-11e7-848f-f1767b017124",
        "domain_parent_uuid": null,
        "domain_name": "test04.enli.phone",
        "domain_enabled": "true",
        "domain_description": "Created via api at 2017-05-13 01:05:30"
      },
      "groups": [
        {
          "group_uuid": "3a873181-0da3-45a0-8259-e591aa06647f",
          "domain_uuid": null,
          "group_name": "user",
          "group_protected": "false",
          "group_description": "User Group",
          "pivot": {
            "user_uuid": "709e8774-7889-433f-914d-2ed90683a335",
            "group_uuid": "3a873181-0da3-45a0-8259-e591aa06647f"
          }
        }
      ]
    },
    {
      "user_uuid": "44f5bd50-3778-11e7-8fec-75ee0510eff4",
      "domain_uuid": "4249fbe0-3778-11e7-848f-f1767b017124",
      "username": "gruzua",
      "contact_uuid": "44f48020-3778-11e7-a706-6f9c38124ddd",
      "user_status": null,
      "api_key": null,
      "user_enabled": "true",
      "add_user": "admin",
      "add_date": "2017-05-13 01:05:35",
      "domain": {
        "domain_uuid": "4249fbe0-3778-11e7-848f-f1767b017124",
        "domain_parent_uuid": null,
        "domain_name": "test04.enli.phone",
        "domain_enabled": "true",
        "domain_description": "Created via api at 2017-05-13 01:05:30"
      },
      "groups": [
        {
          "group_uuid": "b504fabe-5782-4b62-89bd-f33f1d78449a",
          "domain_uuid": null,
          "group_name": "admin",
          "group_protected": "false",
          "group_description": "Administrator Group",
          "pivot": {
            "user_uuid": "44f5bd50-3778-11e7-8fec-75ee0510eff4",
            "group_uuid": "b504fabe-5782-4b62-89bd-f33f1d78449a"
          }
        }
      ]
    }
  ]
}

Available includes

Route Available includes
/user
/users
/user/{id}
groups,domain,extensions

Add device token for apple VOIP push

Example

curl -kX POST https://enli01.tk:444/pushtoken  -H 'Authorization: Bearer ACCESS_TOKEN\
Content-Type:application/json' -d '
{
	"token_type":"sandbox",
	"token":"2ea77fe9f d1d79841 edd2daff 66d1165e c3c06aab 2762ab4e f4667bb9 bdbe983a",
	"token_class":"voip"
}'

Response

New token created

{
  "token_type": "sandbox",
  "token": "ea77fe9f d1d79841 edd2daff 66d1165e c3c06aab 2762ab4e f4667bb9 bdbe983a1",
  "token_class": "voip ",
  "user_uuid": "2a3ae170-46b1-11e7-852c-d569e5662d4a",
  "pushtoken_uuid": "f9219b50-5608-11e7-b1ae-5dd7ffd0ec7a",
  "updated_at": "2017-06-20 22:36:59",
  "created_at": "2017-06-20 22:36:59"
}

The token exists (not created)

{
  "pushtoken_uuid": "e45d56a0-5546-11e7-8267-f5e6029cd9d9",
  "user_uuid": "2a3ae170-46b1-11e7-852c-d569e5662d4a",
  "token_type": "sandbox",
  "token": "ea77fe9f d1d79841 edd2daff 66d1165e c3c06aab 2762ab4e f4667bb9 bdbe983a",
  "token_class": "voip ",
  "created_at": "2017-06-19 23:27:42",
  "updated_at": "2017-06-19 23:27:42",
  "message": "Already exists. Nothing to be done"
}

Possible values

Parameter name Values
token_type sandbox, production
token_class voip, text

Set and get application status

Example

curl -kX POST https://enli01.tk:444/status  -H 'Authorization: Bearer ACCESS_TOKEN\
Content-Type:application/json' -d '
{
    "status_lifetime":"100 ",
    "os":"ios",
    "user_status":"busy",
    "services":[
        "voip ",
        "chat"
    ]
}'

Response

Response returns other users within the domain.

E.g. there is one user with status online and available chat and voip services.

{
    "status_uuid": "274c3940-4cce-11eb-ad5e-77a099339533",
    "user_uuid": "0972e380-4cc7-11eb-8357-457b61fdac2e",
    "domain_uuid": "d9f81240-47f7-11eb-90c9-8b25422b0f28",
    "status_lifetime": "100 ",
    "os": "ios",
    "user_status": "online",
    "services": "[\"chat\",\"voip \"]",
    "created_at": "2021-01-02T07:43:07.000000Z",
    "updated_at": "2021-01-02T07:49:45.000000Z"
}

If there are several applications online for one user, then the closest to the online status is selected. E.g. if at one device the user is busy and at another is online - online status is returned.

Services are concatenated, so all available services are returned. If at one device a user has chat and at another has voip service enables, then both ones are returns.

Check api.php for available parameters.