Multiple Operators can be associated with an EVRYTHNG Platform account. Through use of the Roles API each can be given the appropriate permissions and levels of scope necessary for their role in the application.

From each Operator's perspective, they each have a unique access to each account they are associated with, and are granted an Operator API Key for each.


API Status
General Availability:
/accounts
/accounts/:accountId
/accounts/:accountId/shortDomains
/accounts/:accountId/domains


AccountDocument Data Model

.name (string)
    Friendly name of this resource. Must be between 1 and 30
    characters.

.id (string, read-only)
    The ID of this resource.

.createdAt (integer, read-only)
    Timestamp when the resource was created.

.updatedAt (integer, read-only)
    Timestamp when the resource was updated.

.customFields (object)
    Object of case-sensititve key-value pairs of custom fields
    associated with the resource.

.imageUrl (string)
    The account Dashboard logo.

.tfaRequired (boolean, read-only)
    Whether two-factor authentication is required for this
    account.

.defaultUrl (string)
    Invalid GS1 scans will redirect to this URL.
    
.configuration (object)
	Object containing account related configuration.
{
  "type": "object",
  "description": "An object representing a Platform account.",
  "properties": {
    "name": {
      "type": "string",
      "description": "Friendly name of this resource. Must be between 1 and 30 characters.",
      "minLength": 1,
      "maxLength": 30
    },
    "id": {
      "type": "string",
      "description": "The ID of this resource.",
      "pattern": "^[abcdefghkmnpqrstwxyABCDEFGHKMNPQRSTUVWXY0123456789]{24}$",
      "readOnly": true
    },
    "createdAt": {
      "type": "integer",
      "description": "Timestamp when the resource was created.",
      "readOnly": true,
      "minimum": 0
    },
    "updatedAt": {
      "type": "integer",
      "description": "Timestamp when the resource was updated.",
      "readOnly": true,
      "minimum": 0
    },
    "customFields": {
      "type": "object",
      "description": "Object of case-sensititve key-value pairs of custom fields associated with the resource."
    },
    "imageUrl": {
      "type": "string",
      "description": "The account Dashboard logo."
    },
    "tfaRequired": {
      "type": "boolean",
      "description": "Whether two-factor authentication is required for this account.",
      "readOnly": true
    },
    "defaultUrl": {
      "type": "string",
      "description": "Invalid GS1 scans will redirect to this URL."
    },
    "configuration": {
      "type": "object",
      "description": "Object containing account related configuration."
    }  
  },
  "x-filterable-fields": [ "name" ]
}
{
  "id": "UhpHrg39QCy9dsSddN8xhwnb",
  "createdAt": 1471862431010,
  "customFields": {
    "region": "en-gb"
  },
  "updatedAt": 1510593794364,
  "name": "Example Account",
  "imageUrl": "https://avatars1.githubusercontent.com/u/5732010?v=4&s=460",
  "tfaRequired": true,
  "defaultUrl": "https://developers.evrythng.com",
  "configuration": {
    "uniqueIdentifiers": {
      "products": [
        "gs1:01",
        "gs1:22"
      ]
    }
  }
}

Filterable Fields

This resource type can be filtered using the following fields and operators.

FieldTypeOperators
nameString=

AccountConfiguration Data Model

.uniqueIdentifiers (object)
	Object containing lists of identifier keys which meant
    to be unique for a particular entity.
{
  "type": "object",
  "description": "Object containing lists of identifier keys which meant to be unique for a particular entity",
  "properties": {
    "products": {
      "type": "array",
      "description": "array of identifier keys meant to be unique for product entity. Identifiers used in product \"identifiers\" field will be concatenated in the order specified in the \"products\" array and used as unique identifier for a given product which means that user will not be able to create two products with the same unique identifiers."
    }
  }
}
"uniqueIdentifiers": {
  "products": [
    "gs1:01",
    "gs1:22"
  ]
}

AccessDocument Data Model

The AccessDocument contains role and authentication information for an account.

.account (string, read-only)
    The account ID.

.apiKey (string, read-only)
    The account's Operator API key.

.id (string, read-only)
    The ID of this resource.

.operator (string, read-only)
    The account's user ID.

.role (string)
    The ID of the currently assigned role.
{
  "type": "object",
  "description": "An object representing an account's access record.",
  "properties": {
    "account": {
      "type": "string",
      "description": "The account ID.",
      "readOnly": true,
      "pattern": "^[abcdefghkmnpqrstwxyABCDEFGHKMNPQRSTUVWXY0123456789]{24}$"
    },
    "apiKey": {
      "type": "string",
      "description": "The account's Operator API key.",
      "readOnly": true,
      "pattern": "^[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789]{80}$"
    },
    "id": {
      "type": "string",
      "description": "The ID of this resource.",
      "pattern": "^[abcdefghkmnpqrstwxyABCDEFGHKMNPQRSTUVWXY0123456789]{24}$",
      "readOnly": true
    },
    "operator": {
      "type": "string",
      "description": "The account's user ID.",
      "readOnly": true,
      "pattern": "^[abcdefghkmnpqrstwxyABCDEFGHKMNPQRSTUVWXY0123456789]{24}$"
    },
    "role": {
      "type": "string",
      "description": "The ID of the currently assigned role.",
      "minLength": 4,
      "maxLength": 24
    }
  }
}
{
  "id": "57bad69fc18104025b292da8",
  "account": "UhpHrg39QCy9dsSddN8xhwnb",
  "operator": "UEp4rDGsnpCAF6xABbys5Amc",
  "apiKey": "AGiWrH5OteA4aHiMFiwnwF08p3PQvPIr9GJX...",
  "role": "admin"
}

Read All Accounts

Read an array of all accounts visible to an Operator with their API key.

GET /accounts
Authorization: $OPERATOR_API_KEY
curl -H "Authorization: $OPERATOR_API_KEY" \
  -X GET 'https://api.evrythng.com/accounts'
operator.sharedAccount().read()
  .then(console.log);
HTTP/1.1 200 OK
Content-Type: application/json

[
  {
    "id": "UhpHrg39QCy38dht93kiuwnb",
    "createdAt": 1471862430889,
    "customFields": {},
    "updatedAt": 1471862431010,
    "name": "Main Account",
    "tfaRequired": false
  }
]

Read an Account

Read an account by its ID by sending a GET request to the /accounts/:accountId endpoint.

GET /accounts/:accountId
Content-Type: application/json
Authorization: $OPERATOR_API_KEY
curl -H "Authorization: $OPERATOR_API_KEY" \
  -X GET 'https://api.evrythng.com/accounts/UhpHrg39QCy9dsSddN8xhwnb'
const accountId = 'UhpHrg39QCy9dsSddN8xhwnb';

operator.sharedAccount(acccountId).read()
  .then(console.log)
HTTP/1.1 200 Ok
Content-Type: application/json

{
  "id": "UhpHrg39QCy9dsSddN8xhwnb",
  "createdAt": 1471862430889,
  "customFields": {},
  "updatedAt": 1471862431010,
  "name": "Main Account",
  "tfaRequired": false,
  "configuration": {
    "uniqueIdentifiers": {
      "products": [
        "gs1:01",
        "gs1:22"
      ]
    }
  }
}

Update an Account

Update an account with new user information or custom fields by sending an AccountDocument with only the fields to be updated. For example, the name, or imageUrl which will be displayed in the Dashboard.

PUT /accounts/:accountId
Content-Type: application/json
Authorization: $OPERATOR_API_KEY

AccountDocument (subset)
curl -i -H "Content-Type: application/json" \
  -H "Authorization: $OPERATOR_API_KEY" \
  -X PUT 'https://api.evrythng.com/accounts/UhpHrg39QCy38dht93kiuwnb'
  -d '{ 
    "imageUrl": "https://example.com/image.png",
    "configuration": {
      "uniqueIdentifiers": {
        "products": [
          "gs1:01",
          "gs1:22"
        ]
      }
    }
  }'
const accountId = 'UhpHrg39QCy38dht93kiuwnb';
const payload = { 
  imageUrl: 'https://example.com/image.png',
  configuration: {
    uniqueIdentifiers: {
      products: [
        "gs1:01",
        "gs1:22"
      ]
    }
  }
};

operator.sharedAccount(accountId).update(payload)
  .then(console.log);
HTTP/1.1 200 OK
Content-Type: application/json

{
  "id": "UhpHrg39QCy38dht93kiuwnb",
  "createdAt": 1471862430889,
  "customFields": {},
  "updatedAt": 1471862431010,
  "name": "Updated Account Name",
  "imageUrl": "https://example.com/image.png",
  "tfaRequired": false,
  "configuration": {
    "uniqueIdentifiers": {
      "products": [
        "gs1:01",
        "gs1:22"
      ]
    }
  }
}

Read Account Accesses

Read all available accesses to an account. This translates to the list of Operators who are listed as team members.

GET /accounts/:accountId/accesses
Authorization: $OPERATOR_API_KEY
curl -H "Authorization: $OPERATOR_API_KEY" \
  -X GET 'https://api.evrythng.com/accounts/UhpHrg39QCy9dsSddN8xhwnb/accesses'
const accountId = 'UGYYcfmsCy9nQtRwwYcgnfKb';

operator.sharedAccount(accountId).access()
  .read()
  .then(console.log);
HTTP/1.1 200 OK
Content-Type: application/json

[
  {
    "id": "57bad69fc18104025b292da8",
    "account": "UhpHrg39QCy9dsSddN8xhwnb",
    "operator": "UEp4rDGsnpCAF6xABbys5Amc",
    "apiKey": "AGiWrH5OteA4aHiM...",
    "role": "admin"
  },
  {
    "id": "58c01cd3f0c7822c00373c5f",
    "account": "UhpHrg39QCy9dsSddN8xhwnb",
    "operator": "UgsmFRw7yQV8GPgKBKTbWhhb",
    "apiKey": "6C2zBd8aKr5HJexd...",
    "role": "admin"
  }
]

Read an Account Access

Read a single account access by ID.

GET /accounts/:accountId/accesses/:accessId
Authorization: $OPERATOR_API_KEY
curl -H "Authorization: $OPERATOR_API_KEY" \
  -X GET 'https://api.evrythng.com/accounts/UhpHrg39QCy9dsSddN8xhwnb/accesses/57bad69fc18104025b292da8'
const accountId = 'UGYYcfmsCy9nQtRwwYcgnfKb';
const accessId = '57bad69fc18104025b292da8';

operator.sharedAccount(accountId).access(accessId)
  .read()
  .then(console.log);
HTTP/1.1 200 OK
Content-Type: application/json

{
  "id": "57bad69fc18104025b292da8",
  "account": "UhpHrg39QCy9dsSddN8xhwnb",
  "operator": "UEp4rDGsnpCAF6xABbys5Amc",
  "apiKey": "AGiWrH5OteA4aHiM...",
  "role": "admin"
}

Read all Short Domains

Read all short domains available to an account.

GET /accounts/:accountId/shortDomains
Authorization: $OPERATOR_API_KEY
curl -H "Authorization: $OPERATOR_API_KEY" \
  -X GET 'https://api.evrythng.com/accounts/UhpHrg39QCy9dsSddN8xhwnb/shortDomains'
const accountId = 'UGYYcfmsCy9nQtRwwYcgnfKb';

operator.sharedAccount(accountId).shortDomain()
  .read()
  .then(console.log);
HTTP/1.1 200 OK
Content-Type: application/json

[
  "tn.gg"
]

DomainDocument Data Model

.createdAt (integer, read-only)
    Timestamp when the resource was created.

.updatedAt (integer, read-only)
    Timestamp when the resource was updated.

.id (string, read-only)
    The ID of this resource.

.accountId (string)
    The account this domain belongs to.

.domain (string)
    The domain URL.
{
  "type": "object",
  "description": "A single account domain entry.",
  "properties": {
    "createdAt": {
      "type": "integer",
      "description": "Timestamp when the resource was created.",
      "readOnly": true,
      "minimum": 0
    },
    "updatedAt": {
      "type": "integer",
      "description": "Timestamp when the resource was updated.",
      "readOnly": true,
      "minimum": 0
    },
    "id": {
      "type": "string",
      "description": "The ID of this resource.",
      "pattern": "^[abcdefghkmnpqrstwxyABCDEFGHKMNPQRSTUVWXY0123456789]{24}$",
      "readOnly": true
    },
    "accountId": {
      "type": "string",
      "description": "The account this domain belongs to.",
      "pattern": "^[abcdefghkmnpqrstwxyABCDEFGHKMNPQRSTUVWXY0123456789]{24}$"
    },
    "domain": {
      "type": "string",
      "description": "The domain URL."
    }
  }
}
{
  "createdAt": 1519385011833,
  "updatedAt": 1519385011833,
  "id": "5a8ff9b3a1b3f60013492de7",
  "accountId": "UnFQtmpUMtQBY8wRaEystb5h",
  "domain": "ratqa.tn.gg"
}

Read all Domains

GET /accounts/:accountId/domains
Authorization: $OPERATOR_API_KEY
curl -H "Authorization: $OPERATOR_API_KEY" \
  -X GET 'https://api.evrythng.com/accounts/UnFQtmpUMtQBY8wRaEystb5h/domains'
const accountId = 'UGYYcfmsCy9nQtRwwYcgnfKb';

operator.sharedAccount(accountId).domain()
  .read()
  .then(console.log);
HTTP/1.1 200 OK
Content-Type: application/json

[
  {
    "createdAt": 1519385011833,
    "updatedAt": 1519385011833,
    "id": "5a8ff9b3a1b3f60013492de7",
    "accountId": "UnFQtmpUMtQBY8wRaEystb5h",
    "domain": "ratqa.tn.gg"
  }
]