NAV Navbar
shell java python javascript

Platform of Trust API Documentation

What is Platform of Trust?

Communally built Platform of Trust provides a trustworthy and easy-to-use surrounding where you can utilize a vast data pool and develop everyday services for your customers with the help from the developer community and without a need for pricey and time-consuming integrations.

Platform of Trust has Finnish origins, but it’s built to expand globally through the network of built environment innovation hubs.

More resources & support

Developer Portal

Our Developer Portal is your one-stop-shop. From there you'll find getting started guides, API descriptions, use case descriptions and link to API documentation.

End-to-end developer experience

APIs play crucial role in our end-end-end developer experience from integrating data to creating valuable applications. API -first experience and consistent APIs are important to us and thus we have created (work in progress) API Design Guide to offer guidance for our distributes API development teams.

End-to-end developer experience in Platform of Trust

Market place

Market place is the bazaar to find more data products to use in application development. Visa versa, it is also the service where your data products are added during the integration process. You can list data products in the market place with Product API.

Getting started

Some instructions and tips to make your life easier (and less support requests to us):

  • Create an account in sandbox environment from https://world-sandbox.oftrust.net/

  • Endpoints related code examples are constructed against SANDBOX environment https://api-sandbox.oftrust.net/.

  • In PRODUCTION use, change domain in api endpoints to https://api.oftrust.net/

  • To test APIs you need to get needed Bearer Token See Authentication section

If you found a bug or missing information in the documentation, contact us at dev@oftrust.net or create an issue in Github.

Standards used

Dates: we use a subset of ISO-8601 - RFC 3339. Example 2008-09-15T15:53:00+05:00

Core Ontology: The Platform Of Trust core ontology can be found as a JSON-LD ontology file under ontologies/pot.jsonld.

Each identity type has their own context which describes the attributes the identity has. The context file name gives a notion of whether the context is for an identity or a link.

The identity describes the real world identities, such as apartments, buildings, rooms etc. The links are the relations between identities. As an example, the Tenant-link can be applied between a user identity and an apartment identity, meaning that the user is a tenant in the apartment.

If only a link between identities is needed, without any kind of role, the generic link-link.jsonld can be used contexts/link-link.jsonld.

Read more from Github

Broker API

Get Broker API related resources:

The Broker API provides means to connect a service to a translator that will return desired data from different sources. The data broker does not mangle the data in any way, it only functions as a proxy between services and translators.

Version: v1

/broker/v1/fetch-data-product

post

Description: Request data from an external service defined by the data product, and product code. The data broker will validate the signature of the payload and when verified, relay the request to the translator connected to the data product. The translator will translate the information fetched from an external source into a standardized format that will be returned to the requester.

http request

Example for: POST /broker/v1/fetch-data-product

import requests

headers={
    "X-Pot-Signature" : "Ioma1gqOVFUBrXiziWS....CLqBG4vFozG3YgzPzillNip0=",
    "X-Pot-App" : "379780e4-b511-4fa9-aef8-bda9bd58ab89",
    "X-Pot-Token" : "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJzY29w...DVs5aaf",
    "Content-Type" : "application/json"
}
json={
    "timestamp" : "2018-11-01T12:00:00+00:00",
    "productCode" : "product-1",
    "parameters" : {
        "param-1" : "Value",
        "param-2" : "Value"
    }
}

response = requests.post(
    'https://api-sandbox.oftrust.net/broker/{version}/fetch-data-product',
    headers=headers,
    json=json
)

print({
    'raw_body': response.json(),
    'status': response.status_code,
    'code': response.status_code
})

curl -i -X POST \
     -H "X-Pot-Signature: Ioma1gqOVFUBrXiziWS....CLqBG4vFozG3YgzPzillNip0=" \
     -H "X-Pot-App: 379780e4-b511-4fa9-aef8-bda9bd58ab89" \
     -H "X-Pot-Token: eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJzY29w...DVs5aaf" \
     -H "Content-Type: application/json" \
     -d \
"{
    \"timestamp\" : \"2018-11-01T12:00:00+00:00\",
    \"productCode\" : \"product-1\",
    \"parameters\" : {
        \"param-1\" : \"Value\",
        \"param-2\" : \"Value\"
    }
}" "https://api-sandbox.oftrust.net/broker/{version}/fetch-data-product"
const unirest = require("unirest");

const headers = {
    "X-Pot-Signature" : "Ioma1gqOVFUBrXiziWS....CLqBG4vFozG3YgzPzillNip0=",
    "X-Pot-App" : "379780e4-b511-4fa9-aef8-bda9bd58ab89",
    "X-Pot-Token" : "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJzY29w...DVs5aaf",
    "Content-Type" : "application/json"
};
const body = {
    "timestamp" : "2018-11-01T12:00:00+00:00",
    "productCode" : "product-1",
    "parameters" : {
        "param-1" : "Value",
        "param-2" : "Value"
    }
};

unirest
  .post("https://api-sandbox.oftrust.net/broker/{version}/fetch-data-product")
  .headers(headers)
  .send(body)
  .then(({ raw_body, status, code }) => {
    // output response to console as JSON
    console.log(JSON.stringify({ raw_body, status, code }, null, 4));
  });

System.out.println("Java example missing. Why not contribute one for us?");

The above example should return JSON structured like this:

The above example should return JSON structured like this:

HTTP/1.0 200

{
  "@context": "<context url>",
  "data": {
    <response from translator>
  },
  "signature": {
    "type": "<signature type>",
    "created": "<RFC3339>",
    "creator": "<public key URL>",
    "signatureValue": "..."
  }
}


POST /broker/v1/fetch-data-product

Parameters

Name Located in Description Required Type
version path Yes string
X-Pot-Signature header A HMAC-SHA256 signature in base64 encoded format. The signature is created by taking the request payload, e.g. a Python dict, and converting it to a string.

Python example:

body_string = json.dumps(
body,
sort_keys=True,
indent=None,
separators=(',', ': ')
).strip()

The keys MUST be sorted, without indentation and separators comma (,) and colon (:) specified.

Get the digest by passing the app access token (generated when creating a new app) and the body string to hmac:

digest =
hmac.new(app_access_token.encode('utf-8'),
body_string.encode('utf-8'),
hashlib.sha256).digest()


Return the digest in base64 encoded format:
X-Pot-Signature = base64.b64encode(digest).decode()
Yes string
X-Pot-App header The requesting application's client ID. Yes string
X-Pot-Token header The currently logged in user's OAuth access token. No string
body body Yes

Responses

Code Description
200
422

Calendar API

Get Calendar API related resources:

The calendar API provides means to create calendar entries to identities. You can e.g. create an event for a housing company identity, a reservation to a room identity, or just a regular calendar entry to any identity you want.

The calendar entry requires a "to"-identity, the ID of the identity to which the calendar entry applies to. Specify a type for the entry, e.g. Event, Reservation, CalendarEntry. Give the calendar entry a title, e.g. "Housewarming party", a start date, when the entry starts, and an end date when the entry ends. The dates are in RFC3339 format, and will be saved in UTC time.

You can specify if an entry repeats, as defined in ISO 8601 repeating intervals. A location can be added as well, if needed, as a string, e.g. "Living room".

The cc is a list of user IDs to whom the calendar entry can be CC'd to. A notification about the entry will be sent to these users.

Version: v1

/calendars/v1

post

Description: Create a new calendar entry

http request

Example for: POST /calendars/v1

import requests

headers={
    "Authorization" : "Bearer <ACCESS_TOKEN>",
    "Content-Type" : "application/json"
}
json={
    "repeats" : "R5/2008-03-01T13:00:00Z/P1Y2M10DT2H30M",
    "startDate" : "2019-04-01T12:00:00+02:00",
    "toIdentity" : "0920a84a-1548-4644-b95d-e3f80e1b9ca6",
    "location" : "Courtyard at Teststreet 12",
    "content" : "April fool's event, held on the courtyard.",
    "title" : "April fool's day festivities.",
    "type" : "Event",
    "endDate" : "2019-04-01T16:00:00+02:00",
    "cc" : [ "323bde80-4cc2-472e-bb77-e6a3e95a1253", "0827e9c3-9664-479f-b0ec-956a35d72e4b" ]
}

response = requests.post(
    'https://api-sandbox.oftrust.net/calendars/{version}',
    headers=headers,
    json=json
)

print({
    'raw_body': response.json(),
    'status': response.status_code,
    'code': response.status_code
})

curl -i -X POST \
     -H "Authorization: Bearer <ACCESS_TOKEN>" \
     -H "Content-Type: application/json" \
     -d \
"{
    \"repeats\" : \"R5/2008-03-01T13:00:00Z/P1Y2M10DT2H30M\",
    \"startDate\" : \"2019-04-01T12:00:00+02:00\",
    \"toIdentity\" : \"0920a84a-1548-4644-b95d-e3f80e1b9ca6\",
    \"location\" : \"Courtyard at Teststreet 12\",
    \"content\" : \"April fool's event, held on the courtyard.\",
    \"title\" : \"April fool's day festivities.\",
    \"type\" : \"Event\",
    \"endDate\" : \"2019-04-01T16:00:00+02:00\",
    \"cc\" : [ \"323bde80-4cc2-472e-bb77-e6a3e95a1253\", \"0827e9c3-9664-479f-b0ec-956a35d72e4b\" ]
}" "https://api-sandbox.oftrust.net/calendars/{version}"
const unirest = require("unirest");

const headers = {
    "Authorization" : "Bearer <ACCESS_TOKEN>",
    "Content-Type" : "application/json"
};
const body = {
    "repeats" : "R5/2008-03-01T13:00:00Z/P1Y2M10DT2H30M",
    "startDate" : "2019-04-01T12:00:00+02:00",
    "toIdentity" : "0920a84a-1548-4644-b95d-e3f80e1b9ca6",
    "location" : "Courtyard at Teststreet 12",
    "content" : "April fool's event, held on the courtyard.",
    "title" : "April fool's day festivities.",
    "type" : "Event",
    "endDate" : "2019-04-01T16:00:00+02:00",
    "cc" : [ "323bde80-4cc2-472e-bb77-e6a3e95a1253", "0827e9c3-9664-479f-b0ec-956a35d72e4b" ]
};

unirest
  .post("https://api-sandbox.oftrust.net/calendars/{version}")
  .headers(headers)
  .send(body)
  .then(({ raw_body, status, code }) => {
    // output response to console as JSON
    console.log(JSON.stringify({ raw_body, status, code }, null, 4));
  });

System.out.println("Java example missing. Why not contribute one for us?");

The above example should return JSON structured like this:

The above example should return JSON structured like this:

HTTP/1.0 201

{
  "@context": "https://standards.lifeengine.io/v1/Context/Calendar",
  "@type": "Event",
  "@id": "c9620d09-cd83-476e-91f5-3f3ea730f4b9",
  "toIdentity": "0920a84a-1548-4644-b95d-e3f80e1b9ca6",
  "title": "April's fools day",
  "startDate": "2019-04-01T12:00:00+02:00",
  "endDate": "2019-04-01T16:00:00+02:00",
  "repeats": "R5/2019-04-01T12:00:00+02:00/P1Y",
  "content": "April fool's event, held on the courtyard.",
  "location": "Courtyard at Teststreet 12",
  "cc": [
    "970bf5ef-8ca8-46a1-a4a9-e595ea1b4024",
    "cb40ce78-d3b3-442a-9db7-66f191698b2a"
  ],
  "createdAt": "2019-01-10T12:00:00Z",
  "updatedAt": "2019-01-10T12:00:00Z",
  "createdBy": "58422496-5796-4c47-a4a1-88768ea94ea6"
}


POST /calendars/v1

Parameters

Name Located in Description Required Type
version path Yes string
Authorization header The Authorization header, MUST be Bearer {{access_token}} Yes string
body body Yes

Responses

Code Description
201
422

/calendars/v1/{id}

get

Description: Read one calendar by id

http request

Example for: GET /calendars/v1/{id}

import requests

headers={
    "Authorization" : "Bearer <ACCESS_TOKEN>"
}


response = requests.get(
    'https://api-sandbox.oftrust.net/calendars/{version}/{id}',
    headers=headers,
)

print({
    'raw_body': response.json(),
    'status': response.status_code,
    'code': response.status_code
})

curl -i -X GET \
     -H "Authorization: Bearer <ACCESS_TOKEN>" "https://api-sandbox.oftrust.net/calendars/{version}/{id}"
const unirest = require("unirest");

const headers = {
    "Authorization" : "Bearer <ACCESS_TOKEN>"
};


unirest
  .get("https://api-sandbox.oftrust.net/calendars/{version}/{id}")
  .headers(headers)
  .then(({ raw_body, status, code }) => {
    // output response to console as JSON
    console.log(JSON.stringify({ raw_body, status, code }, null, 4));
  });

System.out.println("Java example missing. Why not contribute one for us?");

The above example should return JSON structured like this:

The above example should return JSON structured like this:

HTTP/1.0 200

{
  "@context": "https://standards.lifeengine.io/v1/Context/Calendar",
  "@type": "Event",
  "@id": "c9620d09-cd83-476e-91f5-3f3ea730f4b9",
  "toIdentity": "0920a84a-1548-4644-b95d-e3f80e1b9ca6",
  "title": "April's fools day",
  "startDate": "2019-04-01T12:00:00+02:00",
  "endDate": "2019-04-01T16:00:00+02:00",
  "repeats": "R5/2019-04-01T12:00:00+02:00/P1Y",
  "content": "April fool's event, held on the courtyard.",
  "location": "Courtyard at Teststreet 12",
  "cc": [
    "970bf5ef-8ca8-46a1-a4a9-e595ea1b4024",
    "cb40ce78-d3b3-442a-9db7-66f191698b2a"
  ],
  "createdAt": "2019-01-10T12:00:00Z",
  "updatedAt": "2019-01-10T12:00:00Z",
  "createdBy": "58422496-5796-4c47-a4a1-88768ea94ea6"
}


GET /calendars/v1/{id}

Parameters

Name Located in Description Required Type
id path The ID of the calendar Yes string
version path Yes string
Authorization header The Authorization header, MUST be Bearer {{access_token}} Yes string

Responses

Code Description
200
404

put

Description: Update a calendar by id

http request

Example for: PUT /calendars/v1/{id}

import requests

headers={
    "Authorization" : "Bearer <ACCESS_TOKEN>",
    "Content-Type" : "application/json"
}
json={
    "type" : "Event",
    "title" : "April fool's day festivities.",
    "startDate" : "2019-04-01T12:00:00+02:00",
    "endDate" : "2019-04-01T16:00:00+02:00",
    "repeats" : "R5/2008-03-01T13:00:00Z/P1Y2M10DT2H30M",
    "content" : "April fool's event, held on the courtyard.",
    "location" : "Courtyard at Teststreet 12"
}

response = requests.put(
    'https://api-sandbox.oftrust.net/calendars/{version}/{id}',
    headers=headers,
    json=json
)

print({
    'raw_body': response.json(),
    'status': response.status_code,
    'code': response.status_code
})

curl -i -X PUT \
     -H "Authorization: Bearer <ACCESS_TOKEN>" \
     -H "Content-Type: application/json" \
     -d \
"{
    \"type\" : \"Event\",
    \"title\" : \"April fool's day festivities.\",
    \"startDate\" : \"2019-04-01T12:00:00+02:00\",
    \"endDate\" : \"2019-04-01T16:00:00+02:00\",
    \"repeats\" : \"R5/2008-03-01T13:00:00Z/P1Y2M10DT2H30M\",
    \"content\" : \"April fool's event, held on the courtyard.\",
    \"location\" : \"Courtyard at Teststreet 12\"
}" "https://api-sandbox.oftrust.net/calendars/{version}/{id}"
const unirest = require("unirest");

const headers = {
    "Authorization" : "Bearer <ACCESS_TOKEN>",
    "Content-Type" : "application/json"
};
const body = {
    "type" : "Event",
    "title" : "April fool's day festivities.",
    "startDate" : "2019-04-01T12:00:00+02:00",
    "endDate" : "2019-04-01T16:00:00+02:00",
    "repeats" : "R5/2008-03-01T13:00:00Z/P1Y2M10DT2H30M",
    "content" : "April fool's event, held on the courtyard.",
    "location" : "Courtyard at Teststreet 12"
};

unirest
  .put("https://api-sandbox.oftrust.net/calendars/{version}/{id}")
  .headers(headers)
  .send(body)
  .then(({ raw_body, status, code }) => {
    // output response to console as JSON
    console.log(JSON.stringify({ raw_body, status, code }, null, 4));
  });

System.out.println("Java example missing. Why not contribute one for us?");

The above example should return JSON structured like this:

The above example should return JSON structured like this:

HTTP/1.0 200

{
  "@context": "https://standards.lifeengine.io/v1/Context/Calendar",
  "@type": "Event",
  "@id": "c9620d09-cd83-476e-91f5-3f3ea730f4b9",
  "toIdentity": "0920a84a-1548-4644-b95d-e3f80e1b9ca6",
  "title": "April's fools day",
  "startDate": "2019-04-01T12:00:00+02:00",
  "endDate": "2019-04-01T16:00:00+02:00",
  "repeats": "R5/2019-04-01T12:00:00+02:00/P1Y",
  "content": "April fool's event, held on the courtyard.",
  "location": "Courtyard at Teststreet 12",
  "cc": [
    "970bf5ef-8ca8-46a1-a4a9-e595ea1b4024",
    "cb40ce78-d3b3-442a-9db7-66f191698b2a"
  ],
  "createdAt": "2019-01-10T12:00:00Z",
  "updatedAt": "2019-01-10T12:00:00Z",
  "createdBy": "58422496-5796-4c47-a4a1-88768ea94ea6"
}


PUT /calendars/v1/{id}

Parameters

Name Located in Description Required Type
id path The ID of the calendar Yes string
version path Yes string
Authorization header The Authorization header, MUST be Bearer {{access_token}} Yes string
body body Yes

Responses

Code Description
200
404
422

delete

Description: Delete a calendar by id

http request

Example for: DELETE /calendars/v1/{id}

import requests

headers={
    "Authorization" : "Bearer <ACCESS_TOKEN>"
}


response = requests.delete(
    'https://api-sandbox.oftrust.net/calendars/{version}/{id}',
    headers=headers,
)

print({
    'raw_body': response.text,
    'status': response.status_code,
    'code': response.status_code
})

curl -i -X DELETE \
     -H "Authorization: Bearer <ACCESS_TOKEN>" "https://api-sandbox.oftrust.net/calendars/{version}/{id}"
const unirest = require("unirest");

const headers = {
    "Authorization" : "Bearer <ACCESS_TOKEN>"
};


unirest
  .delete("https://api-sandbox.oftrust.net/calendars/{version}/{id}")
  .headers(headers)
  .then(({ raw_body, status, code }) => {
    // output response to console as JSON
    console.log(JSON.stringify({ raw_body, status, code }, null, 4));
  });

System.out.println("Java example missing. Why not contribute one for us?");

The above example should return JSON structured like this:

The above example should return JSON structured like this:

HTTP/1.0 204

{}

DELETE /calendars/v1/{id}

Parameters

Name Located in Description Required Type
id path The ID of the calendar Yes string
version path Yes string
Authorization header The Authorization header, MUST be Bearer {{access_token}} Yes string

Responses

Code Description
204
404

/calendars/v1/{toidentity}/list

get

Description: List calendars created for "to"-identity.

http request

Do you need help in using the GET /calendars/v1/{toIdentity}/list ?

  • Checkout existing questions & answers
  • Ask a question in Stack Overflow

  • Did we miss something? Make a wish!
  •  

    Example for: GET /calendars/v1/{toIdentity}/list

    import requests
    
    headers={
        "Authorization" : "Bearer <ACCESS_TOKEN>"
    }
    
    
    response = requests.get(
        'https://api-sandbox.oftrust.net/calendars/{version}/{toIdentity}/list',
        headers=headers,
    )
    
    print({
        'raw_body': response.json(),
        'status': response.status_code,
        'code': response.status_code
    })
    
    
    curl -i -X GET \
         -H "Authorization: Bearer <ACCESS_TOKEN>" "https://api-sandbox.oftrust.net/calendars/{version}/{toIdentity}/list"
    
    const unirest = require("unirest");
    
    const headers = {
        "Authorization" : "Bearer <ACCESS_TOKEN>"
    };
    
    
    unirest
      .get("https://api-sandbox.oftrust.net/calendars/{version}/{toIdentity}/list")
      .headers(headers)
      .then(({ raw_body, status, code }) => {
        // output response to console as JSON
        console.log(JSON.stringify({ raw_body, status, code }, null, 4));
      });
    
    
    System.out.println("Java example missing. Why not contribute one for us?");
    

    The above example should return JSON structured like this:

    The above example should return JSON structured like this:
    
    HTTP/1.0 200
    
    {
      "@context": "https://schema.org/",
      "@type": "collection",
      "ItemList": [
        {
          "@context": "https://standards.lifeengine.io/v1/Context/Calendar",
          "@type": "Event",
          "@id": "c9620d09-cd83-476e-91f5-3f3ea730f4b9",
          "toIdentity": "0920a84a-1548-4644-b95d-e3f80e1b9ca6",
          "title": "April's fools day",
          "startDate": "2019-04-01T12:00:00+02:00",
          "endDate": "2019-04-01T16:00:00+02:00",
          "repeats": "R5/2019-04-01T12:00:00+02:00/P1Y",
          "content": "April fool's event, held on the courtyard.",
          "location": "Courtyard at Teststreet 12",
          "cc": [
            "970bf5ef-8ca8-46a1-a4a9-e595ea1b4024",
            "cb40ce78-d3b3-442a-9db7-66f191698b2a"
          ],
          "createdAt": "2019-01-10T12:00:00Z",
          "updatedAt": "2019-01-10T12:00:00Z",
          "createdBy": "58422496-5796-4c47-a4a1-88768ea94ea6"
        },
        {
          "@context": "https://standards.lifeengine.io/v1/Context/Calendar",
          "@type": "Event",
          "@id": "c8a3f324-a6cf-44fc-b010-5dd1354ecb89",
          "toIdentity": "0920a84a-1548-4644-b95d-e3f80e1b9ca6",
          "title": "May day lunch",
          "startDate": "2019-05-01T12:00:00+02:00",
          "endDate": "2019-05-01T16:00:00+02:00",
          "repeats": "R5/2019-05-01T12:00:00+02:00/P1Y",
          "content": "May day lunch at restaurant",
          "location": "Courtyard at Teststreet 12",
          "cc": [
            "970bf5ef-8ca8-46a1-a4a9-e595ea1b4024",
            "cb40ce78-d3b3-442a-9db7-66f191698b2a"
          ],
          "createdAt": "2019-01-10T12:00:00Z",
          "updatedAt": "2019-01-10T12:00:00Z",
          "createdBy": "58422496-5796-4c47-a4a1-88768ea94ea6"
        }
      ]
    }
    
    
    

    GET /calendars/v1/{toIdentity}/list

    Parameters

    Name Located in Description Required Type
    toIdentity path The identity to which the calendar belongs to. Yes string
    version path Yes string
    Authorization header The Authorization header, MUST be Bearer {{access_token}} Yes string

    Responses

    Code Description
    200

    Context API

    Get Context API related resources:

    The Context API provides means to list available JSON-LD contexts of the Platform of Trust.

    The contexts defines the semantic meaning of the keys in the responses from the APIs. When creating a new identity, choose which type of identity to create by choosing the correct context. The context will then define the attributes the identity can have.

    Version: v1

    /contexts/v1/

    get

    Description: List all supported contexts

    http request

    Example for: GET /contexts/v1/

    import requests
    
    
    
    
    response = requests.get(
        'https://api-sandbox.oftrust.net/contexts/{version}/',
    )
    
    print({
        'raw_body': response.json(),
        'status': response.status_code,
        'code': response.status_code
    })
    
    
    curl -i -X GET "https://api-sandbox.oftrust.net/contexts/{version}/"
    
    const unirest = require("unirest");
    
    
    
    
    unirest
      .get("https://api-sandbox.oftrust.net/contexts/{version}/")
      .then(({ raw_body, status, code }) => {
        // output response to console as JSON
        console.log(JSON.stringify({ raw_body, status, code }, null, 4));
      });
    
    
    System.out.println("Java example missing. Why not contribute one for us?");
    

    The above example should return JSON structured like this:

    The above example should return JSON structured like this:
    
    HTTP/1.0 200
    
    {
      "standards": {
        "Core": {
          "dataProducts": [
            {
              "classDefinition": "https://standards.oftrust.net/v1/ClassDefinitions/DataProduct",
              "context": "https://standards.oftrust.net/v1/Context/DataProduct",
              "name": "Data Product",
              "subclasses": [],
              "vocabulary": "https://standards.oftrust.net/v1/Vocabulary/DataProduct"
            }
          ],
          "identities": [],
          "links": [
            {
              "classDefinition": "https://standards.oftrust.net/v1/ClassDefinitions/Link",
              "context": "https://standards.oftrust.net/v1/Context/Link",
              "name": "Link",
              "subclasses": [
                {
                  "classDefinition": "https://standards.oftrust.net/v1/ClassDefinitions/Link/Role",
                  "context": "https://standards.oftrust.net/v1/Context/Link/Role",
                  "name": "Role",
                  "vocabulary": "https://standards.oftrust.net/v1/Vocabulary/Link/Role",
                  "subclasses": []
                }
              ],
              "vocabulary": "https://standards.oftrust.net/v1/Vocabulary/Link"
            }
          ]
        },
        "Platform of Trust": {
          "dataProducts": [],
          "identities": [
            {
              "classDefinition": "https://standards.oftrust.net/v1/ClassDefinitions/Group/Organization",
              "context": "https://standards.oftrust.net/v1/Context/Group/Organization",
              "name": "Organization",
              "subclasses": [
                {
                  "classDefinition": "https://standards.oftrust.net/v1/ClassDefinitions/Group/Organization/LimitedCompany",
                  "context": "https://standards.oftrust.net/v1/Context/Group/Organization/LimitedCompany",
                  "name": "Limited Company",
                  "subclasses": [
                    {
                      "classDefinition": "https://standards.oftrust.net/v1/ClassDefinitions/Group/Organization/LimitedCompany/HousingCooperative",
                      "context": "https://standards.oftrust.net/v1/Context/Group/Organization/LimitedCompany/HousingCooperative",
                      "name": "Housing Cooperative",
                      "subclasses": [],
                      "vocabulary": "https://standards.oftrust.net/v1/Vocabulary/Group/Organization/LimitedCompany/HousingCooperative"
                    }
                  ],
                  "vocabulary": "https://standards.oftrust.net/v1/Vocabulary/Group/Organization/LimitedCompany"
                }
              ],
              "vocabulary": "https://standards.oftrust.net/v1/Vocabulary/Group/Organization"
            }
          ],
          "links": []
        }
      }
    }
    
    
    
    

    GET /contexts/v1/

    Parameters

    Name Located in Description Required Type
    version path Yes string

    Responses

    Code Description
    200

    Identity API

    Get Identity API related resources:

    The Identity API provides means to create, update and delete digital twins (identities) and manage links between them. The links provides the direction and type (sometimes called role) of the link.

    Version: v1

    /identities/v1

    post

    Description: Create a new identity

    http request

    Example for: POST /identities/v1

    import requests
    
    headers={
        "Authorization" : "Bearer <ACCESS_TOKEN>",
        "Content-Type" : "application/json"
    }
    json={
        "context" : "https://standards.lifeengine.io/v1/Context/Identity/Group",
        "type" : "Group",
        "data" : {
            "name" : "Company Oy"
        }
    }
    
    response = requests.post(
        'https://api-sandbox.oftrust.net/identities/v1',
        headers=headers,
        json=json
    )
    
    print({
        'raw_body': response.json(),
        'status': response.status_code,
        'code': response.status_code
    })
    
    
    curl -i -X POST \
         -H "Authorization: Bearer <ACCESS_TOKEN>" \
         -H "Content-Type: application/json" \
         -d \
    "{
        \"context\" : \"https://standards.lifeengine.io/v1/Context/Identity/Group\",
        \"type\" : \"Group\",
        \"data\" : {
            \"name\" : \"Company Oy\"
        }
    }" "https://api-sandbox.oftrust.net/identities/v1"
    
    const unirest = require("unirest");
    
    const headers = {
        "Authorization" : "Bearer <ACCESS_TOKEN>",
        "Content-Type" : "application/json"
    };
    const body = {
        "context" : "https://standards.lifeengine.io/v1/Context/Identity/Group",
        "type" : "Group",
        "data" : {
            "name" : "Company Oy"
        }
    };
    
    unirest
      .post("https://api-sandbox.oftrust.net/identities/v1")
      .headers(headers)
      .send(body)
      .then(({ raw_body, status, code }) => {
        // output response to console as JSON
        console.log(JSON.stringify({ raw_body, status, code }, null, 4));
      });
    
    
    System.out.println("Java example missing. Why not contribute one for us?");
    

    The above example should return JSON structured like this:

    The above example should return JSON structured like this:
    
    HTTP/1.0 201
    
    {
      "@context": "https://standards.lifeengine.io/v1/Context/Identity/Group",
      "@type": "Group",
      "@id": "58dc29ab-d52e-4aab-a228-9b54e001797c",
      "data": {
        "name": "Company Oy"
      },
      "metadata": {
        "createdBy": "cf0862f6-3f4f-498f-97f1-fbe8b5734448",
        "updatedBy": "cf0862f6-3f4f-498f-97f1-fbe8b5734448",
        "createdAt": "2018-02-28T16:41:41.090Z",
        "updatedAt": "2018-02-28T16:41:41.090Z"
      },
      "inLinks": [],
      "outLinks": []
    }
    
    
    

    POST /identities/v1

    Parameters

    Name Located in Description Required Type
    Authorization header The Authorization header, MUST be Bearer {{access_token}} Yes string
    body body Yes

    Responses

    Code Description
    201
    422

    /identities/v1/{id}

    get

    Description: Read one identity by id

    http request

    Example for: GET /identities/v1/{id}

    import requests
    
    headers={
        "Authorization" : "Bearer <ACCESS_TOKEN>"
    }
    
    
    response = requests.get(
        'https://api-sandbox.oftrust.net/identities/v1/{id}',
        headers=headers,
    )
    
    print({
        'raw_body': response.json(),
        'status': response.status_code,
        'code': response.status_code
    })
    
    
    curl -i -X GET \
         -H "Authorization: Bearer <ACCESS_TOKEN>" "https://api-sandbox.oftrust.net/identities/v1/{id}"
    
    const unirest = require("unirest");
    
    const headers = {
        "Authorization" : "Bearer <ACCESS_TOKEN>"
    };
    
    
    unirest
      .get("https://api-sandbox.oftrust.net/identities/v1/{id}")
      .headers(headers)
      .then(({ raw_body, status, code }) => {
        // output response to console as JSON
        console.log(JSON.stringify({ raw_body, status, code }, null, 4));
      });
    
    
    System.out.println("Java example missing. Why not contribute one for us?");
    

    The above example should return JSON structured like this:

    The above example should return JSON structured like this:
    
    HTTP/1.0 200
    
    {
      "@context": "https://standards.lifeengine.io/v1/Context/Identity/Group",
      "@type": "Group",
      "@id": "58dc29ab-d52e-4aab-a228-9b54e001797c",
      "data": {
        "name": "Company Oy"
      },
      "metadata": {
        "createdBy": "cf0862f6-3f4f-498f-97f1-fbe8b5734448",
        "updatedBy": "cf0862f6-3f4f-498f-97f1-fbe8b5734448",
        "createdAt": "2018-02-28T16:41:41.090Z",
        "updatedAt": "2018-02-28T16:41:41.090Z"
      },
      "inLinks": [
        {
          "@context": "https://standards.lifeengine.io/v1/Context/Link/Role/MemberOf",
          "@type": "MemberOf",
          "@id": "cf0862f6-3f4f-498f-97f1-fbe8b5734448",
          "from": "58dc29ab-d52e-4aab-a228-9b54e001797c",
          "to": "cf0862f6-3f4f-498f-97f1-fbe8b5734448",
          "data": {},
          "metadata": {
            "createdBy": "cf0862f6-3f4f-498f-97f1-fbe8b5734448",
            "updatedBy": "cf0862f6-3f4f-498f-97f1-fbe8b5734448",
            "createdAt": "2018-02-28T16:41:41.090Z",
            "updatedAt": "2018-02-28T16:41:41.090Z"
          }
        }
      ],
      "outLinks": [
        {
          "@context": "https://standards.lifeengine.io/v1/Context/Link/Role/MemberOf",
          "@type": "MemberOf",
          "@id": "cb40ce78-d3b3-442a-9db7-66f191698b2a",
          "from": "cf0862f6-3f4f-498f-97f1-fbe8b5734448",
          "to": "58dc29ab-d52e-4aab-a228-9b54e001797c",
          "data": {},
          "metadata": {
            "createdBy": "cf0862f6-3f4f-498f-97f1-fbe8b5734448",
            "updatedBy": "cf0862f6-3f4f-498f-97f1-fbe8b5734448",
            "createdAt": "2018-02-28T16:41:41.090Z",
            "updatedAt": "2018-02-28T16:41:41.090Z"
          }
        }
      ]
    }
    
    
    

    GET /identities/v1/{id}

    Parameters

    Name Located in Description Required Type
    id path The ID of the Identity Yes string
    Authorization header The Authorization header, MUST be Bearer {{access_token}} Yes string

    Responses

    Code Description
    200
    404

    put

    Description: Update an identity by id

    http request

    Example for: PUT /identities/v1/{id}

    import requests
    
    headers={
        "Authorization" : "Bearer <ACCESS_TOKEN>",
        "Content-Type" : "application/json"
    }
    json={
        "context" : "https://standards.lifeengine.io/v1/Context/Identity/Group",
        "type" : "Group",
        "data" : {
            "name" : "Company Oy"
        }
    }
    
    response = requests.put(
        'https://api-sandbox.oftrust.net/identities/v1/{id}',
        headers=headers,
        json=json
    )
    
    print({
        'raw_body': response.json(),
        'status': response.status_code,
        'code': response.status_code
    })
    
    
    curl -i -X PUT \
         -H "Authorization: Bearer <ACCESS_TOKEN>" \
         -H "Content-Type: application/json" \
         -d \
    "{
        \"context\" : \"https://standards.lifeengine.io/v1/Context/Identity/Group\",
        \"type\" : \"Group\",
        \"data\" : {
            \"name\" : \"Company Oy\"
        }
    }" "https://api-sandbox.oftrust.net/identities/v1/{id}"
    
    const unirest = require("unirest");
    
    const headers = {
        "Authorization" : "Bearer <ACCESS_TOKEN>",
        "Content-Type" : "application/json"
    };
    const body = {
        "context" : "https://standards.lifeengine.io/v1/Context/Identity/Group",
        "type" : "Group",
        "data" : {
            "name" : "Company Oy"
        }
    };
    
    unirest
      .put("https://api-sandbox.oftrust.net/identities/v1/{id}")
      .headers(headers)
      .send(body)
      .then(({ raw_body, status, code }) => {
        // output response to console as JSON
        console.log(JSON.stringify({ raw_body, status, code }, null, 4));
      });
    
    
    System.out.println("Java example missing. Why not contribute one for us?");
    

    The above example should return JSON structured like this:

    The above example should return JSON structured like this:
    
    HTTP/1.0 200
    
    {
      "@context": "https://standards.lifeengine.io/v1/Context/Identity/Group",
      "@type": "Group",
      "@id": "58dc29ab-d52e-4aab-a228-9b54e001797c",
      "data": {
        "name": "Company Oy"
      },
      "metadata": {
        "createdBy": "cf0862f6-3f4f-498f-97f1-fbe8b5734448",
        "updatedBy": "cf0862f6-3f4f-498f-97f1-fbe8b5734448",
        "createdAt": "2018-02-28T16:41:41.090Z",
        "updatedAt": "2018-02-28T16:41:41.090Z"
      },
      "inLinks": [
        {
          "@context": "https://standards.lifeengine.io/v1/Context/Link/Role/MemberOf",
          "@type": "MemberOf",
          "@id": "cf0862f6-3f4f-498f-97f1-fbe8b5734448",
          "from": "58dc29ab-d52e-4aab-a228-9b54e001797c",
          "to": "cf0862f6-3f4f-498f-97f1-fbe8b5734448",
          "data": {},
          "metadata": {
            "createdBy": "cf0862f6-3f4f-498f-97f1-fbe8b5734448",
            "updatedBy": "cf0862f6-3f4f-498f-97f1-fbe8b5734448",
            "createdAt": "2018-02-28T16:41:41.090Z",
            "updatedAt": "2018-02-28T16:41:41.090Z"
          }
        }
      ],
      "outLinks": [
        {
          "@context": "https://standards.lifeengine.io/v1/Context/Link/Role/MemberOf",
          "@type": "MemberOf",
          "@id": "cb40ce78-d3b3-442a-9db7-66f191698b2a",
          "from": "cf0862f6-3f4f-498f-97f1-fbe8b5734448",
          "to": "58dc29ab-d52e-4aab-a228-9b54e001797c",
          "data": {},
          "metadata": {
            "createdBy": "cf0862f6-3f4f-498f-97f1-fbe8b5734448",
            "updatedBy": "cf0862f6-3f4f-498f-97f1-fbe8b5734448",
            "createdAt": "2018-02-28T16:41:41.090Z",
            "updatedAt": "2018-02-28T16:41:41.090Z"
          }
        }
      ]
    }
    
    
    

    PUT /identities/v1/{id}

    Parameters

    Name Located in Description Required Type
    id path The ID of the Identity Yes string
    Authorization header The Authorization header, MUST be Bearer {{access_token}} Yes string
    body body Yes

    Responses

    Code Description
    200
    404
    422

    delete

    Description: Delete an identity by id

    http request

    Example for: DELETE /identities/v1/{id}

    import requests
    
    headers={
        "Authorization" : "Bearer <ACCESS_TOKEN>"
    }
    
    
    response = requests.delete(
        'https://api-sandbox.oftrust.net/identities/v1/{id}',
        headers=headers,
    )
    
    print({
        'raw_body': response.text,
        'status': response.status_code,
        'code': response.status_code
    })
    
    
    curl -i -X DELETE \
         -H "Authorization: Bearer <ACCESS_TOKEN>" "https://api-sandbox.oftrust.net/identities/v1/{id}"
    
    const unirest = require("unirest");
    
    const headers = {
        "Authorization" : "Bearer <ACCESS_TOKEN>"
    };
    
    
    unirest
      .delete("https://api-sandbox.oftrust.net/identities/v1/{id}")
      .headers(headers)
      .then(({ raw_body, status, code }) => {
        // output response to console as JSON
        console.log(JSON.stringify({ raw_body, status, code }, null, 4));
      });
    
    
    System.out.println("Java example missing. Why not contribute one for us?");
    

    The above example should return JSON structured like this:

    The above example should return JSON structured like this:
    
    HTTP/1.0 204
    
    {}
    
    

    DELETE /identities/v1/{id}

    Parameters

    Name Located in Description Required Type
    id path The ID of the Identity Yes string
    Authorization header The Authorization header, MUST be Bearer {{access_token}} Yes string

    Responses

    Code Description
    204
    404

    post

    Description: Creates a new link between two identities

    http request

    Do you need help in using the POST /identities/v1/{from_identity}/link/{to_identity} ?

  • Checkout existing questions & answers
  • Ask a question in Stack Overflow

  • Did we miss something? Make a wish!
  •  

    Example for: POST /identities/v1/{from_identity}/link/{to_identity}

    import requests
    
    headers={
        "Authorization" : "Bearer <ACCESS_TOKEN>",
        "Content-Type" : "application/json"
    }
    json={
        "context" : "https://standards.lifeengine.io/v1/Context/Link/Role/MemberOf",
        "type" : "MemberOf"
    }
    
    response = requests.post(
        'https://api-sandbox.oftrust.net/identities/v1/{from_identity}/link/{to_identity}',
        headers=headers,
        json=json
    )
    
    print({
        'raw_body': response.json(),
        'status': response.status_code,
        'code': response.status_code
    })
    
    
    curl -i -X POST \
         -H "Authorization: Bearer <ACCESS_TOKEN>" \
         -H "Content-Type: application/json" \
         -d \
    "{
        \"context\" : \"https://standards.lifeengine.io/v1/Context/Link/Role/MemberOf\",
        \"type\" : \"MemberOf\"
    }" "https://api-sandbox.oftrust.net/identities/v1/{from_identity}/link/{to_identity}"
    
    const unirest = require("unirest");
    
    const headers = {
        "Authorization" : "Bearer <ACCESS_TOKEN>",
        "Content-Type" : "application/json"
    };
    const body = {
        "context" : "https://standards.lifeengine.io/v1/Context/Link/Role/MemberOf",
        "type" : "MemberOf"
    };
    
    unirest
      .post("https://api-sandbox.oftrust.net/identities/v1/{from_identity}/link/{to_identity}")
      .headers(headers)
      .send(body)
      .then(({ raw_body, status, code }) => {
        // output response to console as JSON
        console.log(JSON.stringify({ raw_body, status, code }, null, 4));
      });
    
    
    System.out.println("Java example missing. Why not contribute one for us?");
    

    The above example should return JSON structured like this:

    The above example should return JSON structured like this:
    
    HTTP/1.0 201
    
    {
      "@context": "https://standards.lifeengine.io/v1/Context/Link/Role/MemberOf",
      "@type": "MemberOf",
      "@id": "cf0862f6-3f4f-498f-97f1-fbe8b5734448",
      "from": "58dc29ab-d52e-4aab-a228-9b54e001797c",
      "to": "cf0862f6-3f4f-498f-97f1-fbe8b5734448",
      "data": {},
      "metadata": {
        "createdBy": "cf0862f6-3f4f-498f-97f1-fbe8b5734448",
        "updatedBy": "cf0862f6-3f4f-498f-97f1-fbe8b5734448",
        "createdAt": "2018-02-28T16:41:41.090Z",
        "updatedAt": "2018-02-28T16:41:41.090Z"
      }
    }
    
    
    

    POST /identities/v1/{from_identity}/link/{to_identity}

    Parameters

    Name Located in Description Required Type
    from_identity path The starting identity ID of the link Yes string
    to_identity path The ending identity ID of the link Yes string
    Authorization header The Authorization header, MUST be Bearer {{access_token}} Yes string
    body body Yes

    Responses

    Code Description
    201
    404
    422

    get

    Description: Read a link by type

    http request

    Do you need help in using the GET /identities/v1/{from_identity}/link/{to_identity}/{type} ?

  • Checkout existing questions & answers
  • Ask a question in Stack Overflow

  • Did we miss something? Make a wish!
  •  

    Example for: GET /identities/v1/{from_identity}/link/{to_identity}/{type}

    import requests
    
    headers={
        "Authorization" : "Bearer <ACCESS_TOKEN>"
    }
    
    
    response = requests.get(
        'https://api-sandbox.oftrust.net/identities/v1/{from_identity}/link/{to_identity}/{type}',
        headers=headers,
    )
    
    print({
        'raw_body': response.json(),
        'status': response.status_code,
        'code': response.status_code
    })
    
    
    curl -i -X GET \
         -H "Authorization: Bearer <ACCESS_TOKEN>" "https://api-sandbox.oftrust.net/identities/v1/{from_identity}/link/{to_identity}/{type}"
    
    const unirest = require("unirest");
    
    const headers = {
        "Authorization" : "Bearer <ACCESS_TOKEN>"
    };
    
    
    unirest
      .get("https://api-sandbox.oftrust.net/identities/v1/{from_identity}/link/{to_identity}/{type}")
      .headers(headers)
      .then(({ raw_body, status, code }) => {
        // output response to console as JSON
        console.log(JSON.stringify({ raw_body, status, code }, null, 4));
      });
    
    
    System.out.println("Java example missing. Why not contribute one for us?");
    

    The above example should return JSON structured like this:

    The above example should return JSON structured like this:
    
    HTTP/1.0 200
    
    {
      "@context": "https://standards.lifeengine.io/v1/Context/Link/Role/MemberOf",
      "@type": "MemberOf",
      "@id": "cf0862f6-3f4f-498f-97f1-fbe8b5734448",
      "from": "58dc29ab-d52e-4aab-a228-9b54e001797c",
      "to": "cf0862f6-3f4f-498f-97f1-fbe8b5734448",
      "data": {},
      "metadata": {
        "createdBy": "cf0862f6-3f4f-498f-97f1-fbe8b5734448",
        "updatedBy": "cf0862f6-3f4f-498f-97f1-fbe8b5734448",
        "createdAt": "2018-02-28T16:41:41.090Z",
        "updatedAt": "2018-02-28T16:41:41.090Z"
      }
    }
    
    
    

    GET /identities/v1/{from_identity}/link/{to_identity}/{type}

    Parameters

    Name Located in Description Required Type
    type path The @type of the link, for example Link, Tenant or Owner Yes string
    from_identity path The starting identity ID of the link Yes string
    to_identity path The ending identity ID of the link Yes string
    Authorization header The Authorization header, MUST be Bearer {{access_token}} Yes string

    Responses

    Code Description
    200
    404

    put

    Description: Update a link

    http request

    Do you need help in using the PUT /identities/v1/{from_identity}/link/{to_identity}/{type} ?

  • Checkout existing questions & answers
  • Ask a question in Stack Overflow

  • Did we miss something? Make a wish!
  •  

    Example for: PUT /identities/v1/{from_identity}/link/{to_identity}/{type}

    import requests
    
    headers={
        "Authorization" : "Bearer <ACCESS_TOKEN>",
        "Content-Type" : "application/json"
    }
    json={
        "context" : "https://example.com/contexts/type.jsonld",
        "type" : "Owner"
    }
    
    response = requests.put(
        'https://api-sandbox.oftrust.net/identities/v1/{from_identity}/link/{to_identity}/{type}',
        headers=headers,
        json=json
    )
    
    print({
        'raw_body': response.json(),
        'status': response.status_code,
        'code': response.status_code
    })
    
    
    curl -i -X PUT \
         -H "Authorization: Bearer <ACCESS_TOKEN>" \
         -H "Content-Type: application/json" \
         -d \
    "{
        \"context\" : \"https://example.com/contexts/type.jsonld\",
        \"type\" : \"Owner\"
    }" "https://api-sandbox.oftrust.net/identities/v1/{from_identity}/link/{to_identity}/{type}"
    
    const unirest = require("unirest");
    
    const headers = {
        "Authorization" : "Bearer <ACCESS_TOKEN>",
        "Content-Type" : "application/json"
    };
    const body = {
        "context" : "https://example.com/contexts/type.jsonld",
        "type" : "Owner"
    };
    
    unirest
      .put("https://api-sandbox.oftrust.net/identities/v1/{from_identity}/link/{to_identity}/{type}")
      .headers(headers)
      .send(body)
      .then(({ raw_body, status, code }) => {
        // output response to console as JSON
        console.log(JSON.stringify({ raw_body, status, code }, null, 4));
      });
    
    
    System.out.println("Java example missing. Why not contribute one for us?");
    

    The above example should return JSON structured like this:

    The above example should return JSON structured like this:
    
    HTTP/1.0 201
    
    {
      "@context": "https://standards.lifeengine.io/v1/Context/Link/Role/MemberOf",
      "@type": "MemberOf",
      "@id": "cf0862f6-3f4f-498f-97f1-fbe8b5734448",
      "from": "58dc29ab-d52e-4aab-a228-9b54e001797c",
      "to": "cf0862f6-3f4f-498f-97f1-fbe8b5734448",
      "data": {},
      "metadata": {
        "createdBy": "cf0862f6-3f4f-498f-97f1-fbe8b5734448",
        "updatedBy": "cf0862f6-3f4f-498f-97f1-fbe8b5734448",
        "createdAt": "2018-02-28T16:41:41.090Z",
        "updatedAt": "2018-02-28T16:41:41.090Z"
      }
    }
    
    
    

    PUT /identities/v1/{from_identity}/link/{to_identity}/{type}

    Parameters

    Name Located in Description Required Type
    type path The @type of the link, for example Link, Tenant or Owner Yes string
    from_identity path The starting identity ID of the link Yes string
    to_identity path The ending identity ID of the link Yes string
    Authorization header The Authorization header, MUST be Bearer {{access_token}} Yes string
    body body Yes

    Responses

    Code Description
    201
    404
    422

    delete

    Description: Delete a link by type

    http request

    Do you need help in using the DELETE /identities/v1/{from_identity}/link/{to_identity}/{type} ?

  • Checkout existing questions & answers
  • Ask a question in Stack Overflow

  • Did we miss something? Make a wish!
  •  

    Example for: DELETE /identities/v1/{from_identity}/link/{to_identity}/{type}

    import requests
    
    headers={
        "Authorization" : "Bearer <ACCESS_TOKEN>"
    }
    
    
    response = requests.delete(
        'https://api-sandbox.oftrust.net/identities/v1/{from_identity}/link/{to_identity}/{type}',
        headers=headers,
    )
    
    print({
        'raw_body': response.text,
        'status': response.status_code,
        'code': response.status_code
    })
    
    
    curl -i -X DELETE \
         -H "Authorization: Bearer <ACCESS_TOKEN>" "https://api-sandbox.oftrust.net/identities/v1/{from_identity}/link/{to_identity}/{type}"
    
    const unirest = require("unirest");
    
    const headers = {
        "Authorization" : "Bearer <ACCESS_TOKEN>"
    };
    
    
    unirest
      .delete("https://api-sandbox.oftrust.net/identities/v1/{from_identity}/link/{to_identity}/{type}")
      .headers(headers)
      .then(({ raw_body, status, code }) => {
        // output response to console as JSON
        console.log(JSON.stringify({ raw_body, status, code }, null, 4));
      });
    
    
    System.out.println("Java example missing. Why not contribute one for us?");
    

    The above example should return JSON structured like this:

    The above example should return JSON structured like this:
    
    HTTP/1.0 204
    
    {}
    
    

    DELETE /identities/v1/{from_identity}/link/{to_identity}/{type}

    Parameters

    Name Located in Description Required Type
    type path The @type of the link, for example Link, Tenant or Owner Yes string
    from_identity path The starting identity ID of the link Yes string
    to_identity path The ending identity ID of the link Yes string
    Authorization header The Authorization header, MUST be Bearer {{access_token}} Yes string

    Responses

    Code Description
    204
    404
    422

    get

    Description: List outbound links for a given identity

    http request

    Example for: GET /identities/v1/{id}/links

    import requests
    
    headers={
        "Authorization" : "Bearer <ACCESS_TOKEN>"
    }
    
    
    response = requests.get(
        'https://api-sandbox.oftrust.net/identities/v1/{id}/links',
        params='type=%2Fidentities%2F%7Bversion%7D%2F%7Bid%7D%2Flinks%3Ftype%3DOwner',
        headers=headers,
    )
    
    print({
        'raw_body': response.json(),
        'status': response.status_code,
        'code': response.status_code
    })
    
    
    curl -i -X GET \
         -H "Authorization: Bearer <ACCESS_TOKEN>" "https://api-sandbox.oftrust.net/identities/v1/{id}/links?type=%2Fidentities%2F%7Bversion%7D%2F%7Bid%7D%2Flinks%3Ftype%3DOwner"
    
    const unirest = require("unirest");
    
    const headers = {
        "Authorization" : "Bearer <ACCESS_TOKEN>"
    };
    
    
    unirest
      .get("https://api-sandbox.oftrust.net/identities/v1/{id}/links")
      .headers(headers)
      .query("type=%2Fidentities%2F%7Bversion%7D%2F%7Bid%7D%2Flinks%3Ftype%3DOwner")
      .then(({ raw_body, status, code }) => {
        // output response to console as JSON
        console.log(JSON.stringify({ raw_body, status, code }, null, 4));
      });
    
    
    System.out.println("Java example missing. Why not contribute one for us?");
    

    The above example should return JSON structured like this:

    The above example should return JSON structured like this:
    
    HTTP/1.0 200
    
    {
      "@context": "https://schema.org/",
      "@type": "collection",
      "ItemList": [
        {
          "@context": "https://standards.lifeengine.io/v1/Context/Link/Role/MemberOf",
          "@type": "MemberOf",
          "@id": "cf0862f6-3f4f-498f-97f1-fbe8b5734448",
          "from": "58dc29ab-d52e-4aab-a228-9b54e001797c",
          "to": "cf0862f6-3f4f-498f-97f1-fbe8b5734448",
          "data": {},
          "metadata": {
            "createdBy": "cf0862f6-3f4f-498f-97f1-fbe8b5734448",
            "updatedBy": "cf0862f6-3f4f-498f-97f1-fbe8b5734448",
            "createdAt": "2018-02-28T16:41:41.090Z",
            "updatedAt": "2018-02-28T16:41:41.090Z"
          }
        },
        {
          "@context": "https://standards.lifeengine.io/v1/Context/Link/Role/MemberOf",
          "@type": "MemberOf",
          "@id": "cf0862f6-3f4f-498f-97f1-fbe8b5734448",
          "from": "58dc29ab-d52e-4aab-a228-9b54e001797c",
          "to": "cf0862f6-3f4f-498f-97f1-fbe8b5734448",
          "data": {},
          "metadata": {
            "createdBy": "cf0862f6-3f4f-498f-97f1-fbe8b5734448",
            "updatedBy": "cf0862f6-3f4f-498f-97f1-fbe8b5734448",
            "createdAt": "2018-02-28T16:41:41.090Z",
            "updatedAt": "2018-02-28T16:41:41.090Z"
          }
        }
      ]
    }
    
    
    

    GET /identities/v1/{id}/links

    Parameters

    Name Located in Description Required Type
    id path The ID of the identity Yes string
    Authorization header The Authorization header, MUST be Bearer {{access_token}} Yes string
    type query If given to GET /identities/v1/{id}/links?type=Owner, will list only the links of @type: "Owner" No string

    Responses

    Code Description
    200
    404

    Message API

    Get Message API related resources:

    The message API provides means to create/send messages to identities. You can send a message to any identity, e.g. a housing company, where all users who has access to the housing company identity and its messages can read the message.

    The message requires a "to"-identity, the ID of the identity to which the message applies to. A message subject and its content should be added as well.

    The cc is a list of user IDs to whom the message can be CC'd to. A notification about the message will be sent to these users.

    Version: v1

    /messages/v1

    post

    Description: Create a new message

    http request

    Example for: POST /messages/v1

    import requests
    
    headers={
        "Authorization" : "Bearer <ACCESS_TOKEN>",
        "Content-Type" : "application/json"
    }
    json={
        "toIdentity" : "0920a84a-1548-4644-b95d-e3f80e1b9ca6",
        "subject" : "Go to the grocery store",
        "content" : "Remember to buy milk!",
        "cc" : [ "323bde80-4cc2-472e-bb77-e6a3e95a1253", "0827e9c3-9664-479f-b0ec-956a35d72e4b" ]
    }
    
    response = requests.post(
        'https://api-sandbox.oftrust.net/messages/{version}',
        headers=headers,
        json=json
    )
    
    print({
        'raw_body': response.json(),
        'status': response.status_code,
        'code': response.status_code
    })
    
    
    curl -i -X POST \
         -H "Authorization: Bearer <ACCESS_TOKEN>" \
         -H "Content-Type: application/json" \
         -d \
    "{
        \"toIdentity\" : \"0920a84a-1548-4644-b95d-e3f80e1b9ca6\",
        \"subject\" : \"Go to the grocery store\",
        \"content\" : \"Remember to buy milk!\",
        \"cc\" : [ \"323bde80-4cc2-472e-bb77-e6a3e95a1253\", \"0827e9c3-9664-479f-b0ec-956a35d72e4b\" ]
    }" "https://api-sandbox.oftrust.net/messages/{version}"
    
    const unirest = require("unirest");
    
    const headers = {
        "Authorization" : "Bearer <ACCESS_TOKEN>",
        "Content-Type" : "application/json"
    };
    const body = {
        "toIdentity" : "0920a84a-1548-4644-b95d-e3f80e1b9ca6",
        "subject" : "Go to the grocery store",
        "content" : "Remember to buy milk!",
        "cc" : [ "323bde80-4cc2-472e-bb77-e6a3e95a1253", "0827e9c3-9664-479f-b0ec-956a35d72e4b" ]
    };
    
    unirest
      .post("https://api-sandbox.oftrust.net/messages/{version}")
      .headers(headers)
      .send(body)
      .then(({ raw_body, status, code }) => {
        // output response to console as JSON
        console.log(JSON.stringify({ raw_body, status, code }, null, 4));
      });
    
    
    System.out.println("Java example missing. Why not contribute one for us?");
    

    The above example should return JSON structured like this:

    The above example should return JSON structured like this:
    
    HTTP/1.0 201
    
    {
      "@context": "https://standards.lifeengine.io/v1/Context/Message",
      "@type": "Message",
      "toIdentity": "0920a84a-1548-4644-b95d-e3f80e1b9ca6",
      "subject": "Go to the grocery store",
      "content": "Remember to buy milk!",
      "cc": [
        "323bde80-4cc2-472e-bb77-e6a3e95a1253",
        "0827e9c3-9664-479f-b0ec-956a35d72e4b"
      ],
      "createdAt": "2019-01-10T12:00:00Z",
      "updatedAt": "2019-01-10T12:00:00Z",
      "createdBy": "58422496-5796-4c47-a4a1-88768ea94ea6"
    }
    
    
    

    POST /messages/v1

    Parameters

    Name Located in Description Required Type
    version path Yes string
    Authorization header The Authorization header, MUST be Bearer {{access_token}} Yes string
    body body Yes

    Responses

    Code Description
    201
    422

    /messages/v1/{id}

    get

    Description: Read one message by id

    http request

    Example for: GET /messages/v1/{id}

    import requests
    
    headers={
        "Authorization" : "Bearer <ACCESS_TOKEN>"
    }
    
    
    response = requests.get(
        'https://api-sandbox.oftrust.net/messages/{version}/{id}',
        headers=headers,
    )
    
    print({
        'raw_body': response.json(),
        'status': response.status_code,
        'code': response.status_code
    })
    
    
    curl -i -X GET \
         -H "Authorization: Bearer <ACCESS_TOKEN>" "https://api-sandbox.oftrust.net/messages/{version}/{id}"
    
    const unirest = require("unirest");
    
    const headers = {
        "Authorization" : "Bearer <ACCESS_TOKEN>"
    };
    
    
    unirest
      .get("https://api-sandbox.oftrust.net/messages/{version}/{id}")
      .headers(headers)
      .then(({ raw_body, status, code }) => {
        // output response to console as JSON
        console.log(JSON.stringify({ raw_body, status, code }, null, 4));
      });
    
    
    System.out.println("Java example missing. Why not contribute one for us?");
    

    The above example should return JSON structured like this:

    The above example should return JSON structured like this:
    
    HTTP/1.0 200
    
    {
      "@context": "https://standards.lifeengine.io/v1/Context/Message",
      "@type": "Message",
      "toIdentity": "0920a84a-1548-4644-b95d-e3f80e1b9ca6",
      "subject": "Go to the grocery store",
      "content": "Remember to buy milk!",
      "cc": [
        "323bde80-4cc2-472e-bb77-e6a3e95a1253",
        "0827e9c3-9664-479f-b0ec-956a35d72e4b"
      ],
      "createdAt": "2019-01-10T12:00:00Z",
      "updatedAt": "2019-01-10T12:00:00Z",
      "createdBy": "58422496-5796-4c47-a4a1-88768ea94ea6"
    }
    
    
    

    GET /messages/v1/{id}

    Parameters

    Name Located in Description Required Type
    id path The ID of the message Yes string
    version path Yes string
    Authorization header The Authorization header, MUST be Bearer {{access_token}} Yes string

    Responses

    Code Description
    200
    404

    put

    Description: Update a message by id

    http request

    Example for: PUT /messages/v1/{id}

    import requests
    
    headers={
        "Authorization" : "Bearer <ACCESS_TOKEN>",
        "Content-Type" : "application/json"
    }
    json={
        "subject" : "Go to the grocery store",
        "content" : "Remember to buy milk!"
    }
    
    response = requests.put(
        'https://api-sandbox.oftrust.net/messages/{version}/{id}',
        headers=headers,
        json=json
    )
    
    print({
        'raw_body': response.json(),
        'status': response.status_code,
        'code': response.status_code
    })
    
    
    curl -i -X PUT \
         -H "Authorization: Bearer <ACCESS_TOKEN>" \
         -H "Content-Type: application/json" \
         -d \
    "{
        \"subject\" : \"Go to the grocery store\",
        \"content\" : \"Remember to buy milk!\"
    }" "https://api-sandbox.oftrust.net/messages/{version}/{id}"
    
    const unirest = require("unirest");
    
    const headers = {
        "Authorization" : "Bearer <ACCESS_TOKEN>",
        "Content-Type" : "application/json"
    };
    const body = {
        "subject" : "Go to the grocery store",
        "content" : "Remember to buy milk!"
    };
    
    unirest
      .put("https://api-sandbox.oftrust.net/messages/{version}/{id}")
      .headers(headers)
      .send(body)
      .then(({ raw_body, status, code }) => {
        // output response to console as JSON
        console.log(JSON.stringify({ raw_body, status, code }, null, 4));
      });
    
    
    System.out.println("Java example missing. Why not contribute one for us?");
    

    The above example should return JSON structured like this:

    The above example should return JSON structured like this:
    
    HTTP/1.0 200
    
    {
      "@context": "https://standards.lifeengine.io/v1/Context/Message",
      "@type": "Message",
      "toIdentity": "0920a84a-1548-4644-b95d-e3f80e1b9ca6",
      "subject": "Go to the grocery store",
      "content": "Remember to buy milk!",
      "cc": [
        "323bde80-4cc2-472e-bb77-e6a3e95a1253",
        "0827e9c3-9664-479f-b0ec-956a35d72e4b"
      ],
      "createdAt": "2019-01-10T12:00:00Z",
      "updatedAt": "2019-01-10T12:00:00Z",
      "createdBy": "58422496-5796-4c47-a4a1-88768ea94ea6"
    }
    
    
    

    PUT /messages/v1/{id}

    Parameters

    Name Located in Description Required Type
    id path The ID of the message Yes string
    version path Yes string
    Authorization header The Authorization header, MUST be Bearer {{access_token}} Yes string
    body body Yes

    Responses

    Code Description
    200
    404
    422

    delete

    Description: Delete a message by id

    http request

    Example for: DELETE /messages/v1/{id}

    import requests
    
    headers={
        "Authorization" : "Bearer <ACCESS_TOKEN>"
    }
    
    
    response = requests.delete(
        'https://api-sandbox.oftrust.net/messages/{version}/{id}',
        headers=headers,
    )
    
    print({
        'raw_body': response.text,
        'status': response.status_code,
        'code': response.status_code
    })
    
    
    curl -i -X DELETE \
         -H "Authorization: Bearer <ACCESS_TOKEN>" "https://api-sandbox.oftrust.net/messages/{version}/{id}"
    
    const unirest = require("unirest");
    
    const headers = {
        "Authorization" : "Bearer <ACCESS_TOKEN>"
    };
    
    
    unirest
      .delete("https://api-sandbox.oftrust.net/messages/{version}/{id}")
      .headers(headers)
      .then(({ raw_body, status, code }) => {
        // output response to console as JSON
        console.log(JSON.stringify({ raw_body, status, code }, null, 4));
      });
    
    
    System.out.println("Java example missing. Why not contribute one for us?");
    

    The above example should return JSON structured like this:

    The above example should return JSON structured like this:
    
    HTTP/1.0 204
    
    {}
    
    

    DELETE /messages/v1/{id}

    Parameters

    Name Located in Description Required Type
    id path The ID of the message Yes string
    version path Yes string
    Authorization header The Authorization header, MUST be Bearer {{access_token}} Yes string

    Responses

    Code Description
    204
    404

    /messages/v1/{id}/read

    post

    Description: Marks a message read by the currently logged in user.

    http request

    Example for: POST /messages/v1/{id}/read

    import requests
    
    headers={
        "Authorization" : "Bearer <ACCESS_TOKEN>"
    }
    
    
    response = requests.post(
        'https://api-sandbox.oftrust.net/messages/{version}/{id}/read',
        headers=headers,
    )
    
    print({
        'raw_body': response.json(),
        'status': response.status_code,
        'code': response.status_code
    })
    
    
    curl -i -X POST \
         -H "Authorization: Bearer <ACCESS_TOKEN>" "https://api-sandbox.oftrust.net/messages/{version}/{id}/read"
    
    const unirest = require("unirest");
    
    const headers = {
        "Authorization" : "Bearer <ACCESS_TOKEN>"
    };
    
    
    unirest
      .post("https://api-sandbox.oftrust.net/messages/{version}/{id}/read")
      .headers(headers)
      .then(({ raw_body, status, code }) => {
        // output response to console as JSON
        console.log(JSON.stringify({ raw_body, status, code }, null, 4));
      });
    
    
    System.out.println("Java example missing. Why not contribute one for us?");
    

    The above example should return JSON structured like this:

    The above example should return JSON structured like this:
    
    HTTP/1.0 200
    
    {}
    
    

    POST /messages/v1/{id}/read

    Parameters

    Name Located in Description Required Type
    id path The ID of the message Yes string
    version path Yes string
    Authorization header The Authorization header, MUST be Bearer {{access_token}} Yes string

    Responses

    Code Description
    200
    403

    /messages/v1/{toidentity}/list

    get

    Description: List messages sent to "to"-identity.

    http request

    Example for: GET /messages/v1/{toIdentity}/list

    import requests
    
    headers={
        "Authorization" : "Bearer <ACCESS_TOKEN>"
    }
    
    
    response = requests.get(
        'https://api-sandbox.oftrust.net/messages/{version}/{toIdentity}/list',
        headers=headers,
    )
    
    print({
        'raw_body': response.json(),
        'status': response.status_code,
        'code': response.status_code
    })
    
    
    curl -i -X GET \
         -H "Authorization: Bearer <ACCESS_TOKEN>" "https://api-sandbox.oftrust.net/messages/{version}/{toIdentity}/list"
    
    const unirest = require("unirest");
    
    const headers = {
        "Authorization" : "Bearer <ACCESS_TOKEN>"
    };
    
    
    unirest
      .get("https://api-sandbox.oftrust.net/messages/{version}/{toIdentity}/list")
      .headers(headers)
      .then(({ raw_body, status, code }) => {
        // output response to console as JSON
        console.log(JSON.stringify({ raw_body, status, code }, null, 4));
      });
    
    
    System.out.println("Java example missing. Why not contribute one for us?");
    

    The above example should return JSON structured like this:

    The above example should return JSON structured like this:
    
    HTTP/1.0 200
    
    {
      "@context": "https://schema.org/",
      "@type": "collection",
      "ItemList": [
        {
          "@context": "https://standards.lifeengine.io/v1/Context/Message",
          "@type": "Message",
          "toIdentity": "0920a84a-1548-4644-b95d-e3f80e1b9ca6",
          "subject": "Go to the grocery store",
          "content": "Remember to buy milk!",
          "cc": [
            "323bde80-4cc2-472e-bb77-e6a3e95a1253",
            "0827e9c3-9664-479f-b0ec-956a35d72e4b"
          ],
          "createdAt": "2019-01-10T12:00:00Z",
          "updatedAt": "2019-01-10T12:00:00Z",
          "createdBy": "58422496-5796-4c47-a4a1-88768ea94ea6"
        },
        {
          "@context": "https://standards.lifeengine.io/v1/Context/Message",
          "@type": "Message",
          "toIdentity": "0920a84a-1548-4644-b95d-e3f80e1b9ca6",
          "subject": "You forgot the milk",
          "content": "...",
          "cc": [
            "323bde80-4cc2-472e-bb77-e6a3e95a1253",
            "0827e9c3-9664-479f-b0ec-956a35d72e4b"
          ],
          "createdAt": "2019-01-10T12:00:00Z",
          "updatedAt": "2019-01-10T12:00:00Z",
          "createdBy": "58422496-5796-4c47-a4a1-88768ea94ea6"
        }
      ]
    }
    
    
    

    GET /messages/v1/{toIdentity}/list

    Parameters

    Name Located in Description Required Type
    toIdentity path The identity to which the message belongs to. Yes string
    version path Yes string
    Authorization header The Authorization header, MUST be Bearer {{access_token}} Yes string

    Responses

    Code Description
    200

    Product API

    Get Product API related resources:

    The Product API provides means to manage products provided by PoT core. The product defines the URL to the translator, as well as a product code to use when requesting data from the translator.

    Version: v1

    /products/v1

    post

    Description: Create a new product

    http request

    Example for: POST /products/v1

    import requests
    
    headers={
        "Authorization" : "Bearer <ACCESS_TOKEN>",
        "Content-Type" : "application/json"
    }
    json={
        "groupId" : "0a52c776-1c9c-42b1-ac03-b64c04abded2",
        "imageUrl" : "https://example.com/product-image.png",
        "name" : "Product name",
        "translatorUrl" : "https://example.com/translator",
        "organizationPublicKeys" : [ {
            "url" : "https://example.com/public-key.pub",
            "type" : "RsaSignature2018"
        }, {
            "url" : "https://example.com/public-key-2.pub",
            "type" : "RsaSignature2018"
        } ],
        "dataContext" : "https://example.com/v1/Context/Data",
        "productCode" : "product-1",
        "description" : "This is a product that returns the temperature data for ...",
        "parameterContext" : "https://example.com/v1/Context/Parameter"
    }
    
    response = requests.post(
        'https://api-sandbox.oftrust.net/products/{version}',
        headers=headers,
        json=json
    )
    
    print({
        'raw_body': response.json(),
        'status': response.status_code,
        'code': response.status_code
    })
    
    
    curl -i -X POST \
         -H "Authorization: Bearer <ACCESS_TOKEN>" \
         -H "Content-Type: application/json" \
         -d \
    "{
        \"groupId\" : \"0a52c776-1c9c-42b1-ac03-b64c04abded2\",
        \"imageUrl\" : \"https://example.com/product-image.png\",
        \"name\" : \"Product name\",
        \"translatorUrl\" : \"https://example.com/translator\",
        \"organizationPublicKeys\" : [ {
            \"url\" : \"https://example.com/public-key.pub\",
            \"type\" : \"RsaSignature2018\"
        }, {
            \"url\" : \"https://example.com/public-key-2.pub\",
            \"type\" : \"RsaSignature2018\"
        } ],
        \"dataContext\" : \"https://example.com/v1/Context/Data\",
        \"productCode\" : \"product-1\",
        \"description\" : \"This is a product that returns the temperature data for ...\",
        \"parameterContext\" : \"https://example.com/v1/Context/Parameter\"
    }" "https://api-sandbox.oftrust.net/products/{version}"
    
    const unirest = require("unirest");
    
    const headers = {
        "Authorization" : "Bearer <ACCESS_TOKEN>",
        "Content-Type" : "application/json"
    };
    const body = {
        "groupId" : "0a52c776-1c9c-42b1-ac03-b64c04abded2",
        "imageUrl" : "https://example.com/product-image.png",
        "name" : "Product name",
        "translatorUrl" : "https://example.com/translator",
        "organizationPublicKeys" : [ {
            "url" : "https://example.com/public-key.pub",
            "type" : "RsaSignature2018"
        }, {
            "url" : "https://example.com/public-key-2.pub",
            "type" : "RsaSignature2018"
        } ],
        "dataContext" : "https://example.com/v1/Context/Data",
        "productCode" : "product-1",
        "description" : "This is a product that returns the temperature data for ...",
        "parameterContext" : "https://example.com/v1/Context/Parameter"
    };
    
    unirest
      .post("https://api-sandbox.oftrust.net/products/{version}")
      .headers(headers)
      .send(body)
      .then(({ raw_body, status, code }) => {
        // output response to console as JSON
        console.log(JSON.stringify({ raw_body, status, code }, null, 4));
      });
    
    
    System.out.println("Java example missing. Why not contribute one for us?");
    

    The above example should return JSON structured like this:

    The above example should return JSON structured like this:
    
    HTTP/1.0 201
    
    {
      "@context": "https://standards.lifeengine.io/v1/Context/Identity/Thing/HumanWorld/Product/DataProduct",
      "@type": "DataProduct",
      "@id": "https://api-sandbox.oftrust.net/products/v1/product-1",
      "productCode": "product-1",
      "dataContext": "https://example.com/v1/Context/Data",
      "parameterContext": "https://example.com/v1/Context/Parameter",
      "translatorUrl": "https://translator.example.com/fetch-data-product",
      "name": "Product name",
      "organizationPublicKeys": [
        {
          "url": "https://example.com/public-key.pub",
          "type": "RsaSignature2018"
        },
        {
          "url": "https://example.com/public-key-2.pub",
          "type": "RsaSignature2018"
        }
      ],
      "description": "This is a product that returns the temperature data for ...",
      "imageUrl": "https://example.com/product-image.png",
      "identityId": "31b5b971-dc50-4c9c-992a-57c0bf016186"
    }
    
    
    

    POST /products/v1

    Parameters

    Name Located in Description Required Type
    version path Yes string
    Authorization header The Authorization header, MUST be Bearer {{access_token}} Yes string
    body body Yes

    Responses

    Code Description
    201
    422

    get

    Description: Lists all available products. NOTE: This is a CORS enabled endpoint. Supports pagination.

    http request

    Example for: GET /products/v1

    import requests
    
    
    
    
    response = requests.get(
        'https://api-sandbox.oftrust.net/products/{version}',
        params='offset=200&limit=400',
    )
    
    print({
        'raw_body': response.json(),
        'status': response.status_code,
        'code': response.status_code
    })
    
    
    curl -i -X GET "https://api-sandbox.oftrust.net/products/{version}?offset=200&limit=400"
    
    const unirest = require("unirest");
    
    
    
    
    unirest
      .get("https://api-sandbox.oftrust.net/products/{version}")
      .query("offset=200&limit=400")
      .then(({ raw_body, status, code }) => {
        // output response to console as JSON
        console.log(JSON.stringify({ raw_body, status, code }, null, 4));
      });
    
    
    System.out.println("Java example missing. Why not contribute one for us?");
    

    The above example should return JSON structured like this:

    The above example should return JSON structured like this:
    
    HTTP/1.0 200
    
    {
      "@context": "https://schema.org/",
      "@type": "collection",
      "ItemList": [
        {
          "@context": "https://standards.lifeengine.io/v1/Context/Identity/Thing/HumanWorld/Product/DataProduct",
          "@type": "DataProduct",
          "@id": "https://api-sandbox.oftrust.net/products/v1/product-1",
          "productCode": "product-1",
          "dataContext": "https://example.com/v1/Context/Data",
          "parameterContext": "https://example.com/v1/Context/Parameter",
          "translatorUrl": "https://translator.example.com/fetch-data-product",
          "name": "Product name",
          "organizationPublicKeys": [
            {
              "url": "https://example.com/public-key.pub",
              "type": "RsaSignature2018"
            },
            {
              "url": "https://example.com/public-key-2.pub",
              "type": "RsaSignature2018"
            }
          ],
          "description": "This is a product that returns the temperature data for ...",
          "imageUrl": "https://example.com/product-image.png",
          "identityId": "31b5b971-dc50-4c9c-992a-57c0bf016186"
        },
        {
          "@context": "https://standards.lifeengine.io/v1/Context/Identity/Thing/HumanWorld/Product/DataProduct",
          "@type": "DataProduct",
          "@id": "https://api-sandbox.oftrust.net/products/v1/product-2",
          "productCode": "product-2",
          "dataContext": "https://example.com/v1/Context/Data",
          "parameterContext": "https://example.com/v1/Context/Parameter",
          "translatorUrl": "https://translator.example.com/fetch",
          "name": "Product name example",
          "organizationPublicKeys": [
            {
              "url": "https://example.com/public-key.pub",
              "type": "RsaSignature2018"
            },
            {
              "url": "https://example.com/public-key-2.pub",
              "type": "RsaSignature2018"
            }
          ],
          "description": "This is a product that returns the maintenance history data for ...",
          "imageUrl": "https://example.com/product-image.png",
          "identityId": "f4902768-39aa-492d-9d4f-99b5cf13ee2b"
        }
      ],
      "links": [
        {
          "rel": "first",
          "href": "<API URL>/products?offset=0&limit=2"
        },
        {
          "rel": "self",
          "href": "<API URL>/products"
        },
        {
          "rel": "last",
          "href": "<API URL>/products?offset=2&limit=2"
        },
        {
          "rel": "next",
          "href": "<API URL>/products?offset=2&limit=2"
        }
      ],
      "hasMore": true
    }
    
    
    

    GET /products/v1

    Parameters

    Name Located in Description Required Type
    version path Yes string
    offset query Offset of a query No integer
    limit query Limit the result of a query No integer

    Responses

    Code Description
    200

    /products/v1/{product_code}

    get

    Description: Reads a single product by product code. NOTE: This is a CORS enabled endpoint.

    http request

    Example for: GET /products/v1/{product_code}

    import requests
    
    
    
    
    response = requests.get(
        'https://api-sandbox.oftrust.net/products/{version}/{product_code}',
    )
    
    print({
        'raw_body': response.json(),
        'status': response.status_code,
        'code': response.status_code
    })
    
    
    curl -i -X GET "https://api-sandbox.oftrust.net/products/{version}/{product_code}"
    
    const unirest = require("unirest");
    
    
    
    
    unirest
      .get("https://api-sandbox.oftrust.net/products/{version}/{product_code}")
      .then(({ raw_body, status, code }) => {
        // output response to console as JSON
        console.log(JSON.stringify({ raw_body, status, code }, null, 4));
      });
    
    
    System.out.println("Java example missing. Why not contribute one for us?");
    

    The above example should return JSON structured like this:

    The above example should return JSON structured like this:
    
    HTTP/1.0 200
    
    {
      "@context": "https://standards.lifeengine.io/v1/Context/Identity/Thing/HumanWorld/Product/DataProduct",
      "@type": "DataProduct",
      "@id": "https://api-sandbox.oftrust.net/products/v1/product-1",
      "productCode": "product-1",
      "dataContext": "https://example.com/v1/Context/Data",
      "parameterContext": "https://example.com/v1/Context/Parameter",
      "translatorUrl": "https://translator.example.com/fetch-data-product",
      "name": "Product name",
      "organizationPublicKeys": [
        {
          "url": "https://example.com/public-key.pub",
          "type": "RsaSignature2018"
        },
        {
          "url": "https://example.com/public-key-2.pub",
          "type": "RsaSignature2018"
        }
      ],
      "description": "This is a product that returns the temperature data for ...",
      "imageUrl": "https://example.com/product-image.png",
      "identityId": "31b5b971-dc50-4c9c-992a-57c0bf016186"
    }
    
    
    

    GET /products/v1/{product_code}

    Parameters

    Name Located in Description Required Type
    product_code path The product code of the product. Yes string
    version path Yes string

    Responses

    Code Description
    200
    404

    put

    Description: Update a product by product code

    http request

    Example for: PUT /products/v1/{product_code}

    import requests
    
    headers={
        "Authorization" : "Bearer <ACCESS_TOKEN>",
        "Content-Type" : "application/json"
    }
    json={
        "dataContext" : "https://example.com/v1/Context/Data",
        "parameterContext" : "https://example.com/v1/Context/Parameter",
        "productCode" : "product-1",
        "name" : "Product name",
        "translatorUrl" : "https://example.com/translator",
        "organizationPublicKeys" : [ {
            "url" : "https://example.com/public-key.pub",
            "type" : "RsaSignature2018"
        }, {
            "url" : "https://example.com/public-key-2.pub",
            "type" : "RsaSignature2018"
        } ],
        "imageUrl" : "https://example.com/product-image.png",
        "description" : "This is a product that returns the temperature data for ..."
    }
    
    response = requests.put(
        'https://api-sandbox.oftrust.net/products/{version}/{product_code}',
        headers=headers,
        json=json
    )
    
    print({
        'raw_body': response.json(),
        'status': response.status_code,
        'code': response.status_code
    })
    
    
    curl -i -X PUT \
         -H "Authorization: Bearer <ACCESS_TOKEN>" \
         -H "Content-Type: application/json" \
         -d \
    "{
        \"dataContext\" : \"https://example.com/v1/Context/Data\",
        \"parameterContext\" : \"https://example.com/v1/Context/Parameter\",
        \"productCode\" : \"product-1\",
        \"name\" : \"Product name\",
        \"translatorUrl\" : \"https://example.com/translator\",
        \"organizationPublicKeys\" : [ {
            \"url\" : \"https://example.com/public-key.pub\",
            \"type\" : \"RsaSignature2018\"
        }, {
            \"url\" : \"https://example.com/public-key-2.pub\",
            \"type\" : \"RsaSignature2018\"
        } ],
        \"imageUrl\" : \"https://example.com/product-image.png\",
        \"description\" : \"This is a product that returns the temperature data for ...\"
    }" "https://api-sandbox.oftrust.net/products/{version}/{product_code}"
    
    const unirest = require("unirest");
    
    const headers = {
        "Authorization" : "Bearer <ACCESS_TOKEN>",
        "Content-Type" : "application/json"
    };
    const body = {
        "dataContext" : "https://example.com/v1/Context/Data",
        "parameterContext" : "https://example.com/v1/Context/Parameter",
        "productCode" : "product-1",
        "name" : "Product name",
        "translatorUrl" : "https://example.com/translator",
        "organizationPublicKeys" : [ {
            "url" : "https://example.com/public-key.pub",
            "type" : "RsaSignature2018"
        }, {
            "url" : "https://example.com/public-key-2.pub",
            "type" : "RsaSignature2018"
        } ],
        "imageUrl" : "https://example.com/product-image.png",
        "description" : "This is a product that returns the temperature data for ..."
    };
    
    unirest
      .put("https://api-sandbox.oftrust.net/products/{version}/{product_code}")
      .headers(headers)
      .send(body)
      .then(({ raw_body, status, code }) => {
        // output response to console as JSON
        console.log(JSON.stringify({ raw_body, status, code }, null, 4));
      });
    
    
    System.out.println("Java example missing. Why not contribute one for us?");
    

    The above example should return JSON structured like this:

    The above example should return JSON structured like this:
    
    HTTP/1.0 200
    
    {
      "@context": "https://standards.lifeengine.io/v1/Context/Identity/Thing/HumanWorld/Product/DataProduct",
      "@type": "DataProduct",
      "@id": "https://api-sandbox.oftrust.net/products/v1/product-1",
      "productCode": "product-1",
      "dataContext": "https://example.com/v1/Context/Data",
      "parameterContext": "https://example.com/v1/Context/Parameter",
      "translatorUrl": "https://translator.example.com/fetch-data-product",
      "name": "Product name",
      "organizationPublicKeys": [
        {
          "url": "https://example.com/public-key.pub",
          "type": "RsaSignature2018"
        },
        {
          "url": "https://example.com/public-key-2.pub",
          "type": "RsaSignature2018"
        }
      ],
      "description": "This is a product that returns the temperature data for ...",
      "imageUrl": "https://example.com/product-image.png",
      "identityId": "31b5b971-dc50-4c9c-992a-57c0bf016186"
    }
    
    
    

    PUT /products/v1/{product_code}

    Parameters

    Name Located in Description Required Type
    product_code path The product code of the product. Yes string
    version path Yes string
    Authorization header The Authorization header, MUST be Bearer {{access_token}} Yes string
    body body Yes

    Responses

    Code Description
    200
    404
    422

    delete

    Description: Delete a product by product code

    http request

    Example for: DELETE /products/v1/{product_code}

    import requests
    
    headers={
        "Authorization" : "Bearer <ACCESS_TOKEN>"
    }
    
    
    response = requests.delete(
        'https://api-sandbox.oftrust.net/products/{version}/{product_code}',
        headers=headers,
    )
    
    print({
        'raw_body': response.text,
        'status': response.status_code,
        'code': response.status_code
    })
    
    
    curl -i -X DELETE \
         -H "Authorization: Bearer <ACCESS_TOKEN>" "https://api-sandbox.oftrust.net/products/{version}/{product_code}"
    
    const unirest = require("unirest");
    
    const headers = {
        "Authorization" : "Bearer <ACCESS_TOKEN>"
    };
    
    
    unirest
      .delete("https://api-sandbox.oftrust.net/products/{version}/{product_code}")
      .headers(headers)
      .then(({ raw_body, status, code }) => {
        // output response to console as JSON
        console.log(JSON.stringify({ raw_body, status, code }, null, 4));
      });
    
    
    System.out.println("Java example missing. Why not contribute one for us?");
    

    The above example should return JSON structured like this:

    The above example should return JSON structured like this:
    
    HTTP/1.0 204
    
    {}
    
    

    DELETE /products/v1/{product_code}

    Parameters

    Name Located in Description Required Type
    product_code path The product code of the product. Yes string
    version path Yes string
    Authorization header The Authorization header, MUST be Bearer {{access_token}} Yes string

    Responses

    Code Description
    204
    404

    Authentication

    Platform of Trust authentication is OAuth2 based. It's typically a good idea to explain the whole authentication process, because even to this day not everyone is familiar with how they work. In a nutshell this is what we use

    Example how Bearer is expected to be used in headers.

    import sys
    sys.stdout.write("Python example missing. Why not contribute one for us?")
    
    curl https://api-sandbox.oftrust.net/messages/v1/3a9e31ff-b654-4069-8361-6b446dc04c95 \
    -H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJzY29w...DVs5aaf"
    
    console.error("Javascript example missing. Why not contribute one for us?");
    
    System.out.println("Java example missing. Why not contribute one for us?");
    

    Use Bearer token and how to get it?

    You have two options how to obtain Bearer token depending of your needs.

    To learn and get familiar with APIS:

    Here's an example from Chrome Browser DevTools

    Chrome cookie

    For production:

    Most of the APIs require bearer token in header ("Authorization: Bearer"). Exceptions to the rule are CORS enabled endpoints and Broker API.

    Exception 1: CORS enabled APIs

    APIs with CORS enabled endpoints which do not require any tokens:

    Example how Broker API headers are expected to be given.

    import sys
    sys.stdout.write("Python example missing. Why not contribute one for us?")
    
    curl -X POST https://api-sandbox.oftrust.net/broker/v1/fetch-data-product \
    -H "Content-Type: application/json" \
    -H "X-Pot-Signature: Ioma1gqOVFUBrXiziWSCLqBG4vFozG3YgzPzillNip0=" \
    -H "X-Pot-App: 379780e4-b511-4fa9-aef8-bda9bd58ab89" \
    -H "X-Pot-Token: eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJzY29w...DVs5aaf" \
    
    console.error("Javascript example missing. Why not contribute one for us?");
    
    System.out.println("Java example missing. Why not contribute one for us?");
    

    Exception 2: Broker API

    Second exception is the Broker API is a bit more complex and requires header parameters:

    Read more from Broker API.

    Get client credentials

    Before jumping into development you might want to get the client credentials. Getting those now let's you jump into code level testing right away without detours.
    For each application you develop, you need to obtain new client credentials. These include a client identifier and a client shared-secret.

    Recommended next step is to register new app:

    1. Login to World app and initiate new application registration.
    2. Fill in the required information and submit.
    3. Upon successful application registration, you will be shown client credentials.

    Authentication code example

    Now you have client credentials and you can start fiddling code and run you app in our sandbox environment. Code speaks for it self! Thus we have open source (MIT license) React sample app which contains authentication implementation among other things. You can clone the sample app from Github.

    Errors

    The Platform of Trust APIs all use the following error codes:

    Error Code Meaning
    400 Bad Request -- Your request is invalid.
    401 Unauthorized -- Your API key is wrong.
    403 Forbidden -- The item requested is hidden for administrators only.
    404 Not Found -- The specified item could not be found.
    405 Method Not Allowed -- You tried to access item with an invalid method.
    406 Not Acceptable -- You requested a format that isn't json.
    410 Gone -- The requested item has been removed from our servers.
    422 Unprocessable -- Entity is missing
    429 Too Many Requests -- You're requesting too many times! Slow down!
    500 Internal Server Error -- We had a problem with our server. Try again later.
    503 Service Unavailable -- We're temporarily offline for maintenance. Please try again later.

    Feedback

    If you found a bug or missing information in the documentation, contact us at dev@oftrust.net or create an issue in Github.