Query Companies
List of paths to query for all companies across an application.
Note: /v1.0/admin
path requires a client_credential
grant access token.
Methods & Paths
Method | URI | Name | Summary |
---|---|---|---|
GET | /v1.0/admin/companies | Company | Retrieve all companies for current application |
GET | /v1.0/admin/companies/{company_id} | Company List | Retrieve a company |
GET | /v1.0/admin/companies/count | Company Count | Count all companies for current application |
POST | /v1.0/admin/companies | Company Create | Create a company in the current application |
PUT | /v1.0/admin/companies/{company_id} | Company Update | Update a company from the current application |
DELETE | /v1.0/admin/companies/{company_id} | Company Delete | Delete a company from the current application |
Query Parameters
Name | Source | Type |
---|---|---|
application_id | query | string |
limit | query | number |
page | query | number |
user_id | query | string |
external_id | query | string |
Responses
Code | Status | Description | Has headers | Schema |
---|---|---|---|---|
200 | OK | Successful company retrieval | schema | |
400 | Bad Request | Bad request sent to server | schema | |
401 | Unauthorized | You are unauthorized | schema | |
403 | Forbidden | You are forbidden to perform this action | schema |
Company Model
Name | Type | Required | Example |
---|---|---|---|
address | string | ✓ | 3900 W Alameda Ave |
application_id | string | uuid | |
city | string | ✓ | Burbank |
country | string | ✓ | USA |
created_at | date (formatted string) | 1970-01-01T00:00:00.000Z | |
id | number | 1 | |
industry | string | ✓ | [\"IoT\"] |
latitude | number | 34.1526642 | |
longitude | number | -118.3428161 | |
name | string | ✓ | My Company |
state | string | CA | |
status | number | 0 | |
timezone | string | America/Los_Angeles | |
updated_at | date (formatted string) | 1970-01-01T00:00:00.000Z | |
user_id | string | uuid | |
zip | string | ✓ | 91505 |
List Companies
Request Example
curl --request GET --url https://api.mydevices.com/v1.0/admin/companies \
--header 'authorization: Bearer YourAuthToken' \
--header 'content-type: application/json'
Example Response:
{
"count": 3,
"limit": 100,
"page": 0,
"rows": [
{
"id": 881,
"name": "neosmart",
"industry": "[\"Food & Beverage\"]",
"address": "1 Rocket Rd",
"city": "Hawthorne",
"state": "CA",
"zip": "90250",
"country": "United States",
"latitude": 33.9206814,
"longitude": -118.3280263,
"timezone": "America/Los_Angeles",
"user_id": "f8ef7b38-daf7-45a2-a0b2-1d8f1a0e5455",
"application_id": "neosmart",
"status": 0,
"created_at": "2019-04-26T18:16:12.000Z",
"updated_at": "2019-04-26T18:16:12.000Z"
},
{
"id": 882,
"name": "Safeway",
"industry": "[\"Food & Beverage\"]",
"address": "3333 Arapahoe Rd",
"city": "Erie",
"state": "CO",
"zip": "80516",
"country": "United States",
"latitude": 40.0169468,
"longitude": -105.1008409,
"timezone": "America/Denver",
"user_id": "829c4031-f93a-42bb-859b-aa7135482c00",
"application_id": "neosmart",
"status": 0,
"created_at": "2019-04-26T18:28:36.000Z",
"updated_at": "2019-04-26T18:28:36.000Z"
},
{
"id": 884,
"name": "NeoSmart",
"industry": "[\"Food & Beverage\"]",
"address": "200 I St NE",
"city": "Miami",
"state": "OK",
"zip": "74354",
"country": "United States",
"latitude": 36.8795784,
"longitude": -94.8674195,
"timezone": "America/Chicago",
"user_id": "8284bd9b-f00a-4689-b5ed-aed736c5716c",
"application_id": "neosmart",
"status": 0,
"created_at": "2019-04-26T18:37:12.000Z",
"updated_at": "2019-04-26T18:37:12.000Z"
}
]
}
Create Company
Example Create Request
curl --request POST \
--url https://api.mydevices.com/v1.0/admin/companies \
--header 'authorization: Bearer YourAuthToken' \
--header 'Content-Type: application/json' \
--data \
'{
"user_id": "0dfb9c58-5a0b-40eb-9e8c-36c0b1ff883b",
"name": "CreatedCompanyAsAdmin04",
"address": "3900 W Alameda Ave",
"city": "Burbank",
"state": "CA",
"zip": "91505",
"country": "USA",
"external_id": "myid"
}'
Example Response:
{
"locations": [],
"created_at": {
"fn": "NOW",
"args": []
},
"updated_at": {
"fn": "NOW",
"args": []
},
"id": 468,
"user_id": "0dfb9c58-5a0b-40eb-9e8c-36c0b1ff883b",
"name": "CreatedCompanyAsAdmin04",
"address": "3900 W Alameda Ave",
"city": "Burbank",
"state": "CA",
"zip": "91505",
"country": "USA",
"external_id": "myid",
"latitude": 34.1526642,
"longitude": -118.3428161,
"timezone": "America/Los_Angeles",
"status": 0,
"application_id": "iotinabox",
"updatedAt": "2022-01-06T20:20:52.941Z",
"createdAt": "2022-01-06T20:20:52.941Z",
"primary_users": [],
"authorization": "admin"
}
Update Company
Example Request:
curl --request PUT \
--url https://api.mydevices.com/v1.0/admin/companies/468 \
--header 'Authorization: Bearer YourAuthToken' \
--header 'Content-Type: application/json' \
--data \
'{
"user_id": "0dfb9c58-5a0b-40eb-9e8c-36c0b1ff883b",
"name": "UpdatedCompanyAsAdmin05"
}'
Example Response:
{
"id": 468,
"name": "UpdatedCompanyAsAdmin05",
"industry": null,
"address": "3900 W Alameda Ave",
"city": "Burbank",
"state": "CA",
"zip": "91505",
"country": "USA",
"latitude": 34.1526642,
"longitude": -118.3428161,
"timezone": "America/Los_Angeles",
"user_id": "0dfb9c58-5a0b-40eb-9e8c-36c0b1ff883b",
"application_id": "iotinabox",
"status": 0,
"created_at": "2022-01-06T20:28:29.000Z",
"updated_at": "2022-01-06T20:31:52.000Z",
"deleted_at": null,
"external_id": "myid",
"createdAt": "2022-01-06T20:28:29.000Z",
"updatedAt": "2022-01-06T20:31:52.000Z",
"primary_users": [],
"authorization": "admin",
"locations": []
}
Delete Company
Example Request:
curl --request DELETE \
--url https://api.mydevices.com/v1.0/admin/companies/468 \
--header 'Authorization: Bearer YourAuthToken' \
--header 'Content-Type: application/json'
Example Response:
{
"success": true
}
Query by External Id
Get Company by External Id
curl -- request GET \
-- url https://api.mydevices.com/v1.0/admin/companies?external_id=1234 \
-- header 'Authorization: Bearer YourAuthToken' \
-- header 'Content-Type: application/json'