Identity

Overview

The identity interface associates identifiers used in external IT systems and devices with unique identifiers used in Cumulocity IoT. It consists of three parts:

Note that for all PUT/POST requests accept header should be provided, otherwise an empty response body will be returned.

Identity API

Identity [application/vnd.com.nsn.cumulocity.identityApi+json]

Name Type Occurs Description
self string 1 A URL linking to this resource.
externalId ExternalID URI template 1 Single external ID, represented by type of the external ID and the value of the external ID, both as strings (placeholders {type} and {value}).
externalIdsOfGlobalId ExternalIDCollection URI template 1 Represents a collection of external IDs for a specified global ID (placeholder {globalId}).
### GET the Identity API resource

Response body: identityApi

Required role: ROLE_IDENTITY_READ

Example request:

GET /identity
Host: ...
Authorization: Basic ...

Example response:

HTTP/1.1 200 OK
Content-Type: application/vnd.com.nsn.cumulocity.identityApi+json;ver=...
Content-Length: ...
{
  "self" : "<<Identity API URL>>",
  "externalId" : "<<ExternalId URL>>/{type}/{externaId}",
  "externalIdsOfGlobalId" : "<<GlobalIdCollection URL>>/{globalId}/externalIds"
}

External ID collection

ExternalIDCollection [application/vnd.com.nsn.cumulocity.externalIdCollection+json]

As returned by “externalIdsOfGlobalId”.

Name Type Occurs Description
self string 1 A URI linking to this resource.
externalIds ExternalId 0..n List of external IDs, see below.
prev string 0..1 A URI linking to a potential previous page of external IDs.
next string 0..1 A URI linking to a potential next page of external IDs.

External IDs contained in the collection contain the properties “self”, “externalId”, “type” and reference to the managed object.

GET an ExternalIdCollection

Response body: ExternalIdCollection

Required role: ROLE_IDENTITY_READ

Example response:

HTTP/1.1 200 OK
Content-Type: application/vnd.com.nsn.cumulocity.externalIdCollection+json;ver=...
Content-Length: ...
{
  "self" : "<<ExternalIdCollection URL>>",
  "externalIds" :[
    {
      "self" : "<<ExternalId URL>>",
      "externalId" : "42",
      "type" : "theregate",
      "managedObject" : {        "id" : "24",
        "self" : "<<URL to the Managed Object>>"
      }
    },
    {
       ...
    }
  ]
}

POST / Create an External ID

Request body: ExternalId

Response body: ExternalId

Required role: ROLE_IDENTITY_ADMIN

Example Request:

POST /identity/globalIds/<<deviceId>>/externalIds
Host: ...
Authorization: Basic ...
Accept: application/vnd.com.nsn.cumulocity.externalId+json;ver=...
Content-Type: application/vnd.com.nsn.cumulocity.externalId+json;ver=...
Content-Length: ...

{
  "externalId" : "42",
  "type" : "theregate"
}

Example Response:

HTTP/1.1 201 Created
Content-Type: application/vnd.com.nsn.cumulocity.externalId+json;ver=...
Content-Length: ...
Location: <<URL of new ExternalId mapping>>

{
  "self" : "<<URL of new ExternalId mapping>>",
  "externalId" : "42",
  "type" : "theregate",
  "managedObject" : {
    "id" : "24",
    "self" : "<<URL to the Managed Object>>"
  }
}

Note that the managed object has to be created first, then the mapping can be registered.

External ID

External ID [application/vnd.com.nsn.cumulocity.externalId+json]

colgroup>
Name Type Occurs Description PUT/POST
externalId string 1 The identifier used in the external system that Cumulocity interfaces with. Mandatory
self string 1 A URI linking to this resource. No
type string 1 The type of the external identifier as string, e.g., “com_cumulocity_model_idtype_SerialNumber”. Mandatory
managedObject ManagedObject 1 The ManagedObject linked to the external ID. Mandatory

GET an ExternalID

Response body: ExternalId

Required role: ROLE_IDENTITY_READ

Example request:

GET /identity/externalIds/<<externalIdType>>/<<externalId>>
Host: ...
Authorization: Basic ...
Accept: application/vnd.com.nsn.cumulocity.externalId+json;ver=...

Example response:

HTTP/1.1 200 OK
Content-Type: application/vnd.com.nsn.cumulocity.externalId+json;ver=...
Content-Length: ...

{
  "externalId" : "42",
  "self" : "<<URL to this ExternalID mapping>>",
  "type" : "com_cumulocity_model_idtype_SerialNumber",
  "managedObject" : {
    "id" : "24",
    "self" : "<<URL to the Managed Object>>"
  }
}

DELETE an ExternalID

Request Body: N/A.

Response Message Body: N/A.

Required role: ROLE_IDENTITY_ADMIN

Example Request: Delete an External ID

DELETE /identity/externalIds/<<externalIdType>>/<<externalId>>
 Host: [hostname]
 Authorization: Basic xxxxxxxxxxxxxxxxxxx

Example Response:

HTTP/1.1  204 NO CONTENT