DESKIE API
Companies
Create a company

POST  |  https://[domain].deskie.io/api/companies.json
Create a new company.
Parameters
Request

{
  "company" : {
    "company_name" : "New Company",
    "company_domains" : "company.com",
    "company_default_group" : 492,
    "company_address" : "Some address",
    "company_note" : "Some note",
    "company_users" : "1351,1348,1347"
  }
}
Response

{
  "company" : {
    "company_id" : 200,
    "company_name" : "New Company",
    "company_domains" : "company.com",
    "company_default_group" : 492,
    "company_address" : "Some address",
    "company_note" : "Some note",
    "active" : true,
    "deleted" : false,
    "created_at" : "Mon, 05 May 2014 00:15:17 +0300",
    "updated_at" : "Tue, 23 Dec 2014 10:55:23 +0200"
  }
}
Sample code

curl -u [staff_email]:[api_key] -H "Content-Type: application/json" -X POST -d '{ "company": {"company_name":"New Company","company_domains":"company.com","company_default_group":492,"company_address":"Some address","company_note":"Some note","сompany_users":"1351,1348,1347"}}' https://[domain].deskie.io/api/companies.json
Get a list of companies

GET  |  https://[domain].deskie.io/api/companies.json
Get a list of companies

If the "page" and "limit" parameters are not specified in the request, by default, the first 100 companies will be returned.
Parameters
Response

{
    "0": {
      "company" : {
        "company_id" : 200,
        "company_name" : "New Company",
        "company_domains" : "company.com",
        "company_default_group" : 492,
        "company_address" : "Some address",
        "company_note" : "Some note",
        "active" : true,
        "deleted" : false,
        "created_at" : "Mon, 05 May 2014 00:15:17 +0300",
        "updated_at" : "Tue, 23 Dec 2014 10:55:23 +0200",
        "amount_of_users" : 125
    },
    "1": {
      "company" : {
        "company_id" : 300,
        "company_name" : "New Company 2",
        "company_domains" : "company.com",
        "company_default_group" : 492,
        "company_address" : "Some address",
        "company_note" : "Some note",
        "active" : true,
        "deleted" : false,
        "created_at" : "Mon, 05 May 2014 00:15:17 +0300",
        "updated_at" : "Tue, 23 Dec 2014 10:55:23 +0200",
        "amount_of_users" : 125
    },
    "total_count":20
}
Sample code

curl -u [staff_email]:[api_key] -H "Content-Type: application/json" -X GET https://[domain].deskie.io/api/companies.json?limit=50&page=2&amount_of_users=true
View a company

GET  |  https://[domain].deskie.io/api/companies/[id].json
View data of a specific company.
Response

{
  "company" : {
    "company_id" : 200,
    "company_name" : "New Company",
    "company_domains" : "company.com",
    "company_default_group" : 492,
    "company_address" : "Some address",
    "company_note" : "Some note",
    "active" : true,
    "deleted" : false,
    "created_at" : "Mon, 05 May 2014 00:15:17 +0300",
    "updated_at" : "Tue, 23 Dec 2014 10:55:23 +0200"
  }
}
Sample code

curl -u [staff_email]:[api_key] -H "Content-Type: application/json" -X GET https://[domain].deskie.io/api/companies/200.json
Edit a company

PUT  |  https://[domain].deskie.io/api/companies/[id].json
Edit data of a specific company.
Parameters
Request

{
  "company" : {
    "company_name" : "Company's full name changed",
    "company_note" : "New note",
    "add_company_domains" : "newcompany.com",
    "remove_company_domains" : "company.com"
  }
}
Response

{
  "company" : {
    "company_id" : 200,
    "company_name" : "Company's full name changed",
    "company_domains" : "newcompany.com",
    "company_default_group" : 492,
    "company_address" : "Some address",
    "company_note" : "New note",
    "active" : true,
    "deleted" : false,
    "created_at" : "Mon, 05 May 2014 00:15:17 +0300",
    "updated_at" : "Tue, 23 Dec 2014 10:55:23 +0200"
  }
}
Sample code

curl -u [staff_email]:[api_key] -H "Content-Type: application/json" -X PUT -d '{ "company": {"company_name":"Company's full name changed","company_note":"New note","add_company_domains":"newcompany.com","remove_company_domains":"company.com"}}' https://[domain].deskie.io/api/companies/200.json
Delete a company

PUT  |  https://[domain].deskie.io/api/companies/[id]/disable.json
Delete a company. In this situation, the company is moved to the "Deleted" list and can be restored, if necessary.
Response

{
  "company" : {
    "company_id" : 200,
    "company_name" : "Company's full name changed",
    "company_domains" : "newcompany.com",
    "company_default_group" : 492,
    "company_address" : "Some address",
    "company_note" : "New note",
    "active" : true,
    "deleted" : true,
    "created_at" : "Mon, 05 May 2014 00:15:17 +0300",
    "updated_at" : "Tue, 23 Dec 2014 10:55:23 +0200"
  }
}
Sample code

curl -u [staff_email]:[api_key] -H "Content-Type: application/json" -X PUT -d '' https://[domain].deskie.io/api/companies/200/disable.json
Block a company

PUT  |  https://[domain].deskie.io/api/companies/[id]/block.json
Block a company.
Response

{
  "company" : {
    "company_id" : 200,
    "company_name" : "Company's full name changed",
    "company_domains" : "newcompany.com",
    "company_default_group" : 492,
    "company_address" : "Some address",
    "company_note" : "New note",
    "active" : false,
    "deleted" : false,
    "created_at" : "Mon, 05 May 2014 00:15:17 +0300",
    "updated_at" : "Tue, 23 Dec 2014 10:55:23 +0200"
  }
}
Sample code

curl -u [staff_email]:[api_key] -H "Content-Type: application/json" -X PUT -d '' https://[domain].deskie.io/api/companies/200/block.json
Restore a company

PUT  |  https://[domain].deskie.io/api/companies/[id]/restore.json
Unblock a company that has been blocked or restore a company that has been deleted.
Response

{
  "company" : {
    "company_id" : 200,
    "company_name" : "Company's full name changed",
    "company_domains" : "newcompany.com",
    "company_default_group" : 492,
    "company_address" : "Some address",
    "company_note" : "New note",
    "active" : true,
    "deleted" : false,
    "created_at" : "Mon, 05 May 2014 00:15:17 +0300",
    "updated_at" : "Tue, 23 Dec 2014 10:55:23 +0200"
  }
}
Sample code

curl -u [staff_email]:[api_key] -H "Content-Type: application/json" -X PUT -d '' https://[domain].deskie.io/api/companies/200/restore.json
Delete permanently a company

DELETE  |  https://[domain].deskie.io/api/companies/[id].json
Delete permanently a company. Available only to the agents with a full access level.
Response

HTTP Status: 200 OK
Sample code

curl -u [staff_email]:[api_key] -H "Content-Type: application/json" -X DELETE https://[domain].deskie.io/api/companies/200.json