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
Make use of previously asked questions in Stack Overflow
Create new question in Stack Overflow if it's "How do I?" or "I got this error, why?" type of question
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.
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.
First create an account in sandbox version of World app. If you have an account in production environment, that does not work in the sandbox environment.
You should get familiar with Authentication process regardless of are you integration data sources or building applications.
Related to authentication is the Bearer Token which is needed in some of the API calls. Check out the How to get Bearer token?
Some of the API endpoints are CORS enabled and they are marked in the description.
Another thing to understand is the harmonised data models. We recommend that you get familiar with core ontologies especially if you are integrating data sources to the Platform of Trust.
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 from https://standards.oftrust.net/v1/.
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 https://standards.oftrust.net/v1/
ACL
Get ACL related resources:
The ACL API provides means for managing access control list of identities.
Version: v1
/acl/v1/{from_identity}/{target_identity}
post
Description: Set permissions. Will give the from identity read, write, link and/or manage access to the to target identity. If any type of privilege (read, write, link, manage or consume) is left out or set to null, then it will remain unchanged.
HTTP Request
Do you need help in using the POST /acl/v1/{from_identity}/{target_identity} ?
Checkout existing questions & answers Ask a question in Stack Overflow Did we miss something? Make a wish! Example for: POST /acl/v1/{from_identity}/{target_identity}
import requests
headers = {
"Authorization": "Bearer <ACCESS_TOKEN>",
"Content-Type": "application/json"
}
body = {
"read": True,
"write": True,
"link": True,
"manage": False,
"consume": False
}
response = requests.post(
'https://api-sandbox.oftrust.net/acl/v1/{from_identity}/{target_identity}',
headers=headers,
json=body
)
print({
'raw_body': response.text,
'status': response.status_code,
'code': response.status_code
})
curl -i -X POST \
-H "Authorization: Bearer <ACCESS_TOKEN>" \
-H "Content-Type: application/json" \
-d \
"{
\"read\": true,
\"write\": true,
\"link\": true,
\"manage\": false,
\"consume\": false
}" "https://api-sandbox.oftrust.net/acl/v1/{from_identity}/{target_identity}"
const unirest = require("unirest");
const headers = {
"Authorization": "Bearer <ACCESS_TOKEN>",
"Content-Type": "application/json"
};
const body = {
"read": true,
"write": true,
"link": true,
"manage": false,
"consume": false
};
unirest
.post("https://api-sandbox.oftrust.net/acl/v1/{from_identity}/{target_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));
});
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.apache.http.StatusLine;
public class Java {
public static void main(String[] args) {
try {
String path = "https://api-sandbox.oftrust.net/acl/v1/{from_identity}/{target_identity}";
StringEntity params = new StringEntity("{ \"read\": true, \"write\": true, \"link\": true, \"manage\": false, \"consume\": false}");
String Value;
HttpClient httpClient = HttpClientBuilder.create().build();
HttpPost request = new HttpPost(path);
request.addHeader("Authorization", "Bearer <ACCESS_TOKEN>");
request.addHeader("Content-Type", "application/json");
request.setEntity(params);
HttpResponse response = httpClient.execute(request);
try {
Value = EntityUtils.toString(response.getEntity()).toString();
if (Value.charAt(0) != '{' && Value.charAt(0) != '[')
Value = "\"" + Value + "\"" ;
} catch (Exception ex) {
Value = "{}";
}
StatusLine status = response.getStatusLine();
System.out.printf("{\"raw_body\":%s,\n\"status\":\"%s\",\n\"code\":\"%s\"}", Value, status, status.getStatusCode());
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
The above example should return
JSON
structured like this:
The above example should return JSON structured like this:
HTTP/1.0 204
POST /acl/v1/{from_identity}/{target_identity}
Parameters
Name | Located in | Description | Required | Type |
---|---|---|---|---|
from_identity | path | The identity that is granted access to the target_identity |
Yes | string |
target_identity | path | The identity that can be accessed | Yes | string |
Authorization | header | The Authorization header, MUST be Bearer {{access_token}} |
Yes | string |
body | body | Yes |
Body properties
* - Required property
- object permissions
- boolean read * - read permission
- boolean write * - write permission
- boolean link * - link permission
- boolean manage * - manage permission
- boolean consume * - consume permission
Responses
Code | Description |
---|---|
204 | |
401 | |
403 | |
404 |
delete
Description: Delete permission
HTTP Request
Do you need help in using the DELETE /acl/v1/{from_identity}/{target_identity} ?
Checkout existing questions & answers Ask a question in Stack Overflow Did we miss something? Make a wish! Example for: DELETE /acl/v1/{from_identity}/{target_identity}
import requests
headers = {
"Authorization": "Bearer <ACCESS_TOKEN>"
}
response = requests.delete(
'https://api-sandbox.oftrust.net/acl/v1/{from_identity}/{target_identity}',
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/acl/v1/{from_identity}/{target_identity}"
const unirest = require("unirest");
const headers = {
"Authorization": "Bearer <ACCESS_TOKEN>"
};
unirest
.delete("https://api-sandbox.oftrust.net/acl/v1/{from_identity}/{target_identity}")
.headers(headers)
.then(({ raw_body, status, code }) => {
// output response to console as JSON
console.log(JSON.stringify({ raw_body, status, code }, null, 4));
});
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpDelete;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.apache.http.StatusLine;
public class Java {
public static void main(String[] args) {
try {
String path = "https://api-sandbox.oftrust.net/acl/v1/{from_identity}/{target_identity}";
String Value;
HttpClient httpClient = HttpClientBuilder.create().build();
HttpDelete request = new HttpDelete(path);
request.addHeader("Authorization", "Bearer <ACCESS_TOKEN>");
HttpResponse response = httpClient.execute(request);
try {
Value = EntityUtils.toString(response.getEntity()).toString();
if (Value.charAt(0) != '{' && Value.charAt(0) != '[')
Value = "\"" + Value + "\"" ;
} catch (Exception ex) {
Value = "{}";
}
StatusLine status = response.getStatusLine();
System.out.printf("{\"raw_body\":%s,\n\"status\":\"%s\",\n\"code\":\"%s\"}", Value, status, status.getStatusCode());
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
The above example should return
JSON
structured like this:
The above example should return JSON structured like this:
HTTP/1.0 204
DELETE /acl/v1/{from_identity}/{target_identity}
Parameters
Name | Located in | Description | Required | Type |
---|---|---|---|---|
from_identity | path | The identity that is granted access to the target_identity |
Yes | string |
target_identity | path | The identity that can be accessed | Yes | string |
Authorization | header | The Authorization header, MUST be Bearer {{access_token}} |
Yes | string |
Responses
Code | Description |
---|---|
204 | |
401 | |
403 | |
404 |
/acl/v1/{target_identity}
get
Description: List permissions on an identity. Will list all identities that can access the identity and what access privileges they have.
HTTP Request
Do you need help in using the GET /acl/v1/{target_identity} ?
Checkout existing questions & answers Ask a question in Stack Overflow Did we miss something? Make a wish! Example for: GET /acl/v1/{target_identity}
import requests
headers = {
"Authorization": "Bearer <ACCESS_TOKEN>"
}
response = requests.get(
'https://api-sandbox.oftrust.net/acl/v1/{target_identity}',
headers=headers
)
print({
'raw_body': response.text,
'status': response.status_code,
'code': response.status_code
})
curl -i -X GET \
-H "Authorization: Bearer <ACCESS_TOKEN>" \
"https://api-sandbox.oftrust.net/acl/v1/{target_identity}"
const unirest = require("unirest");
const headers = {
"Authorization": "Bearer <ACCESS_TOKEN>"
};
unirest
.get("https://api-sandbox.oftrust.net/acl/v1/{target_identity}")
.headers(headers)
.then(({ raw_body, status, code }) => {
// output response to console as JSON
console.log(JSON.stringify({ raw_body, status, code }, null, 4));
});
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.apache.http.StatusLine;
public class Java {
public static void main(String[] args) {
try {
String path = "https://api-sandbox.oftrust.net/acl/v1/{target_identity}";
String Value;
HttpClient httpClient = HttpClientBuilder.create().build();
HttpGet request = new HttpGet(path);
request.addHeader("Authorization", "Bearer <ACCESS_TOKEN>");
HttpResponse response = httpClient.execute(request);
try {
Value = EntityUtils.toString(response.getEntity()).toString();
if (Value.charAt(0) != '{' && Value.charAt(0) != '[')
Value = "\"" + Value + "\"" ;
} catch (Exception ex) {
Value = "{}";
}
StatusLine status = response.getStatusLine();
System.out.printf("{\"raw_body\":%s,\n\"status\":\"%s\",\n\"code\":\"%s\"}", Value, status, status.getStatusCode());
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
The above example should return
JSON
structured like this:
The above example should return JSON structured like this:
HTTP/1.0 200
{
"b32ead1c-2f23-4faa-91f3-e30ae239cc16": {
"read": true,
"write": true,
"link": true,
"manage": true,
"consume": true
},
"b32ead1c-2f23-4faa-91f3-e30ae239cc17": {
"read": true,
"write": true,
"link": true,
"manage": true,
"consume": true
}
}
GET /acl/v1/{target_identity}
Parameters
Name | Located in | Description | Required | Type |
---|---|---|---|---|
target_identity | path | The identity for which the permissions should be listed | Yes | string |
Authorization | header | The Authorization header, MUST be Bearer {{access_token}} |
Yes | string |
Responses
Code | Description |
---|---|
200 | |
401 | |
403 | |
404 |
/acl/v1/{target_identity}/{permissions}
get
Description: Check specific permissions. Used to check if the requester has specific privilege(s) on an identity. Will return 204 if requester has all requested privileges and 403 if at least one is missing.
HTTP Request
Do you need help in using the GET /acl/v1/{target_identity}/{permissions} ?
Checkout existing questions & answers Ask a question in Stack Overflow Did we miss something? Make a wish! Example for: GET /acl/v1/{target_identity}/{permissions}
import requests
headers = {
"Authorization": "Bearer <ACCESS_TOKEN>"
}
response = requests.get(
'https://api-sandbox.oftrust.net/acl/v1/{target_identity}/{permissions}',
headers=headers
)
print({
'raw_body': response.text,
'status': response.status_code,
'code': response.status_code
})
curl -i -X GET \
-H "Authorization: Bearer <ACCESS_TOKEN>" \
"https://api-sandbox.oftrust.net/acl/v1/{target_identity}/{permissions}"
const unirest = require("unirest");
const headers = {
"Authorization": "Bearer <ACCESS_TOKEN>"
};
unirest
.get("https://api-sandbox.oftrust.net/acl/v1/{target_identity}/{permissions}")
.headers(headers)
.then(({ raw_body, status, code }) => {
// output response to console as JSON
console.log(JSON.stringify({ raw_body, status, code }, null, 4));
});
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.apache.http.StatusLine;
public class Java {
public static void main(String[] args) {
try {
String path = "https://api-sandbox.oftrust.net/acl/v1/{target_identity}/{permissions}";
String Value;
HttpClient httpClient = HttpClientBuilder.create().build();
HttpGet request = new HttpGet(path);
request.addHeader("Authorization", "Bearer <ACCESS_TOKEN>");
HttpResponse response = httpClient.execute(request);
try {
Value = EntityUtils.toString(response.getEntity()).toString();
if (Value.charAt(0) != '{' && Value.charAt(0) != '[')
Value = "\"" + Value + "\"" ;
} catch (Exception ex) {
Value = "{}";
}
StatusLine status = response.getStatusLine();
System.out.printf("{\"raw_body\":%s,\n\"status\":\"%s\",\n\"code\":\"%s\"}", Value, status, status.getStatusCode());
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
The above example should return
JSON
structured like this:
The above example should return JSON structured like this:
HTTP/1.0 204
GET /acl/v1/{target_identity}/{permissions}
Parameters
Name | Located in | Description | Required | Type |
---|---|---|---|---|
target_identity | path | The identity to check if given permissions exist for | Yes | string |
permissions | path | A comma separated list of permissions to check | Yes | string |
Authorization | header | The Authorization header, MUST be Bearer {{access_token}} |
Yes | string |
Responses
Code | Description |
---|---|
204 | |
401 | |
403 |
/acl/v1/batch/{permissions}
post
Description: Batch check specific permissions. Used to check if the requester has specific privilege(s) on a batch of identities. Will return a mapping from identity ID to a boolean; true if the user has all the requested privileges to the identity and false if not.
HTTP Request
Do you need help in using the POST /acl/v1/batch/{permissions} ?
Checkout existing questions & answers Ask a question in Stack Overflow Did we miss something? Make a wish! Example for: POST /acl/v1/batch/{permissions}
import requests
headers = {
"Authorization": "Bearer <ACCESS_TOKEN>",
"Content-Type": "application/json"
}
body = {
"targets": [
"82440763-b208-4eab-bc13-1f2620184ea1",
"fed4bd28-fca4-4287-9389-b87dd77b815c",
"e45f1815-167f-4348-b194-64cd01b5c52f",
"016dfc04-4f4a-499c-a289-7861df876392",
"3e0d7600-2a81-4be1-842e-81e14739e52c"
]
}
response = requests.post(
'https://api-sandbox.oftrust.net/acl/v1/batch/{permissions}',
headers=headers,
json=body
)
print({
'raw_body': response.text,
'status': response.status_code,
'code': response.status_code
})
curl -i -X POST \
-H "Authorization: Bearer <ACCESS_TOKEN>" \
-H "Content-Type: application/json" \
-d \
"{
\"targets\": [
\"82440763-b208-4eab-bc13-1f2620184ea1\",
\"fed4bd28-fca4-4287-9389-b87dd77b815c\",
\"e45f1815-167f-4348-b194-64cd01b5c52f\",
\"016dfc04-4f4a-499c-a289-7861df876392\",
\"3e0d7600-2a81-4be1-842e-81e14739e52c\"
]
}" "https://api-sandbox.oftrust.net/acl/v1/batch/{permissions}"
const unirest = require("unirest");
const headers = {
"Authorization": "Bearer <ACCESS_TOKEN>",
"Content-Type": "application/json"
};
const body = {
"targets": [
"82440763-b208-4eab-bc13-1f2620184ea1",
"fed4bd28-fca4-4287-9389-b87dd77b815c",
"e45f1815-167f-4348-b194-64cd01b5c52f",
"016dfc04-4f4a-499c-a289-7861df876392",
"3e0d7600-2a81-4be1-842e-81e14739e52c"
]
};
unirest
.post("https://api-sandbox.oftrust.net/acl/v1/batch/{permissions}")
.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));
});
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.apache.http.StatusLine;
public class Java {
public static void main(String[] args) {
try {
String path = "https://api-sandbox.oftrust.net/acl/v1/batch/{permissions}";
StringEntity params = new StringEntity("{ \"targets\": [ \"82440763-b208-4eab-bc13-1f2620184ea1\", \"fed4bd28-fca4-4287-9389-b87dd77b815c\", \"e45f1815-167f-4348-b194-64cd01b5c52f\", \"016dfc04-4f4a-499c-a289-7861df876392\", \"3e0d7600-2a81-4be1-842e-81e14739e52c\" ]}");
String Value;
HttpClient httpClient = HttpClientBuilder.create().build();
HttpPost request = new HttpPost(path);
request.addHeader("Authorization", "Bearer <ACCESS_TOKEN>");
request.addHeader("Content-Type", "application/json");
request.setEntity(params);
HttpResponse response = httpClient.execute(request);
try {
Value = EntityUtils.toString(response.getEntity()).toString();
if (Value.charAt(0) != '{' && Value.charAt(0) != '[')
Value = "\"" + Value + "\"" ;
} catch (Exception ex) {
Value = "{}";
}
StatusLine status = response.getStatusLine();
System.out.printf("{\"raw_body\":%s,\n\"status\":\"%s\",\n\"code\":\"%s\"}", Value, status, status.getStatusCode());
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
The above example should return
JSON
structured like this:
The above example should return JSON structured like this:
HTTP/1.0 200
{
"82440763-b208-4eab-bc13-1f2620184ea1": true,
"fed4bd28-fca4-4287-9389-b87dd77b815c": false,
"e45f1815-167f-4348-b194-64cd01b5c52f": true,
"016dfc04-4f4a-499c-a289-7861df876392": true,
"3e0d7600-2a81-4be1-842e-81e14739e52c": false
}
POST /acl/v1/batch/{permissions}
Parameters
Name | Located in | Description | Required | Type |
---|---|---|---|---|
permissions | path | A comma separated list of permissions to check | Yes | string |
Authorization | header | The Authorization header, MUST be Bearer {{access_token}} |
Yes | string |
body | body | Yes |
Body properties
* - Required property
- object permissions
- boolean read * - read permission
- boolean write * - write permission
- boolean link * - link permission
- boolean manage * - manage permission
- boolean consume * - consume permission
Responses
Code | Description |
---|---|
200 | |
401 |
Application
Get Application related resources:
The Application API provides means to manage user's applications and perform different operations on them, like refreshing client secrets.
Version: v1
/apps/v1
get
Description: List all applications where the current user is developer
HTTP Request
Do you need help in using the GET /apps/v1 ?
Checkout existing questions & answers Ask a question in Stack Overflow Did we miss something? Make a wish! Example for: GET /apps/v1
import requests
headers = {
"Authorization": "Bearer <ACCESS_TOKEN>"
}
response = requests.get(
'https://api-sandbox.oftrust.net/apps/v1',
headers=headers
)
print({
'raw_body': response.text,
'status': response.status_code,
'code': response.status_code
})
curl -i -X GET \
-H "Authorization: Bearer <ACCESS_TOKEN>" \
"https://api-sandbox.oftrust.net/apps/v1"
const unirest = require("unirest");
const headers = {
"Authorization": "Bearer <ACCESS_TOKEN>"
};
unirest
.get("https://api-sandbox.oftrust.net/apps/v1")
.headers(headers)
.then(({ raw_body, status, code }) => {
// output response to console as JSON
console.log(JSON.stringify({ raw_body, status, code }, null, 4));
});
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.apache.http.StatusLine;
public class Java {
public static void main(String[] args) {
try {
String path = "https://api-sandbox.oftrust.net/apps/v1";
String Value;
HttpClient httpClient = HttpClientBuilder.create().build();
HttpGet request = new HttpGet(path);
request.addHeader("Authorization", "Bearer <ACCESS_TOKEN>");
HttpResponse response = httpClient.execute(request);
try {
Value = EntityUtils.toString(response.getEntity()).toString();
if (Value.charAt(0) != '{' && Value.charAt(0) != '[')
Value = "\"" + Value + "\"" ;
} catch (Exception ex) {
Value = "{}";
}
StatusLine status = response.getStatusLine();
System.out.printf("{\"raw_body\":%s,\n\"status\":\"%s\",\n\"code\":\"%s\"}", Value, status, status.getStatusCode());
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
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.oftrust.net/v2/Context/Identity/Digital/Software/App/",
"@type": "App",
"@id": "286042aa-6299-4138-8675-da105dfadefc",
"data": {
"name": "Example Application",
"description": "Application description",
"privacyPolicyUrl": "http://example.com/privacy.html",
"webPageUrl": "http://example.com/application.html",
"iconUrl": "http://example.com/icon.png"
},
"metadata": {
"createdAt": "2018-12-03T14:33:44",
"createdBy": "747d0af5-6f06-4309-b2d5-f06677356a9a",
"updatedAt": "2018-12-03T14:33:44",
"updatedBy": "747d0af5-6f06-4309-b2d5-f06677356a9a"
},
"inLinks": [
{
"@context": "https://standards.oftrust.net/v2/Context/Link/Role/DeveloperOf/",
"@type": "DeveloperOf",
"@id": "a6101e2d-b19c-4cd5-9767-00aa78986a39",
"from": "bfec43ac-a0ce-4469-a78f-3106cf28b4c9",
"to": "286042aa-6299-4138-8675-da105dfadefc",
"data": {},
"metadata": {
"createdAt": "2018-12-03T14:33:44",
"createdBy": "747d0af5-6f06-4309-b2d5-f06677356a9a",
"updatedAt": "2018-12-03T14:33:44",
"updatedBy": "747d0af5-6f06-4309-b2d5-f06677356a9a"
}
}
],
"outLinks": [
{
"@context": "https://standards.oftrust.net/v2/Context/Link/PublishedOn/",
"@type": "PublishedOn",
"@id": "87a5dee9-0a29-40c7-9972-475ef2c47890",
"from": "286042aa-6299-4138-8675-da105dfadefc",
"to": "10e28dca-3000-4fc5-8b2f-c21bd1893c9d",
"data": {},
"metadata": {
"createdAt": "2018-12-03T14:33:44",
"createdBy": "747d0af5-6f06-4309-b2d5-f06677356a9a",
"updatedAt": "2018-12-03T14:33:44",
"updatedBy": "747d0af5-6f06-4309-b2d5-f06677356a9a"
}
}
]
}
]
}
GET /apps/v1
Parameters
Name | Located in | Description | Required | Type |
---|---|---|---|---|
Authorization | header | The Authorization header, must be Bearer {{access_token}} |
Yes | string |
Responses
Code | Description |
---|---|
200 | |
401 |
post
Description: Create new application and its associated OAuth Client.
NOTE: The clientSecrets
is shown only once in plain text, when creating
the application. Make sure you save it somewhere. The client secret is
used for validating the application.
HTTP Request
Do you need help in using the POST /apps/v1 ?
Checkout existing questions & answers Ask a question in Stack Overflow Did we miss something? Make a wish! Example for: POST /apps/v1
import requests
headers = {
"Authorization": "Bearer <ACCESS_TOKEN>",
"Content-Type": "application/json"
}
body = {
"name": "Example Application",
"description": "Application description",
"privacyPolicyUrl": "http://example.com/privacy.html",
"webPageUrl": "http://example.com/application.html",
"iconUrl": "http://example.com/icon.png",
"scopes": "",
"defaultScopes": "",
"redirectUris": "https://example.com/auth-callback",
"defaultRedirectUri": "https://example.com/auth-callback",
"groupId": "bfec43ac-a0ce-4469-a78f-3106cf28b4c9"
}
response = requests.post(
'https://api-sandbox.oftrust.net/apps/v1',
headers=headers,
json=body
)
print({
'raw_body': response.text,
'status': response.status_code,
'code': response.status_code
})
curl -i -X POST \
-H "Authorization: Bearer <ACCESS_TOKEN>" \
-H "Content-Type: application/json" \
-d \
"{
\"name\": \"Example Application\",
\"description\": \"Application description\",
\"privacyPolicyUrl\": \"http://example.com/privacy.html\",
\"webPageUrl\": \"http://example.com/application.html\",
\"iconUrl\": \"http://example.com/icon.png\",
\"scopes\": \"\",
\"defaultScopes\": \"\",
\"redirectUris\": \"https://example.com/auth-callback\",
\"defaultRedirectUri\": \"https://example.com/auth-callback\",
\"groupId\": \"bfec43ac-a0ce-4469-a78f-3106cf28b4c9\"
}" "https://api-sandbox.oftrust.net/apps/v1"
const unirest = require("unirest");
const headers = {
"Authorization": "Bearer <ACCESS_TOKEN>",
"Content-Type": "application/json"
};
const body = {
"name": "Example Application",
"description": "Application description",
"privacyPolicyUrl": "http://example.com/privacy.html",
"webPageUrl": "http://example.com/application.html",
"iconUrl": "http://example.com/icon.png",
"scopes": "",
"defaultScopes": "",
"redirectUris": "https://example.com/auth-callback",
"defaultRedirectUri": "https://example.com/auth-callback",
"groupId": "bfec43ac-a0ce-4469-a78f-3106cf28b4c9"
};
unirest
.post("https://api-sandbox.oftrust.net/apps/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));
});
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.apache.http.StatusLine;
public class Java {
public static void main(String[] args) {
try {
String path = "https://api-sandbox.oftrust.net/apps/v1";
StringEntity params = new StringEntity("{ \"name\": \"Example Application\", \"description\": \"Application description\", \"privacyPolicyUrl\": \"http://example.com/privacy.html\", \"webPageUrl\": \"http://example.com/application.html\", \"iconUrl\": \"http://example.com/icon.png\", \"scopes\": \"\", \"defaultScopes\": \"\", \"redirectUris\": \"https://example.com/auth-callback\", \"defaultRedirectUri\": \"https://example.com/auth-callback\", \"groupId\": \"bfec43ac-a0ce-4469-a78f-3106cf28b4c9\"}");
String Value;
HttpClient httpClient = HttpClientBuilder.create().build();
HttpPost request = new HttpPost(path);
request.addHeader("Authorization", "Bearer <ACCESS_TOKEN>");
request.addHeader("Content-Type", "application/json");
request.setEntity(params);
HttpResponse response = httpClient.execute(request);
try {
Value = EntityUtils.toString(response.getEntity()).toString();
if (Value.charAt(0) != '{' && Value.charAt(0) != '[')
Value = "\"" + Value + "\"" ;
} catch (Exception ex) {
Value = "{}";
}
StatusLine status = response.getStatusLine();
System.out.printf("{\"raw_body\":%s,\n\"status\":\"%s\",\n\"code\":\"%s\"}", Value, status, status.getStatusCode());
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
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.oftrust.net/v2/Context/Identity/Digital/Software/App/",
"@type": "App",
"@id": "6601afe9-85e4-4fe8-a3c9-1329f15493e1",
"data": {
"name": "Example Application",
"description": "Application description",
"privacyPolicyUrl": "http://example.com/privacy.html",
"webPageUrl": "http://example.com/application.html",
"iconUrl": "http://example.com/icon.png"
},
"metadata": {
"createdAt": "2018-12-03T14:33:44",
"createdBy": "747d0af5-6f06-4309-b2d5-f06677356a9a",
"updatedAt": "2018-12-03T14:33:44",
"updatedBy": "747d0af5-6f06-4309-b2d5-f06677356a9a"
},
"inLinks": [
{
"@context": "https://standards.oftrust.net/v2/Context/Link/Role/DeveloperOf/",
"@type": "DeveloperOf",
"@id": "a6101e2d-b19c-4cd5-9767-00aa78986a39",
"from": "bfec43ac-a0ce-4469-a78f-3106cf28b4c9",
"to": "286042aa-6299-4138-8675-da105dfadefc",
"data": {},
"metadata": {
"createdAt": "2018-12-03T14:33:44",
"createdBy": "747d0af5-6f06-4309-b2d5-f06677356a9a",
"updatedAt": "2018-12-03T14:33:44",
"updatedBy": "747d0af5-6f06-4309-b2d5-f06677356a9a"
}
}
],
"outLinks": [
{
"@context": "https://standards.oftrust.net/v2/Context/Link/PublishedOn/",
"@type": "PublishedOn",
"@id": "87a5dee9-0a29-40c7-9972-475ef2c47890",
"from": "286042aa-6299-4138-8675-da105dfadefc",
"to": "10e28dca-3000-4fc5-8b2f-c21bd1893c9d",
"data": {},
"metadata": {
"createdAt": "2018-12-03T14:33:44",
"createdBy": "747d0af5-6f06-4309-b2d5-f06677356a9a",
"updatedAt": "2018-12-03T14:33:44",
"updatedBy": "747d0af5-6f06-4309-b2d5-f06677356a9a"
}
}
],
"client": {
"clientId": "6601afe9-85e4-4fe8-a3c9-1329f15493e1",
"clientSecrets": [
"Sw4gT3I0oUynpeTN6YGfvFPE8SPj5LC1YNIHfFCF25w"
],
"scopes": "",
"redirectUris": "https://example.com/auth-callback",
"defaultScopes": "",
"defaultRedirectUri": "https://example.com/auth-callback"
},
"tokens": [
{
"access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUz...T79_KYC4Ds",
"expires_in": 63072000.0,
"token_type": "Bearer",
"refresh_token": "SwGAWsFfT1FZrT92NRJc0MaBp9XrmG"
},
{
"access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUz...T53_KYC4Ds",
"expires_in": 63072000.0,
"token_type": "Bearer",
"refresh_token": "SwGAWsFfT1FZrT92NRJc0MaBp9XrmG"
}
]
}
POST /apps/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 | |
401 | |
403 | |
404 | |
422 |
/apps/v1/{app_id}
get
Description: Get application's details
HTTP Request
Do you need help in using the GET /apps/v1/{app_id} ?
Checkout existing questions & answers Ask a question in Stack Overflow Did we miss something? Make a wish! Example for: GET /apps/v1/{app_id}
import requests
headers = {
"Authorization": "Bearer <ACCESS_TOKEN>"
}
response = requests.get(
'https://api-sandbox.oftrust.net/apps/v1/{app_id}',
headers=headers
)
print({
'raw_body': response.text,
'status': response.status_code,
'code': response.status_code
})
curl -i -X GET \
-H "Authorization: Bearer <ACCESS_TOKEN>" \
"https://api-sandbox.oftrust.net/apps/v1/{app_id}"
const unirest = require("unirest");
const headers = {
"Authorization": "Bearer <ACCESS_TOKEN>"
};
unirest
.get("https://api-sandbox.oftrust.net/apps/v1/{app_id}")
.headers(headers)
.then(({ raw_body, status, code }) => {
// output response to console as JSON
console.log(JSON.stringify({ raw_body, status, code }, null, 4));
});
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.apache.http.StatusLine;
public class Java {
public static void main(String[] args) {
try {
String path = "https://api-sandbox.oftrust.net/apps/v1/{app_id}";
String Value;
HttpClient httpClient = HttpClientBuilder.create().build();
HttpGet request = new HttpGet(path);
request.addHeader("Authorization", "Bearer <ACCESS_TOKEN>");
HttpResponse response = httpClient.execute(request);
try {
Value = EntityUtils.toString(response.getEntity()).toString();
if (Value.charAt(0) != '{' && Value.charAt(0) != '[')
Value = "\"" + Value + "\"" ;
} catch (Exception ex) {
Value = "{}";
}
StatusLine status = response.getStatusLine();
System.out.printf("{\"raw_body\":%s,\n\"status\":\"%s\",\n\"code\":\"%s\"}", Value, status, status.getStatusCode());
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
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.oftrust.net/v2/Context/Identity/Digital/Software/App/",
"@type": "App",
"@id": "48bb2858-e2fc-42d3-b44e-35f138b4b02d",
"data": {
"name": "Example Application",
"webPageUrl": "http://example.com/application.html",
"iconUrl": "http://example.com/icon.png",
"description": "Application description",
"privacyPolicyUrl": "http://example.com/privacy.html"
},
"metadata": {
"createdAt": "2018-12-03T14:33:44",
"createdBy": "747d0af5-6f06-4309-b2d5-f06677356a9a",
"updatedAt": "2018-12-03T14:33:44",
"updatedBy": "747d0af5-6f06-4309-b2d5-f06677356a9a"
},
"inLinks": [
{
"@context": "https://standards.oftrust.net/v2/Context/Link/Role/DeveloperOf/",
"@type": "DeveloperOf",
"@id": "a6101e2d-b19c-4cd5-9767-00aa78986a39",
"from": "bfec43ac-a0ce-4469-a78f-3106cf28b4c9",
"to": "286042aa-6299-4138-8675-da105dfadefc",
"data": {},
"metadata": {
"createdAt": "2018-12-03T14:33:44",
"createdBy": "747d0af5-6f06-4309-b2d5-f06677356a9a",
"updatedAt": "2018-12-03T14:33:44",
"updatedBy": "747d0af5-6f06-4309-b2d5-f06677356a9a"
}
}
],
"pagination": {
"inLinks": {
"links": [
{
"rel": "first",
"href": "https://api-sandbox.oftrust.net/identities/v1/48bb2858-e2fc-42d3-b44e-35f138b4b02d?offset=0&limit=100"
},
{
"rel": "self",
"href": "https://api-sandbox.oftrust.net/identities/v1/48bb2858-e2fc-42d3-b44e-35f138b4b02d"
},
{
"rel": "last",
"href": "https://api-sandbox.oftrust.net/identities/v1/48bb2858-e2fc-42d3-b44e-35f138b4b02d?offset=0&limit=100"
}
],
"hasMore": false,
"totalCount": 1
},
"outLinks": {
"links": [
{
"rel": "first",
"href": "https://api-sandbox.oftrust.net/identities/v1/48bb2858-e2fc-42d3-b44e-35f138b4b02d?offset=0&limit=100"
},
{
"rel": "self",
"href": "https://api-sandbox.oftrust.net/identities/v1/48bb2858-e2fc-42d3-b44e-35f138b4b02d"
},
{
"rel": "last",
"href": "https://api-sandbox.oftrust.net/identities/v1/48bb2858-e2fc-42d3-b44e-35f138b4b02d?offset=0&limit=100"
}
],
"hasMore": false,
"totalCount": 1
}
},
"outLinks": [
{
"@context": "https://standards.oftrust.net/v2/Context/Link/PublishedOn/",
"@type": "PublishedOn",
"@id": "87a5dee9-0a29-40c7-9972-475ef2c47890",
"from": "286042aa-6299-4138-8675-da105dfadefc",
"to": "10e28dca-3000-4fc5-8b2f-c21bd1893c9d",
"data": {},
"metadata": {
"createdAt": "2018-12-03T14:33:44",
"createdBy": "747d0af5-6f06-4309-b2d5-f06677356a9a",
"updatedAt": "2018-12-03T14:33:44",
"updatedBy": "747d0af5-6f06-4309-b2d5-f06677356a9a"
}
}
]
}
GET /apps/v1/{app_id}
Parameters
Name | Located in | Description | Required | Type |
---|---|---|---|---|
app_id | path | App's ID | Yes | string |
Authorization | header | The Authorization header, must be Bearer {{access_token}} |
Yes | string |
Responses
Code | Description |
---|---|
200 | |
401 | |
404 |
put
Description: Update an application and its client. The client secret will not be touched, as it has its own endpoint
HTTP Request
Do you need help in using the PUT /apps/v1/{app_id} ?
Checkout existing questions & answers Ask a question in Stack Overflow Did we miss something? Make a wish! Example for: PUT /apps/v1/{app_id}
import requests
headers = {
"Authorization": "Bearer <ACCESS_TOKEN>",
"Content-Type": "application/json"
}
body = {
"name": "Example Application",
"description": "Application description",
"privacyPolicyUrl": "http://example.com/privacy.html",
"webPageUrl": "http://example.com/application.html",
"iconUrl": "http://example.com/icon.png",
"scopes": "",
"defaultScopes": "",
"redirectUris": "https://example.com/auth-callback",
"defaultRedirectUri": "https://example.com/auth-callback"
}
response = requests.put(
'https://api-sandbox.oftrust.net/apps/v1/{app_id}',
headers=headers,
json=body
)
print({
'raw_body': response.text,
'status': response.status_code,
'code': response.status_code
})
curl -i -X PUT \
-H "Authorization: Bearer <ACCESS_TOKEN>" \
-H "Content-Type: application/json" \
-d \
"{
\"name\": \"Example Application\",
\"description\": \"Application description\",
\"privacyPolicyUrl\": \"http://example.com/privacy.html\",
\"webPageUrl\": \"http://example.com/application.html\",
\"iconUrl\": \"http://example.com/icon.png\",
\"scopes\": \"\",
\"defaultScopes\": \"\",
\"redirectUris\": \"https://example.com/auth-callback\",
\"defaultRedirectUri\": \"https://example.com/auth-callback\"
}" "https://api-sandbox.oftrust.net/apps/v1/{app_id}"
const unirest = require("unirest");
const headers = {
"Authorization": "Bearer <ACCESS_TOKEN>",
"Content-Type": "application/json"
};
const body = {
"name": "Example Application",
"description": "Application description",
"privacyPolicyUrl": "http://example.com/privacy.html",
"webPageUrl": "http://example.com/application.html",
"iconUrl": "http://example.com/icon.png",
"scopes": "",
"defaultScopes": "",
"redirectUris": "https://example.com/auth-callback",
"defaultRedirectUri": "https://example.com/auth-callback"
};
unirest
.put("https://api-sandbox.oftrust.net/apps/v1/{app_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));
});
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPut;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.apache.http.StatusLine;
public class Java {
public static void main(String[] args) {
try {
String path = "https://api-sandbox.oftrust.net/apps/v1/{app_id}";
StringEntity params = new StringEntity("{ \"name\": \"Example Application\", \"description\": \"Application description\", \"privacyPolicyUrl\": \"http://example.com/privacy.html\", \"webPageUrl\": \"http://example.com/application.html\", \"iconUrl\": \"http://example.com/icon.png\", \"scopes\": \"\", \"defaultScopes\": \"\", \"redirectUris\": \"https://example.com/auth-callback\", \"defaultRedirectUri\": \"https://example.com/auth-callback\"}");
String Value;
HttpClient httpClient = HttpClientBuilder.create().build();
HttpPut request = new HttpPut(path);
request.addHeader("Authorization", "Bearer <ACCESS_TOKEN>");
request.addHeader("Content-Type", "application/json");
request.setEntity(params);
HttpResponse response = httpClient.execute(request);
try {
Value = EntityUtils.toString(response.getEntity()).toString();
if (Value.charAt(0) != '{' && Value.charAt(0) != '[')
Value = "\"" + Value + "\"" ;
} catch (Exception ex) {
Value = "{}";
}
StatusLine status = response.getStatusLine();
System.out.printf("{\"raw_body\":%s,\n\"status\":\"%s\",\n\"code\":\"%s\"}", Value, status, status.getStatusCode());
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
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.oftrust.net/v2/Context/Identity/Digital/Software/App/",
"@type": "App",
"@id": "6601afe9-85e4-4fe8-a3c9-1329f15493e1",
"data": {
"name": "Example Application",
"description": "Application description",
"privacyPolicyUrl": "http://example.com/privacy.html",
"webPageUrl": "http://example.com/application.html",
"iconUrl": "http://example.com/icon.png"
},
"metadata": {
"createdAt": "2018-12-03T14:33:44",
"createdBy": "747d0af5-6f06-4309-b2d5-f06677356a9a",
"updatedAt": "2018-12-03T14:33:44",
"updatedBy": "747d0af5-6f06-4309-b2d5-f06677356a9a"
},
"inLinks": [
{
"@context": "https://standards.oftrust.net/v2/Context/Link/Role/DeveloperOf/",
"@type": "DeveloperOf",
"@id": "a6101e2d-b19c-4cd5-9767-00aa78986a39",
"from": "bfec43ac-a0ce-4469-a78f-3106cf28b4c9",
"to": "286042aa-6299-4138-8675-da105dfadefc",
"data": {},
"metadata": {
"createdAt": "2018-12-03T14:33:44",
"createdBy": "747d0af5-6f06-4309-b2d5-f06677356a9a",
"updatedAt": "2018-12-03T14:33:44",
"updatedBy": "747d0af5-6f06-4309-b2d5-f06677356a9a"
}
}
],
"outLinks": [
{
"@context": "https://standards.oftrust.net/v2/Context/Link/PublishedOn/",
"@type": "PublishedOn",
"@id": "87a5dee9-0a29-40c7-9972-475ef2c47890",
"from": "286042aa-6299-4138-8675-da105dfadefc",
"to": "10e28dca-3000-4fc5-8b2f-c21bd1893c9d",
"data": {},
"metadata": {
"createdAt": "2018-12-03T14:33:44",
"createdBy": "747d0af5-6f06-4309-b2d5-f06677356a9a",
"updatedAt": "2018-12-03T14:33:44",
"updatedBy": "747d0af5-6f06-4309-b2d5-f06677356a9a"
}
}
],
"client": {
"clientId": "6601afe9-85e4-4fe8-a3c9-1329f15493e1",
"scopes": "",
"redirectUris": "https://example.com/auth-callback",
"defaultScopes": "",
"defaultRedirectUri": "https://example.com/auth-callback"
}
}
PUT /apps/v1/{app_id}
Parameters
Name | Located in | Description | Required | Type |
---|---|---|---|---|
app_id | path | App's ID | Yes | string |
Authorization | header | The Authorization header, must be Bearer {{access_token}} |
Yes | string |
body | body | Yes |
Responses
Code | Description |
---|---|
200 | |
401 | |
403 | |
404 | |
422 |
delete
Description: Remove an application
HTTP Request
Do you need help in using the DELETE /apps/v1/{app_id} ?
Checkout existing questions & answers Ask a question in Stack Overflow Did we miss something? Make a wish! Example for: DELETE /apps/v1/{app_id}
import requests
headers = {
"Authorization": "Bearer <ACCESS_TOKEN>"
}
response = requests.delete(
'https://api-sandbox.oftrust.net/apps/v1/{app_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/apps/v1/{app_id}"
const unirest = require("unirest");
const headers = {
"Authorization": "Bearer <ACCESS_TOKEN>"
};
unirest
.delete("https://api-sandbox.oftrust.net/apps/v1/{app_id}")
.headers(headers)
.then(({ raw_body, status, code }) => {
// output response to console as JSON
console.log(JSON.stringify({ raw_body, status, code }, null, 4));
});
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpDelete;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.apache.http.StatusLine;
public class Java {
public static void main(String[] args) {
try {
String path = "https://api-sandbox.oftrust.net/apps/v1/{app_id}";
String Value;
HttpClient httpClient = HttpClientBuilder.create().build();
HttpDelete request = new HttpDelete(path);
request.addHeader("Authorization", "Bearer <ACCESS_TOKEN>");
HttpResponse response = httpClient.execute(request);
try {
Value = EntityUtils.toString(response.getEntity()).toString();
if (Value.charAt(0) != '{' && Value.charAt(0) != '[')
Value = "\"" + Value + "\"" ;
} catch (Exception ex) {
Value = "{}";
}
StatusLine status = response.getStatusLine();
System.out.printf("{\"raw_body\":%s,\n\"status\":\"%s\",\n\"code\":\"%s\"}", Value, status, status.getStatusCode());
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
The above example should return
JSON
structured like this:
The above example should return JSON structured like this:
HTTP/1.0 204
DELETE /apps/v1/{app_id}
Parameters
Name | Located in | Description | Required | Type |
---|---|---|---|---|
app_id | path | App's ID | Yes | string |
Authorization | header | The Authorization header, must be Bearer {{access_token}} |
Yes | string |
Responses
Code | Description |
---|---|
204 | |
401 | |
403 | |
404 |
/apps/v1/{app_id}/refreshSecret
post
Description: Create new client secret for the given application. The system will keep track of the two latest secrets, so when creating a new one, the previous one is still available for use.
HTTP Request
Do you need help in using the POST /apps/v1/{app_id}/refreshSecret ?
Checkout existing questions & answers Ask a question in Stack Overflow Did we miss something? Make a wish! Example for: POST /apps/v1/{app_id}/refreshSecret
import requests
headers = {
"Authorization": "Bearer <ACCESS_TOKEN>"
}
response = requests.post(
'https://api-sandbox.oftrust.net/apps/v1/{app_id}/refreshSecret',
headers=headers
)
print({
'raw_body': response.text,
'status': response.status_code,
'code': response.status_code
})
curl -i -X POST \
-H "Authorization: Bearer <ACCESS_TOKEN>" \
"https://api-sandbox.oftrust.net/apps/v1/{app_id}/refreshSecret"
const unirest = require("unirest");
const headers = {
"Authorization": "Bearer <ACCESS_TOKEN>"
};
unirest
.post("https://api-sandbox.oftrust.net/apps/v1/{app_id}/refreshSecret")
.headers(headers)
.then(({ raw_body, status, code }) => {
// output response to console as JSON
console.log(JSON.stringify({ raw_body, status, code }, null, 4));
});
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.apache.http.StatusLine;
public class Java {
public static void main(String[] args) {
try {
String path = "https://api-sandbox.oftrust.net/apps/v1/{app_id}/refreshSecret";
String Value;
HttpClient httpClient = HttpClientBuilder.create().build();
HttpPost request = new HttpPost(path);
request.addHeader("Authorization", "Bearer <ACCESS_TOKEN>");
HttpResponse response = httpClient.execute(request);
try {
Value = EntityUtils.toString(response.getEntity()).toString();
if (Value.charAt(0) != '{' && Value.charAt(0) != '[')
Value = "\"" + Value + "\"" ;
} catch (Exception ex) {
Value = "{}";
}
StatusLine status = response.getStatusLine();
System.out.printf("{\"raw_body\":%s,\n\"status\":\"%s\",\n\"code\":\"%s\"}", Value, status, status.getStatusCode());
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
The above example should return
JSON
structured like this:
The above example should return JSON structured like this:
HTTP/1.0 201
{
"clientSecret": "YK45hcnq1D7fsgrvbHkPrIexetnnbqZGPQBV23oVgsA"
}
POST /apps/v1/{app_id}/refreshSecret
Parameters
Name | Located in | Description | Required | Type |
---|---|---|---|---|
app_id | path | App's ID | Yes | string |
Authorization | header | The Authorization header, must be Bearer {{access_token}} |
Yes | string |
Responses
Code | Description |
---|---|
201 | |
401 | |
403 | |
404 |
Broker
Get Broker 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 data source defined by the data product. The data
broker will validate the signature passed to the broker in the header
X-Pot-Signature
. See the parameter info for more info on how to generate
this signature.
Once the signature is validated, the request is passed on to the translator on the URL defined in the data product (`translatorUrl`).
The data broker will generate it's own signature and pass it along in the
`X-Pot-Signature` header. The translator must now validate that the request
came from the data broker: (example in Python)
body = {...}
signature_value = request.headers.get("x-pot-signature")
body_string = json.dumps(
body, sort_keys=True, indent=None, separators=(',', ': ')
).strip()
rsa_algo = RSAAlgorithm(RSAAlgorithm.SHA256)
key = rsa_algo.prepare_key(broker_public_key)
is_valid = rsa_algo.verify(body_string.encode("utf-8"), key, signature_value)
Once the translator has validated the signature and verified that the timestamp passed in the body is +/- 5 seconds, it can proceed to fetch the information from the third party data source, or wherever the data is hosted for this data product.
Once the translator has got the needed data, it must sign the data with
it's own private key (corresponding public key must be specified in the data
product's `organizationPublicKeys` list) and return the data to the data broker.
The data to be signed, is the `data` key in the response, e.g.
{
"@context": "https://standards.oftrust.net/v2/Context/Identity/Product/DataProduct/",
"data": data, # this is the data that is signed.
"signature": {
"type": "RsaSignature2018",
"created": created_at, # RFC 3339 timestamp
"creator": "https://url-to-public-key", # Same URL as specified in the data product
"signatureValue": signature,
}
}
The signature itself is generated by adding a `__signed__` key to the data to
be signed. It's the same RFC 3339 timestamp as when the signature was created.
Example in Python:
sign_data = copy(data)
sign_data["__signed__"] = created_at
sign_string = json.dumps(
sign_data, sort_keys=True, indent=None, separators=(',', ': ')
).strip()
rsa_algo = RSAAlgorithm(RSAAlgorithm.SHA256)
key = rsa_algo.prepare_key(translator_private_key)
signature = base64.b64encode(
rsa_algo.sign(sign_string.encode("utf-8"), key)
).decode("utf-8")
For more information read the header/parameter descriptions.
HTTP Request
Do you need help in using the POST /broker/v1/fetch-data-product ?
Checkout existing questions & answers Ask a question in Stack Overflow Did we miss something? Make a wish! Example for: POST /broker/v1/fetch-data-product
import requests
headers = {
"X-Pot-Signature": "Ioma1gqOVFUBrXiziWS....CLqBG4vFozG3YgzPzillNip0=",
"X-App-Token": "eyJ0eXAiOiJJV1QiLcJhbgciOiJSUzI1NiJ9.eyJzY29w...VXs5fff",
"X-User-Token": "eyJ0eXAIOijKV1QiLcJGbGciOiJSUzI1NiJ9.eyJzY29w...DVs5aaf",
"Content-Type": "application/json"
}
body = {
"@context": "https://standards.oftrust.net/v2/Context/DataProductParameters/Sensor",
"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=body
)
print({
'raw_body': response.text,
'status': response.status_code,
'code': response.status_code
})
curl -i -X POST \
-H "X-Pot-Signature: Ioma1gqOVFUBrXiziWS....CLqBG4vFozG3YgzPzillNip0=" \
-H "X-App-Token: eyJ0eXAiOiJJV1QiLcJhbgciOiJSUzI1NiJ9.eyJzY29w...VXs5fff" \
-H "X-User-Token: eyJ0eXAIOijKV1QiLcJGbGciOiJSUzI1NiJ9.eyJzY29w...DVs5aaf" \
-H "Content-Type: application/json" \
-d \
"{
\"@context\": \"https://standards.oftrust.net/v2/Context/DataProductParameters/Sensor\",
\"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-App-Token": "eyJ0eXAiOiJJV1QiLcJhbgciOiJSUzI1NiJ9.eyJzY29w...VXs5fff",
"X-User-Token": "eyJ0eXAIOijKV1QiLcJGbGciOiJSUzI1NiJ9.eyJzY29w...DVs5aaf",
"Content-Type": "application/json"
};
const body = {
"@context": "https://standards.oftrust.net/v2/Context/DataProductParameters/Sensor",
"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));
});
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.apache.http.StatusLine;
public class Java {
public static void main(String[] args) {
try {
String path = "https://api-sandbox.oftrust.net/broker/{version}/fetch-data-product";
StringEntity params = new StringEntity("{ \"@context\": \"https://standards.oftrust.net/v2/Context/DataProductParameters/Sensor\", \"timestamp\": \"2018-11-01T12:00:00+00:00\", \"productCode\": \"product-1\", \"parameters\": { \"param-1\": \"Value\", \"param-2\": \"Value\" }}");
String Value;
HttpClient httpClient = HttpClientBuilder.create().build();
HttpPost request = new HttpPost(path);
request.addHeader("X-Pot-Signature", "Ioma1gqOVFUBrXiziWS....CLqBG4vFozG3YgzPzillNip0=");
request.addHeader("X-App-Token", "eyJ0eXAiOiJJV1QiLcJhbgciOiJSUzI1NiJ9.eyJzY29w...VXs5fff");
request.addHeader("X-User-Token", "eyJ0eXAIOijKV1QiLcJGbGciOiJSUzI1NiJ9.eyJzY29w...DVs5aaf");
request.addHeader("Content-Type", "application/json");
request.setEntity(params);
HttpResponse response = httpClient.execute(request);
try {
Value = EntityUtils.toString(response.getEntity()).toString();
if (Value.charAt(0) != '{' && Value.charAt(0) != '[')
Value = "\"" + Value + "\"" ;
} catch (Exception ex) {
Value = "{}";
}
StatusLine status = response.getStatusLine();
System.out.printf("{\"raw_body\":%s,\n\"status\":\"%s\",\n\"code\":\"%s\"}", Value, status, status.getStatusCode());
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
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 Python example: Where Get the digest by passing the app client secret (generated when creating a new app) and the body string to Return the digest in base64 encoded format: JavaScript example: By using the library PHP example: |
Yes | string |
X-App-Token | header | The requesting app's JWT token. The token is generated when the app is created. | Yes | string |
X-User-Token | header | The currently logged in user's OAuth bearer token. This is not mandatory, but if passed, the token will be verified. | No | string |
body | body | Yes |
Body properties
* - Required property
- object data-product-request
- string @context - A URL for the parameters context
- string timestamp * - A timestamp in RFC3339 format
- string productCode * - The data product's product code
- object parameters * - Additional parameters to be sent to the translator
Responses
Code | Description |
---|---|
200 | Validating the signature from a translator When you validate the signature returned from the translator, remember to When validating the signature, use the same way to get the string-version of the payload as when generating the |
403 | You don't have permissions to consume this data product! |
422 | Missing data for required field. |
500 | The data returned from the translator cannot be read or parsed. |
502 | Error encountered in the external service. |
504 | The translator takes too long to respond |
Calendar
Get Calendar 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
Do you need help in using the POST /calendars/v1 ?
Checkout existing questions & answers Ask a question in Stack Overflow Did we miss something? Make a wish! Example for: POST /calendars/v1
import requests
headers = {
"Authorization": "Bearer <ACCESS_TOKEN>",
"Content-Type": "application/json"
}
body = {
"toIdentity": "0920a84a-1548-4644-b95d-e3f80e1b9ca6",
"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",
"cc": [
"323bde80-4cc2-472e-bb77-e6a3e95a1253",
"0827e9c3-9664-479f-b0ec-956a35d72e4b"
]
}
response = requests.post(
'https://api-sandbox.oftrust.net/calendars/v1',
headers=headers,
json=body
)
print({
'raw_body': response.text,
'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\",
\"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\",
\"cc\": [
\"323bde80-4cc2-472e-bb77-e6a3e95a1253\",
\"0827e9c3-9664-479f-b0ec-956a35d72e4b\"
]
}" "https://api-sandbox.oftrust.net/calendars/v1"
const unirest = require("unirest");
const headers = {
"Authorization": "Bearer <ACCESS_TOKEN>",
"Content-Type": "application/json"
};
const body = {
"toIdentity": "0920a84a-1548-4644-b95d-e3f80e1b9ca6",
"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",
"cc": [
"323bde80-4cc2-472e-bb77-e6a3e95a1253",
"0827e9c3-9664-479f-b0ec-956a35d72e4b"
]
};
unirest
.post("https://api-sandbox.oftrust.net/calendars/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));
});
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.apache.http.StatusLine;
public class Java {
public static void main(String[] args) {
try {
String path = "https://api-sandbox.oftrust.net/calendars/v1";
StringEntity params = new StringEntity("{ \"toIdentity\": \"0920a84a-1548-4644-b95d-e3f80e1b9ca6\", \"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\", \"cc\": [ \"323bde80-4cc2-472e-bb77-e6a3e95a1253\", \"0827e9c3-9664-479f-b0ec-956a35d72e4b\" ]}");
String Value;
HttpClient httpClient = HttpClientBuilder.create().build();
HttpPost request = new HttpPost(path);
request.addHeader("Authorization", "Bearer <ACCESS_TOKEN>");
request.addHeader("Content-Type", "application/json");
request.setEntity(params);
HttpResponse response = httpClient.execute(request);
try {
Value = EntityUtils.toString(response.getEntity()).toString();
if (Value.charAt(0) != '{' && Value.charAt(0) != '[')
Value = "\"" + Value + "\"" ;
} catch (Exception ex) {
Value = "{}";
}
StatusLine status = response.getStatusLine();
System.out.printf("{\"raw_body\":%s,\n\"status\":\"%s\",\n\"code\":\"%s\"}", Value, status, status.getStatusCode());
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
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": "Calendar",
"@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 |
---|---|---|---|---|
Authorization | header | The Authorization header, MUST be Bearer {{access_token}} |
Yes | string |
body | body | Yes |
Body properties
* - Required property
- object calendar
- string toIdentity * - The "to" identity ID to which the calendar is created for.
- string type * - The type of the calendar entry.
- string title * - The title of the calendar entry
- string startDate * - The start date and time of the calendar entry in RFC3339 format. Note that if the timezone details are omitted, it will default to UTC time.
- string endDate * - The end date and time of the calendar entry in RFC3339 format. Note that if the timezone details are omitted, it will default to UTC time.
- string repeats - Whether the calendar entry repeats or not. As defined in ISO 8601 repeating intervals. E.g. Repeat the interval of "P1Y2M10DT2H30M" five times starting at "2008-03-01T13:00:00Z", use "R5/2008-03-01T13:00:00Z/P1Y2M10DT2H30M".
- string content - The text body of the calendar entry.
- string location - The location of the calendar entry
- array cc - List of valid identity IDs to CC the message to. If the CC identity is not found, a 404 will be returned.
Responses
Code | Description |
---|---|
201 | |
401 | |
403 | |
404 | |
422 |
/calendars/v1/{id}
get
Description: Read one calendar by id
HTTP Request
Do you need help in using the GET /calendars/v1/{id} ?
Checkout existing questions & answers Ask a question in Stack Overflow Did we miss something? Make a wish! Example for: GET /calendars/v1/{id}
import requests
headers = {
"Authorization": "Bearer <ACCESS_TOKEN>"
}
response = requests.get(
'https://api-sandbox.oftrust.net/calendars/v1/{id}',
headers=headers
)
print({
'raw_body': response.text,
'status': response.status_code,
'code': response.status_code
})
curl -i -X GET \
-H "Authorization: Bearer <ACCESS_TOKEN>" \
"https://api-sandbox.oftrust.net/calendars/v1/{id}"
const unirest = require("unirest");
const headers = {
"Authorization": "Bearer <ACCESS_TOKEN>"
};
unirest
.get("https://api-sandbox.oftrust.net/calendars/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));
});
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.apache.http.StatusLine;
public class Java {
public static void main(String[] args) {
try {
String path = "https://api-sandbox.oftrust.net/calendars/v1/{id}";
String Value;
HttpClient httpClient = HttpClientBuilder.create().build();
HttpGet request = new HttpGet(path);
request.addHeader("Authorization", "Bearer <ACCESS_TOKEN>");
HttpResponse response = httpClient.execute(request);
try {
Value = EntityUtils.toString(response.getEntity()).toString();
if (Value.charAt(0) != '{' && Value.charAt(0) != '[')
Value = "\"" + Value + "\"" ;
} catch (Exception ex) {
Value = "{}";
}
StatusLine status = response.getStatusLine();
System.out.printf("{\"raw_body\":%s,\n\"status\":\"%s\",\n\"code\":\"%s\"}", Value, status, status.getStatusCode());
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
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": "Calendar",
"@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 |
Authorization | header | The Authorization header, MUST be Bearer {{access_token}} |
Yes | string |
Responses
Code | Description |
---|---|
200 | |
401 | |
403 | |
404 |
put
Description: Update a calendar by id
HTTP Request
Do you need help in using the PUT /calendars/v1/{id} ?
Checkout existing questions & answers Ask a question in Stack Overflow Did we miss something? Make a wish! Example for: PUT /calendars/v1/{id}
import requests
headers = {
"Authorization": "Bearer <ACCESS_TOKEN>",
"Content-Type": "application/json"
}
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"
}
response = requests.put(
'https://api-sandbox.oftrust.net/calendars/v1/{id}',
headers=headers,
json=body
)
print({
'raw_body': response.text,
'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/v1/{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/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));
});
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPut;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.apache.http.StatusLine;
public class Java {
public static void main(String[] args) {
try {
String path = "https://api-sandbox.oftrust.net/calendars/v1/{id}";
StringEntity params = new StringEntity("{ \"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\"}");
String Value;
HttpClient httpClient = HttpClientBuilder.create().build();
HttpPut request = new HttpPut(path);
request.addHeader("Authorization", "Bearer <ACCESS_TOKEN>");
request.addHeader("Content-Type", "application/json");
request.setEntity(params);
HttpResponse response = httpClient.execute(request);
try {
Value = EntityUtils.toString(response.getEntity()).toString();
if (Value.charAt(0) != '{' && Value.charAt(0) != '[')
Value = "\"" + Value + "\"" ;
} catch (Exception ex) {
Value = "{}";
}
StatusLine status = response.getStatusLine();
System.out.printf("{\"raw_body\":%s,\n\"status\":\"%s\",\n\"code\":\"%s\"}", Value, status, status.getStatusCode());
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
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": "Calendar",
"@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 |
Authorization | header | The Authorization header, MUST be Bearer {{access_token}} |
Yes | string |
body | body | Yes |
Body properties
* - Required property
- object calendar
- string toIdentity * - The "to" identity ID to which the calendar is created for.
- string type * - The type of the calendar entry.
- string title * - The title of the calendar entry
- string startDate * - The start date and time of the calendar entry in RFC3339 format. Note that if the timezone details are omitted, it will default to UTC time.
- string endDate * - The end date and time of the calendar entry in RFC3339 format. Note that if the timezone details are omitted, it will default to UTC time.
- string repeats - Whether the calendar entry repeats or not. As defined in ISO 8601 repeating intervals. E.g. Repeat the interval of "P1Y2M10DT2H30M" five times starting at "2008-03-01T13:00:00Z", use "R5/2008-03-01T13:00:00Z/P1Y2M10DT2H30M".
- string content - The text body of the calendar entry.
- string location - The location of the calendar entry
- array cc - List of valid identity IDs to CC the message to. If the CC identity is not found, a 404 will be returned.
Responses
Code | Description |
---|---|
200 | |
401 | |
403 | |
404 | |
422 |
delete
Description: Delete a calendar by id
HTTP Request
Do you need help in using the DELETE /calendars/v1/{id} ?
Checkout existing questions & answers Ask a question in Stack Overflow Did we miss something? Make a wish! Example for: DELETE /calendars/v1/{id}
import requests
headers = {
"Authorization": "Bearer <ACCESS_TOKEN>"
}
response = requests.delete(
'https://api-sandbox.oftrust.net/calendars/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/calendars/v1/{id}"
const unirest = require("unirest");
const headers = {
"Authorization": "Bearer <ACCESS_TOKEN>"
};
unirest
.delete("https://api-sandbox.oftrust.net/calendars/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));
});
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpDelete;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.apache.http.StatusLine;
public class Java {
public static void main(String[] args) {
try {
String path = "https://api-sandbox.oftrust.net/calendars/v1/{id}";
String Value;
HttpClient httpClient = HttpClientBuilder.create().build();
HttpDelete request = new HttpDelete(path);
request.addHeader("Authorization", "Bearer <ACCESS_TOKEN>");
HttpResponse response = httpClient.execute(request);
try {
Value = EntityUtils.toString(response.getEntity()).toString();
if (Value.charAt(0) != '{' && Value.charAt(0) != '[')
Value = "\"" + Value + "\"" ;
} catch (Exception ex) {
Value = "{}";
}
StatusLine status = response.getStatusLine();
System.out.printf("{\"raw_body\":%s,\n\"status\":\"%s\",\n\"code\":\"%s\"}", Value, status, status.getStatusCode());
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
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 |
Authorization | header | The Authorization header, MUST be Bearer {{access_token}} |
Yes | string |
Responses
Code | Description |
---|---|
204 | |
401 | |
403 | |
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/v1/{toIdentity}/list',
headers=headers
)
print({
'raw_body': response.text,
'status': response.status_code,
'code': response.status_code
})
curl -i -X GET \
-H "Authorization: Bearer <ACCESS_TOKEN>" \
"https://api-sandbox.oftrust.net/calendars/v1/{toIdentity}/list"
const unirest = require("unirest");
const headers = {
"Authorization": "Bearer <ACCESS_TOKEN>"
};
unirest
.get("https://api-sandbox.oftrust.net/calendars/v1/{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));
});
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.apache.http.StatusLine;
public class Java {
public static void main(String[] args) {
try {
String path = "https://api-sandbox.oftrust.net/calendars/v1/{toIdentity}/list";
String Value;
HttpClient httpClient = HttpClientBuilder.create().build();
HttpGet request = new HttpGet(path);
request.addHeader("Authorization", "Bearer <ACCESS_TOKEN>");
HttpResponse response = httpClient.execute(request);
try {
Value = EntityUtils.toString(response.getEntity()).toString();
if (Value.charAt(0) != '{' && Value.charAt(0) != '[')
Value = "\"" + Value + "\"" ;
} catch (Exception ex) {
Value = "{}";
}
StatusLine status = response.getStatusLine();
System.out.printf("{\"raw_body\":%s,\n\"status\":\"%s\",\n\"code\":\"%s\"}", Value, status, status.getStatusCode());
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
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": "Calendar",
"@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": "Calendar",
"@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 |
Authorization | header | The Authorization header, MUST be Bearer {{access_token}} |
Yes | string |
Responses
Code | Description |
---|---|
200 | |
401 | |
403 |
Context
Get Context 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
Do you need help in using the GET /contexts/v1/ ?
Checkout existing questions & answers Ask a question in Stack Overflow Did we miss something? Make a wish! Example for: GET /contexts/v1/
import requests
response = requests.get(
'https://api-sandbox.oftrust.net/contexts/v1/'
)
print({
'raw_body': response.text,
'status': response.status_code,
'code': response.status_code
})
curl -i -X GET \
"https://api-sandbox.oftrust.net/contexts/v1/"
const unirest = require("unirest");
unirest
.get("https://api-sandbox.oftrust.net/contexts/v1/")
.then(({ raw_body, status, code }) => {
// output response to console as JSON
console.log(JSON.stringify({ raw_body, status, code }, null, 4));
});
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.apache.http.StatusLine;
public class Java {
public static void main(String[] args) {
try {
String path = "https://api-sandbox.oftrust.net/contexts/v1/";
String Value;
HttpClient httpClient = HttpClientBuilder.create().build();
HttpGet request = new HttpGet(path);
HttpResponse response = httpClient.execute(request);
try {
Value = EntityUtils.toString(response.getEntity()).toString();
if (Value.charAt(0) != '{' && Value.charAt(0) != '[')
Value = "\"" + Value + "\"" ;
} catch (Exception ex) {
Value = "{}";
}
StatusLine status = response.getStatusLine();
System.out.printf("{\"raw_body\":%s,\n\"status\":\"%s\",\n\"code\":\"%s\"}", Value, status, status.getStatusCode());
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
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/
Responses
Code | Description |
---|---|
200 |
Identity
Get Identity 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
Do you need help in using the POST /identities/v1 ?
Checkout existing questions & answers Ask a question in Stack Overflow Did we miss something? Make a wish! Example for: POST /identities/v1
import requests
headers = {
"Authorization": "Bearer <ACCESS_TOKEN>",
"Content-Type": "application/json"
}
body = {
"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=body
)
print({
'raw_body': response.text,
'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));
});
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.apache.http.StatusLine;
public class Java {
public static void main(String[] args) {
try {
String path = "https://api-sandbox.oftrust.net/identities/v1";
StringEntity params = new StringEntity("{ \"context\": \"https://standards.lifeengine.io/v1/Context/Identity/Group/\", \"type\": \"Group\", \"data\": { \"name\": \"Company Oy\" }}");
String Value;
HttpClient httpClient = HttpClientBuilder.create().build();
HttpPost request = new HttpPost(path);
request.addHeader("Authorization", "Bearer <ACCESS_TOKEN>");
request.addHeader("Content-Type", "application/json");
request.setEntity(params);
HttpResponse response = httpClient.execute(request);
try {
Value = EntityUtils.toString(response.getEntity()).toString();
if (Value.charAt(0) != '{' && Value.charAt(0) != '[')
Value = "\"" + Value + "\"" ;
} catch (Exception ex) {
Value = "{}";
}
StatusLine status = response.getStatusLine();
System.out.printf("{\"raw_body\":%s,\n\"status\":\"%s\",\n\"code\":\"%s\"}", Value, status, status.getStatusCode());
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
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 |
Body properties
* - Required property
- object identity
- string context * - The URL to the context for this identity
- string type * - The type of the identity
- object data * - Additional data for the identity, as defined in the context.
- string name - The name of the identity
Responses
Code | Description |
---|---|
201 | |
401 | |
422 |
/identities/v1/{id}
get
Description: Read one identity by id. Requires the read
permission on the
identity. If you need to list all the links, and paginate through
them, we suggest to use the "List links" endpoint for an identity.
HTTP Request
Do you need help in using the GET /identities/v1/{id} ?
Checkout existing questions & answers Ask a question in Stack Overflow Did we miss something? Make a wish! Example for: GET /identities/v1/{id}
import requests
headers = {
"Authorization": "Bearer <ACCESS_TOKEN>"
}
response = requests.get(
'https://api-sandbox.oftrust.net/identities/v1/{id}',
params='inLinks=%2Fidentities%2F%7Bversion%7D%2F%7Bid%7D%3FinLinks%3D0&outLinks=%2Fidentities%2F%7Bversion%7D%2F%7Bid%7D%3FoutLinks%3D0&paginate=%2Fidentities%2F%7Bversion%7D%2F%7Bid%7D%3Fpaginate%3DinLinks&limit=%2Fidentities%2F%7Bversion%7D%2F%7Bid%7D%3Flimit%3D10&offset=%2Fidentities%2F%7Bversion%7D%2F%7Bid%7D%3Foffset%3D0',
headers=headers
)
print({
'raw_body': response.text,
'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}?inLinks=%2Fidentities%2F%7Bversion%7D%2F%7Bid%7D%3FinLinks%3D0&outLinks=%2Fidentities%2F%7Bversion%7D%2F%7Bid%7D%3FoutLinks%3D0&paginate=%2Fidentities%2F%7Bversion%7D%2F%7Bid%7D%3Fpaginate%3DinLinks&limit=%2Fidentities%2F%7Bversion%7D%2F%7Bid%7D%3Flimit%3D10&offset=%2Fidentities%2F%7Bversion%7D%2F%7Bid%7D%3Foffset%3D0"
const unirest = require("unirest");
const headers = {
"Authorization": "Bearer <ACCESS_TOKEN>"
};
unirest
.get("https://api-sandbox.oftrust.net/identities/v1/{id}")
.headers(headers)
.query("inLinks=%2Fidentities%2F%7Bversion%7D%2F%7Bid%7D%3FinLinks%3D0&outLinks=%2Fidentities%2F%7Bversion%7D%2F%7Bid%7D%3FoutLinks%3D0&paginate=%2Fidentities%2F%7Bversion%7D%2F%7Bid%7D%3Fpaginate%3DinLinks&limit=%2Fidentities%2F%7Bversion%7D%2F%7Bid%7D%3Flimit%3D10&offset=%2Fidentities%2F%7Bversion%7D%2F%7Bid%7D%3Foffset%3D0")
.then(({ raw_body, status, code }) => {
// output response to console as JSON
console.log(JSON.stringify({ raw_body, status, code }, null, 4));
});
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.apache.http.StatusLine;
public class Java {
public static void main(String[] args) {
try {
String path = "https://api-sandbox.oftrust.net/identities/v1/{id}?inLinks=%2Fidentities%2F%7Bversion%7D%2F%7Bid%7D%3FinLinks%3D0&outLinks=%2Fidentities%2F%7Bversion%7D%2F%7Bid%7D%3FoutLinks%3D0&paginate=%2Fidentities%2F%7Bversion%7D%2F%7Bid%7D%3Fpaginate%3DinLinks&limit=%2Fidentities%2F%7Bversion%7D%2F%7Bid%7D%3Flimit%3D10&offset=%2Fidentities%2F%7Bversion%7D%2F%7Bid%7D%3Foffset%3D0";
String Value;
HttpClient httpClient = HttpClientBuilder.create().build();
HttpGet request = new HttpGet(path);
request.addHeader("Authorization", "Bearer <ACCESS_TOKEN>");
HttpResponse response = httpClient.execute(request);
try {
Value = EntityUtils.toString(response.getEntity()).toString();
if (Value.charAt(0) != '{' && Value.charAt(0) != '[')
Value = "\"" + Value + "\"" ;
} catch (Exception ex) {
Value = "{}";
}
StatusLine status = response.getStatusLine();
System.out.printf("{\"raw_body\":%s,\n\"status\":\"%s\",\n\"code\":\"%s\"}", Value, status, status.getStatusCode());
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
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"
}
}
],
"pagination": {
"inLinks": {
"links": [
{
"rel": "first",
"href": "https://api-sandbox.oftrust.net/identities/v1/e153e200-14d5-43ce-95dc-2db22ac6767f?offset=0&limit=100"
},
{
"rel": "self",
"href": "https://api-sandbox.oftrust.net/identities/v1/e153e200-14d5-43ce-95dc-2db22ac6767f"
},
{
"rel": "last",
"href": "https://api-sandbox.oftrust.net/identities/v1/e153e200-14d5-43ce-95dc-2db22ac6767f?offset=0&limit=100"
}
],
"hasMore": false,
"totalCount": 1
},
"outLinks": {
"links": [
{
"rel": "first",
"href": "https://api-sandbox.oftrust.net/identities/v1/e153e200-14d5-43ce-95dc-2db22ac6767f?offset=0&limit=100"
},
{
"rel": "self",
"href": "https://api-sandbox.oftrust.net/identities/v1/e153e200-14d5-43ce-95dc-2db22ac6767f"
},
{
"rel": "last",
"href": "https://api-sandbox.oftrust.net/identities/v1/e153e200-14d5-43ce-95dc-2db22ac6767f?offset=0&limit=100"
}
],
"hasMore": false,
"totalCount": 1
}
}
}
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 |
inLinks | query | Whether to return the inbound links or not. 1=return, 0=do not return. Defaults to 1. | No | integer |
outLinks | query | Whether to return the outbound links or not. 1=return, 0=do not return. Defaults to 1. | No | integer |
paginate | query | Which links to paginate. "inLinks" or "outLinks" or both "inLinks,outLinks". Defaults to "inLinks,outLinks" meaning that both link directions will be paginated. | No | string |
limit | query | The amount of in- and out links to return in the response. E.g. 10, will return 10 in- and out links. Defaults to 100. This value must be between 1 and 1000. | No | integer |
offset | query | The offset how many in- and out links to skip. E.g. 10 will skip the first 10 links. Defaults to 0. | No | integer |
Responses
Code | Description |
---|---|
200 | |
401 | |
404 | |
422 |
put
Description: Update an identity by id. Requires the write
permission on the
identity.
HTTP Request
Do you need help in using the PUT /identities/v1/{id} ?
Checkout existing questions & answers Ask a question in Stack Overflow Did we miss something? Make a wish! Example for: PUT /identities/v1/{id}
import requests
headers = {
"Authorization": "Bearer <ACCESS_TOKEN>",
"Content-Type": "application/json"
}
body = {
"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=body
)
print({
'raw_body': response.text,
'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));
});
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPut;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.apache.http.StatusLine;
public class Java {
public static void main(String[] args) {
try {
String path = "https://api-sandbox.oftrust.net/identities/v1/{id}";
StringEntity params = new StringEntity("{ \"context\": \"https://standards.lifeengine.io/v1/Context/Identity/Group/\", \"type\": \"Group\", \"data\": { \"name\": \"Company Oy\" }}");
String Value;
HttpClient httpClient = HttpClientBuilder.create().build();
HttpPut request = new HttpPut(path);
request.addHeader("Authorization", "Bearer <ACCESS_TOKEN>");
request.addHeader("Content-Type", "application/json");
request.setEntity(params);
HttpResponse response = httpClient.execute(request);
try {
Value = EntityUtils.toString(response.getEntity()).toString();
if (Value.charAt(0) != '{' && Value.charAt(0) != '[')
Value = "\"" + Value + "\"" ;
} catch (Exception ex) {
Value = "{}";
}
StatusLine status = response.getStatusLine();
System.out.printf("{\"raw_body\":%s,\n\"status\":\"%s\",\n\"code\":\"%s\"}", Value, status, status.getStatusCode());
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
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"
}
}
],
"pagination": {
"inLinks": {
"links": [
{
"rel": "first",
"href": "https://api-sandbox.oftrust.net/identities/v1/e153e200-14d5-43ce-95dc-2db22ac6767f?offset=0&limit=100"
},
{
"rel": "self",
"href": "https://api-sandbox.oftrust.net/identities/v1/e153e200-14d5-43ce-95dc-2db22ac6767f"
},
{
"rel": "last",
"href": "https://api-sandbox.oftrust.net/identities/v1/e153e200-14d5-43ce-95dc-2db22ac6767f?offset=0&limit=100"
}
],
"hasMore": false,
"totalCount": 1
},
"outLinks": {
"links": [
{
"rel": "first",
"href": "https://api-sandbox.oftrust.net/identities/v1/e153e200-14d5-43ce-95dc-2db22ac6767f?offset=0&limit=100"
},
{
"rel": "self",
"href": "https://api-sandbox.oftrust.net/identities/v1/e153e200-14d5-43ce-95dc-2db22ac6767f"
},
{
"rel": "last",
"href": "https://api-sandbox.oftrust.net/identities/v1/e153e200-14d5-43ce-95dc-2db22ac6767f?offset=0&limit=100"
}
],
"hasMore": false,
"totalCount": 1
}
}
}
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 |
Body properties
* - Required property
- object identity
- string context * - The URL to the context for this identity
- string type * - The type of the identity
- object data * - Additional data for the identity, as defined in the context.
- string name - The name of the identity
Responses
Code | Description |
---|---|
200 | |
401 | |
403 | |
404 | |
422 |
delete
Description: Delete an identity by id. Requires the manage
permission on the
identity.
HTTP Request
Do you need help in using the DELETE /identities/v1/{id} ?
Checkout existing questions & answers Ask a question in Stack Overflow Did we miss something? Make a wish! 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));
});
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpDelete;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.apache.http.StatusLine;
public class Java {
public static void main(String[] args) {
try {
String path = "https://api-sandbox.oftrust.net/identities/v1/{id}";
String Value;
HttpClient httpClient = HttpClientBuilder.create().build();
HttpDelete request = new HttpDelete(path);
request.addHeader("Authorization", "Bearer <ACCESS_TOKEN>");
HttpResponse response = httpClient.execute(request);
try {
Value = EntityUtils.toString(response.getEntity()).toString();
if (Value.charAt(0) != '{' && Value.charAt(0) != '[')
Value = "\"" + Value + "\"" ;
} catch (Exception ex) {
Value = "{}";
}
StatusLine status = response.getStatusLine();
System.out.printf("{\"raw_body\":%s,\n\"status\":\"%s\",\n\"code\":\"%s\"}", Value, status, status.getStatusCode());
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
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 | |
401 | |
403 | |
404 | |
422 |
/identities/v1/{from_identity}/link/{to_identity}
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"
}
body = {
"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=body
)
print({
'raw_body': response.text,
'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));
});
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.apache.http.StatusLine;
public class Java {
public static void main(String[] args) {
try {
String path = "https://api-sandbox.oftrust.net/identities/v1/{from_identity}/link/{to_identity}";
StringEntity params = new StringEntity("{ \"context\": \"https://standards.lifeengine.io/v1/Context/Link/Role/MemberOf/\", \"type\": \"MemberOf\"}");
String Value;
HttpClient httpClient = HttpClientBuilder.create().build();
HttpPost request = new HttpPost(path);
request.addHeader("Authorization", "Bearer <ACCESS_TOKEN>");
request.addHeader("Content-Type", "application/json");
request.setEntity(params);
HttpResponse response = httpClient.execute(request);
try {
Value = EntityUtils.toString(response.getEntity()).toString();
if (Value.charAt(0) != '{' && Value.charAt(0) != '[')
Value = "\"" + Value + "\"" ;
} catch (Exception ex) {
Value = "{}";
}
StatusLine status = response.getStatusLine();
System.out.printf("{\"raw_body\":%s,\n\"status\":\"%s\",\n\"code\":\"%s\"}", Value, status, status.getStatusCode());
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
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 |
Body properties
* - Required property
- object link
- string context * - The URL to the context for this link
- string type * - The type of the link
- object data - Additional key-value data for the link.
Responses
Code | Description |
---|---|
201 | |
401 | |
403 | |
404 | |
409 | |
422 |
/identities/v1/{from_identity}/link/{to_identity}/{type}
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.text,
'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));
});
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.apache.http.StatusLine;
public class Java {
public static void main(String[] args) {
try {
String path = "https://api-sandbox.oftrust.net/identities/v1/{from_identity}/link/{to_identity}/{type}";
String Value;
HttpClient httpClient = HttpClientBuilder.create().build();
HttpGet request = new HttpGet(path);
request.addHeader("Authorization", "Bearer <ACCESS_TOKEN>");
HttpResponse response = httpClient.execute(request);
try {
Value = EntityUtils.toString(response.getEntity()).toString();
if (Value.charAt(0) != '{' && Value.charAt(0) != '[')
Value = "\"" + Value + "\"" ;
} catch (Exception ex) {
Value = "{}";
}
StatusLine status = response.getStatusLine();
System.out.printf("{\"raw_body\":%s,\n\"status\":\"%s\",\n\"code\":\"%s\"}", Value, status, status.getStatusCode());
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
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 | |
401 | |
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"
}
body = {
"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=body
)
print({
'raw_body': response.text,
'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));
});
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPut;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.apache.http.StatusLine;
public class Java {
public static void main(String[] args) {
try {
String path = "https://api-sandbox.oftrust.net/identities/v1/{from_identity}/link/{to_identity}/{type}";
StringEntity params = new StringEntity("{ \"context\": \"https://example.com/contexts/type.jsonld\", \"type\": \"Owner\"}");
String Value;
HttpClient httpClient = HttpClientBuilder.create().build();
HttpPut request = new HttpPut(path);
request.addHeader("Authorization", "Bearer <ACCESS_TOKEN>");
request.addHeader("Content-Type", "application/json");
request.setEntity(params);
HttpResponse response = httpClient.execute(request);
try {
Value = EntityUtils.toString(response.getEntity()).toString();
if (Value.charAt(0) != '{' && Value.charAt(0) != '[')
Value = "\"" + Value + "\"" ;
} catch (Exception ex) {
Value = "{}";
}
StatusLine status = response.getStatusLine();
System.out.printf("{\"raw_body\":%s,\n\"status\":\"%s\",\n\"code\":\"%s\"}", Value, status, status.getStatusCode());
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
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 | |
401 | |
403 | |
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));
});
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpDelete;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.apache.http.StatusLine;
public class Java {
public static void main(String[] args) {
try {
String path = "https://api-sandbox.oftrust.net/identities/v1/{from_identity}/link/{to_identity}/{type}";
String Value;
HttpClient httpClient = HttpClientBuilder.create().build();
HttpDelete request = new HttpDelete(path);
request.addHeader("Authorization", "Bearer <ACCESS_TOKEN>");
HttpResponse response = httpClient.execute(request);
try {
Value = EntityUtils.toString(response.getEntity()).toString();
if (Value.charAt(0) != '{' && Value.charAt(0) != '[')
Value = "\"" + Value + "\"" ;
} catch (Exception ex) {
Value = "{}";
}
StatusLine status = response.getStatusLine();
System.out.printf("{\"raw_body\":%s,\n\"status\":\"%s\",\n\"code\":\"%s\"}", Value, status, status.getStatusCode());
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
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 | |
401 | |
403 | |
404 | |
422 |
/identities/v1/{id}/links
get
Description: List all inbound and outbound links for a given identity.
HTTP Request
Do you need help in using the GET /identities/v1/{id}/links ?
Checkout existing questions & answers Ask a question in Stack Overflow Did we miss something? Make a wish! 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&limit=%2Fidentities%2F%7Bversion%7D%2F%7Bid%7D%2Flinks%3Flimit%3D10&offset=%2Fidentities%2F%7Bversion%7D%2F%7Bid%7D%2Flinks%3Foffset%3D0',
headers=headers
)
print({
'raw_body': response.text,
'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&limit=%2Fidentities%2F%7Bversion%7D%2F%7Bid%7D%2Flinks%3Flimit%3D10&offset=%2Fidentities%2F%7Bversion%7D%2F%7Bid%7D%2Flinks%3Foffset%3D0"
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&limit=%2Fidentities%2F%7Bversion%7D%2F%7Bid%7D%2Flinks%3Flimit%3D10&offset=%2Fidentities%2F%7Bversion%7D%2F%7Bid%7D%2Flinks%3Foffset%3D0")
.then(({ raw_body, status, code }) => {
// output response to console as JSON
console.log(JSON.stringify({ raw_body, status, code }, null, 4));
});
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.apache.http.StatusLine;
public class Java {
public static void main(String[] args) {
try {
String path = "https://api-sandbox.oftrust.net/identities/v1/{id}/links?type=%2Fidentities%2F%7Bversion%7D%2F%7Bid%7D%2Flinks%3Ftype%3DOwner&limit=%2Fidentities%2F%7Bversion%7D%2F%7Bid%7D%2Flinks%3Flimit%3D10&offset=%2Fidentities%2F%7Bversion%7D%2F%7Bid%7D%2Flinks%3Foffset%3D0";
String Value;
HttpClient httpClient = HttpClientBuilder.create().build();
HttpGet request = new HttpGet(path);
request.addHeader("Authorization", "Bearer <ACCESS_TOKEN>");
HttpResponse response = httpClient.execute(request);
try {
Value = EntityUtils.toString(response.getEntity()).toString();
if (Value.charAt(0) != '{' && Value.charAt(0) != '[')
Value = "\"" + Value + "\"" ;
} catch (Exception ex) {
Value = "{}";
}
StatusLine status = response.getStatusLine();
System.out.printf("{\"raw_body\":%s,\n\"status\":\"%s\",\n\"code\":\"%s\"}", Value, status, status.getStatusCode());
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
The above example should return
JSON
structured like this:
The above example should return JSON structured like this:
HTTP/1.0 200
{
"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": "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"
}
}
],
"pagination": {
"inLinks": {
"links": [
{
"rel": "first",
"href": "https://api-sandbox.oftrust.net/identities/v1/2584bdd7-1cb2-48ed-a106-2a1b817cf909/links?offset=0&limit=100"
},
{
"rel": "self",
"href": "https://api-sandbox.oftrust.net/identities/v1/2584bdd7-1cb2-48ed-a106-2a1b817cf909/links"
},
{
"rel": "last",
"href": "https://api-sandbox.oftrust.net/identities/v1/2584bdd7-1cb2-48ed-a106-2a1b817cf909/links?offset=0&limit=100"
}
],
"hasMore": false,
"totalCount": 1
},
"outLinks": {
"links": [
{
"rel": "first",
"href": "https://api-sandbox.oftrust.net/identities/v1/2584bdd7-1cb2-48ed-a106-2a1b817cf909/links?offset=0&limit=100"
},
{
"rel": "self",
"href": "https://api-sandbox.oftrust.net/identities/v1/2584bdd7-1cb2-48ed-a106-2a1b817cf909/links"
},
{
"rel": "last",
"href": "https://api-sandbox.oftrust.net/identities/v1/2584bdd7-1cb2-48ed-a106-2a1b817cf909/links?offset=0&limit=100"
}
],
"hasMore": false,
"totalCount": 1
}
}
}
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=OwnerOf , will list only the links of @type: "OwnerOf" . |
No | string |
limit | query | The amount of records to return in the response. E.g. 10, will return 10 records. Defaults to 100. This value must be between 1 and 1000. | No | integer |
offset | query | The offset how many records to skip. E.g. 10 will skip the first 10 records. Defaults to 0. | No | integer |
Responses
Code | Description |
---|---|
200 | |
401 | |
404 | |
422 |
/identities/v1/discovery
get
Description: Discover identities in the identity network.
HTTP Request
Do you need help in using the GET /identities/v1/discovery ?
Checkout existing questions & answers Ask a question in Stack Overflow Did we miss something? Make a wish! Example for: GET /identities/v1/discovery
import requests
headers = {
"Authorization": "Bearer <ACCESS_TOKEN>"
}
response = requests.get(
'https://api-sandbox.oftrust.net/identities/v1/discovery',
params='fromId=fc3bced4-a132-4293-9240-4d0f02277e2e&linkContext=https%3A%2F%2Fstandards.oftrust.net%2Fv1%2FContext%2FLink%2FBelongsTo%2F&linkType=BelongsTo&identityContext=https%3A%2F%2Fstandards.oftrust.net%2Fv1%2FContext%2FIdentity%2FDevice%2FSensor%2F&identityType=Apartment&linkDirection=IN&maxDepth=2&offset=10&limit=20',
headers=headers
)
print({
'raw_body': response.text,
'status': response.status_code,
'code': response.status_code
})
curl -i -X GET \
-H "Authorization: Bearer <ACCESS_TOKEN>" \
"https://api-sandbox.oftrust.net/identities/v1/discovery?fromId=fc3bced4-a132-4293-9240-4d0f02277e2e&linkContext=https%3A%2F%2Fstandards.oftrust.net%2Fv1%2FContext%2FLink%2FBelongsTo%2F&linkType=BelongsTo&identityContext=https%3A%2F%2Fstandards.oftrust.net%2Fv1%2FContext%2FIdentity%2FDevice%2FSensor%2F&identityType=Apartment&linkDirection=IN&maxDepth=2&offset=10&limit=20"
const unirest = require("unirest");
const headers = {
"Authorization": "Bearer <ACCESS_TOKEN>"
};
unirest
.get("https://api-sandbox.oftrust.net/identities/v1/discovery")
.headers(headers)
.query("fromId=fc3bced4-a132-4293-9240-4d0f02277e2e&linkContext=https%3A%2F%2Fstandards.oftrust.net%2Fv1%2FContext%2FLink%2FBelongsTo%2F&linkType=BelongsTo&identityContext=https%3A%2F%2Fstandards.oftrust.net%2Fv1%2FContext%2FIdentity%2FDevice%2FSensor%2F&identityType=Apartment&linkDirection=IN&maxDepth=2&offset=10&limit=20")
.then(({ raw_body, status, code }) => {
// output response to console as JSON
console.log(JSON.stringify({ raw_body, status, code }, null, 4));
});
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.apache.http.StatusLine;
public class Java {
public static void main(String[] args) {
try {
String path = "https://api-sandbox.oftrust.net/identities/v1/discovery?fromId=fc3bced4-a132-4293-9240-4d0f02277e2e&linkContext=https%3A%2F%2Fstandards.oftrust.net%2Fv1%2FContext%2FLink%2FBelongsTo%2F&linkType=BelongsTo&identityContext=https%3A%2F%2Fstandards.oftrust.net%2Fv1%2FContext%2FIdentity%2FDevice%2FSensor%2F&identityType=Apartment&linkDirection=IN&maxDepth=2&offset=10&limit=20";
String Value;
HttpClient httpClient = HttpClientBuilder.create().build();
HttpGet request = new HttpGet(path);
request.addHeader("Authorization", "Bearer <ACCESS_TOKEN>");
HttpResponse response = httpClient.execute(request);
try {
Value = EntityUtils.toString(response.getEntity()).toString();
if (Value.charAt(0) != '{' && Value.charAt(0) != '[')
Value = "\"" + Value + "\"" ;
} catch (Exception ex) {
Value = "{}";
}
StatusLine status = response.getStatusLine();
System.out.printf("{\"raw_body\":%s,\n\"status\":\"%s\",\n\"code\":\"%s\"}", Value, status, status.getStatusCode());
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
The above example should return
JSON
structured like this:
The above example should return JSON structured like this:
HTTP/1.0 200
{
"identities": {
"eccbcc62-37e2-4014-8233-d077fce7bac9": {
"@context": "https://standards.oftrust.net/v1/Context/Identity/Device/Sensor/TemperatureSensor/",
"@type": "TemperatureSensor",
"@id": "eccbcc62-37e2-4014-8233-d077fce7bac9",
"data": {
"name": "Temperature sensor",
"codeLocal": "local code"
},
"metadata": {
"createdAt": "2019-09-17T12:53:25+00:00",
"createdBy": "f773dafe-20c0-4a25-aa3e-9da0b81b9304",
"updatedAt": "2019-09-17T12:53:25+00:00",
"updatedBy": "f773dafe-20c0-4a25-aa3e-9da0b81b9304"
}
}
},
"pagination": {
"links": [
{
"rel": "first",
"href": "https://api-sandbox.oftrust.net/identities/v1/discovery?offset=0&limit=1&fromId=fc3bced4-a132-4293-9240-4d0f02277e2e&linkContext=https%3A%2F%2Fstandards.oftrust.net%2Fv1%2FContext%2FLink%2FBelongsTo%2F&identityContext=https%3A%2F%2Fstandards.oftrust.net%2Fv1%2FContext%2FIdentity%2FDevice%2FSensor%2F&linkDirection=IN&maxDepth=3"
},
{
"rel": "self",
"href": "https://api-sandbox.oftrust.net/identities/v1/discovery?fromId=fc3bced4-a132-4293-9240-4d0f02277e2e&linkContext=https%3A%2F%2Fstandards.oftrust.net%2Fv1%2FContext%2FLink%2FBelongsTo%2F&identityContext=https%3A%2F%2Fstandards.oftrust.net%2Fv1%2FContext%2FIdentity%2FDevice%2FSensor%2F&linkDirection=IN&maxDepth=3&offset=0&limit=1"
},
{
"rel": "last",
"href": "https://api-sandbox.oftrust.net/identities/v1/discovery?offset=173&limit=1&fromId=fc3bced4-a132-4293-9240-4d0f02277e2e&linkContext=https%3A%2F%2Fstandards.oftrust.net%2Fv1%2FContext%2FLink%2FBelongsTo%2F&identityContext=https%3A%2F%2Fstandards.oftrust.net%2Fv1%2FContext%2FIdentity%2FDevice%2FSensor%2F&linkDirection=IN&maxDepth=3"
},
{
"rel": "next",
"href": "https://api-sandbox.oftrust.net/identities/v1/discovery?offset=1&limit=1&fromId=fc3bced4-a132-4293-9240-4d0f02277e2e&linkContext=https%3A%2F%2Fstandards.oftrust.net%2Fv1%2FContext%2FLink%2FBelongsTo%2F&identityContext=https%3A%2F%2Fstandards.oftrust.net%2Fv1%2FContext%2FIdentity%2FDevice%2FSensor%2F&linkDirection=IN&maxDepth=3"
}
],
"hasMore": true,
"totalCount": 174
}
}
GET /identities/v1/discovery
Parameters
Name | Located in | Description | Required | Type |
---|---|---|---|---|
Authorization | header | The Authorization header, MUST be Bearer {{access_token}} |
Yes | string |
fromId | query | The starting identity to traverse from, e.g. the Building ID. | Yes | string |
linkContext | query | The link context to traverse (the ending forward slash / is optional). | No | string |
linkType | query | The link type to traverse. Only one (and at least one) of linkContext or linkType must be specified. |
No | string |
identityContext | query | The identity context to search for. The context MUST end with a forward slash /. | No | string |
identityType | query | The identity type to search for. Only one (and at least one) of identityContext or identityType must be specified. |
No | string |
linkDirection | query | The direction to traverse from the building, one of "IN" or "OUT". When using "IN" it means that the BelongsTo links are incoming links towards the Building: (Building) <-- BelongsTo -- (Storey) When using "OUT" it means that the BelongsTo links are outgoing from the Building (please note that this is just an example, the data model for buildings and storeys are IN): (Building) -- BelongsTo --> (Storey) |
Yes | string |
maxDepth | query | The traversal max depth. This means that e.g. maxDepth=3 does three link hops in the traversal: (Building) <-- BelongsTo -- (Storey) <-- BelongsTo -- (Room) <-- BelongsTo -- (Sensor) If searching for Sensors but given maxDepth of 2, nothing will be returned since there are 3 links between the building and sensors. This value must be between 1 and 5, but defaults to 2. |
Yes | integer |
offset | query | The offset used for pagination. Defaults to 0, meaning starting from the first record. Given an offset of 10 means that the next 10 records are returned. | Yes | integer |
limit | query | How many records to return, used for pagination. Defaults to 20 records. Given a limit of 100 will return 100 records. This value must be between 1 and 1000. | Yes | integer |
Responses
Code | Description |
---|---|
200 | |
401 | |
404 | |
422 | |
500 |
/identities/v1/dataDiscovery
get
Description: Discover data products in the identity network.
HTTP Request
Do you need help in using the GET /identities/v1/dataDiscovery ?
Checkout existing questions & answers Ask a question in Stack Overflow Did we miss something? Make a wish! Example for: GET /identities/v1/dataDiscovery
import requests
headers = {
"Authorization": "Bearer <ACCESS_TOKEN>"
}
response = requests.get(
'https://api-sandbox.oftrust.net/identities/v1/dataDiscovery',
params='fromId=fc3bced4-a132-4293-9240-4d0f02277e2e&linkContext=https%3A%2F%2Fstandards.oftrust.net%2Fv1%2FContext%2FLink%2FBelongsTo%2F&linkType=BelongsTo&identityContext=https%3A%2F%2Fstandards.oftrust.net%2Fv1%2FContext%2FIdentity%2FDevice%2FSensor%2F&identityType=Apartment&linkDirection=IN&maxDepth=2&offset=10&limit=20&atDataProductContext=https%3A%2F%2Fstandards.oftrust.net%2Fv1%2FContext%2FLink%2FAtDataProduct%2F&atDataProductType=AtDataProduct',
headers=headers
)
print({
'raw_body': response.text,
'status': response.status_code,
'code': response.status_code
})
curl -i -X GET \
-H "Authorization: Bearer <ACCESS_TOKEN>" \
"https://api-sandbox.oftrust.net/identities/v1/dataDiscovery?fromId=fc3bced4-a132-4293-9240-4d0f02277e2e&linkContext=https%3A%2F%2Fstandards.oftrust.net%2Fv1%2FContext%2FLink%2FBelongsTo%2F&linkType=BelongsTo&identityContext=https%3A%2F%2Fstandards.oftrust.net%2Fv1%2FContext%2FIdentity%2FDevice%2FSensor%2F&identityType=Apartment&linkDirection=IN&maxDepth=2&offset=10&limit=20&atDataProductContext=https%3A%2F%2Fstandards.oftrust.net%2Fv1%2FContext%2FLink%2FAtDataProduct%2F&atDataProductType=AtDataProduct"
const unirest = require("unirest");
const headers = {
"Authorization": "Bearer <ACCESS_TOKEN>"
};
unirest
.get("https://api-sandbox.oftrust.net/identities/v1/dataDiscovery")
.headers(headers)
.query("fromId=fc3bced4-a132-4293-9240-4d0f02277e2e&linkContext=https%3A%2F%2Fstandards.oftrust.net%2Fv1%2FContext%2FLink%2FBelongsTo%2F&linkType=BelongsTo&identityContext=https%3A%2F%2Fstandards.oftrust.net%2Fv1%2FContext%2FIdentity%2FDevice%2FSensor%2F&identityType=Apartment&linkDirection=IN&maxDepth=2&offset=10&limit=20&atDataProductContext=https%3A%2F%2Fstandards.oftrust.net%2Fv1%2FContext%2FLink%2FAtDataProduct%2F&atDataProductType=AtDataProduct")
.then(({ raw_body, status, code }) => {
// output response to console as JSON
console.log(JSON.stringify({ raw_body, status, code }, null, 4));
});
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.apache.http.StatusLine;
public class Java {
public static void main(String[] args) {
try {
String path = "https://api-sandbox.oftrust.net/identities/v1/dataDiscovery?fromId=fc3bced4-a132-4293-9240-4d0f02277e2e&linkContext=https%3A%2F%2Fstandards.oftrust.net%2Fv1%2FContext%2FLink%2FBelongsTo%2F&linkType=BelongsTo&identityContext=https%3A%2F%2Fstandards.oftrust.net%2Fv1%2FContext%2FIdentity%2FDevice%2FSensor%2F&identityType=Apartment&linkDirection=IN&maxDepth=2&offset=10&limit=20&atDataProductContext=https%3A%2F%2Fstandards.oftrust.net%2Fv1%2FContext%2FLink%2FAtDataProduct%2F&atDataProductType=AtDataProduct";
String Value;
HttpClient httpClient = HttpClientBuilder.create().build();
HttpGet request = new HttpGet(path);
request.addHeader("Authorization", "Bearer <ACCESS_TOKEN>");
HttpResponse response = httpClient.execute(request);
try {
Value = EntityUtils.toString(response.getEntity()).toString();
if (Value.charAt(0) != '{' && Value.charAt(0) != '[')
Value = "\"" + Value + "\"" ;
} catch (Exception ex) {
Value = "{}";
}
StatusLine status = response.getStatusLine();
System.out.printf("{\"raw_body\":%s,\n\"status\":\"%s\",\n\"code\":\"%s\"}", Value, status, status.getStatusCode());
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
The above example should return
JSON
structured like this:
The above example should return JSON structured like this:
HTTP/1.0 200
{
"dataProducts": {
"data-product-product-code": {
"eccbcc62-37e2-4014-8233-d077fce7bac9": "sensor id 1",
"958f5881-ee48-4a5a-a6ed-bad100ec72ac": "sensor id 2"
}
},
"pagination": {
"links": [
{
"rel": "first",
"href": "https://api-sandbox.oftrust.net/identities/v1/dataDiscovery?offset=0&limit=10&fromId=fc3bced4-a132-4293-9240-4d0f02277e2e&linkContext=https%3A%2F%2Fstandards.oftrust.net%2Fv1%2FContext%2FLink%2FBelongsTo%2F&identityContext=https%3A%2F%2Fstandards.oftrust.net%2Fv1%2FContext%2FIdentity%2FDevice%2FSensor%2F&linkDirection=IN&maxDepth=3"
},
{
"rel": "self",
"href": "https://api-sandbox.oftrust.net/identities/v1/dataDiscovery?fromId=fc3bced4-a132-4293-9240-4d0f02277e2e&linkContext=https%3A%2F%2Fstandards.oftrust.net%2Fv1%2FContext%2FLink%2FBelongsTo%2F&identityContext=https%3A%2F%2Fstandards.oftrust.net%2Fv1%2FContext%2FIdentity%2FDevice%2FSensor%2F&linkDirection=IN&maxDepth=3&offset=0&limit=10"
},
{
"rel": "last",
"href": "https://api-sandbox.oftrust.net/identities/v1/dataDiscovery?offset=0&limit=10&fromId=fc3bced4-a132-4293-9240-4d0f02277e2e&linkContext=https%3A%2F%2Fstandards.oftrust.net%2Fv1%2FContext%2FLink%2FBelongsTo%2F&identityContext=https%3A%2F%2Fstandards.oftrust.net%2Fv1%2FContext%2FIdentity%2FDevice%2FSensor%2F&linkDirection=IN&maxDepth=3"
}
],
"hasMore": false,
"totalCount": 2
}
}
GET /identities/v1/dataDiscovery
Parameters
Name | Located in | Description | Required | Type |
---|---|---|---|---|
Authorization | header | The Authorization header, MUST be Bearer {{access_token}} |
Yes | string |
fromId | query | The starting identity to traverse from, e.g. the Building ID. | Yes | string |
linkContext | query | The link context to traverse. The context MUST end with a forward slash /. | No | string |
linkType | query | The link type to traverse. Only one (and at least one) of linkContext or linkType must be specified. |
No | string |
identityContext | query | The identity context to search for. The context MUST end with a forward slash /. | No | string |
identityType | query | The identity type to search for. Only one (and at least one) of identityContext or identityType must be specified. |
No | string |
linkDirection | query | The direction to traverse from the building, one of "IN" or "OUT". When using "IN" it means that the BelongsTo links are incoming links towards the Building: (Building) <-- BelongsTo -- (Storey) When using "OUT" it means that the BelongsTo links are outgoing from the Building (please note that this is just an example, the data model for buildings and storeys are IN): (Building) -- BelongsTo --> (Storey) |
Yes | string |
maxDepth | query | The traversal max depth. This means that e.g. maxDepth=3 does three link hops in the traversal: (Building) <-- BelongsTo -- (Storey) <-- BelongsTo -- (Room) <-- BelongsTo -- (Sensor) If searching for Sensors but given maxDepth of 2, nothing will be returned since there are 3 links between the building and sensors. This value must be between 1 and 5, but defaults to 2. |
Yes | integer |
offset | query | The offset used for pagination. Defaults to 0, meaning starting from the first record. Given an offset of 10 means that the next 10 records are returned. | Yes | integer |
limit | query | How many records to return, used for pagination. Defaults to 20 records. Given a limit of 100 will return 100 records. This value must be between 1 and 1000. | Yes | integer |
atDataProductContext | query | The link between an identity and data product, that determines the capabilities and other information about the identity at the given data product. You can provide a context for this AtDataProduct type link. |
No | string |
atDataProductType | query | The type of the link between an identity and data product. If no value is given for atDataProductContext or atDataProductType , this defaults to AtDataProduct . Only one of atDataProductContext or atDataProductType can be specified at a time. |
No | string |
Responses
Code | Description |
---|---|
200 | |
401 | |
404 | |
422 | |
500 |
Login
Get Login related resources:
The Login portal API provides means for completing OAuth flow and reading
information about logged in user.
Note: All endpoints for Login portal API have following base URL -
https://login.oftrust.net/api
Version: v1
/exchangeToken
post
Description: Authorization flow, convert authorization code to access token.
HTTP Request
Do you need help in using the POST /exchangeToken ?
Checkout existing questions & answers Ask a question in Stack Overflow Did we miss something? Make a wish! Example for: POST /exchangeToken
import requests
headers = {
"Content-Type": "application/x-www-form-urlencoded",
"Accept": "application/json"
}
body = {}
response = requests.post(
'https://api-sandbox.oftrust.net/exchangeToken',
headers=headers,
json=body
)
print({
'raw_body': response.text,
'status': response.status_code,
'code': response.status_code
})
curl -i -X POST \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Accept: application/json" \
-d \
"{}" "https://api-sandbox.oftrust.net/exchangeToken"
const unirest = require("unirest");
const headers = {
"Content-Type": "application/x-www-form-urlencoded",
"Accept": "application/json"
};
const body = {};
unirest
.post("https://api-sandbox.oftrust.net/exchangeToken")
.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));
});
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.apache.http.StatusLine;
public class Java {
public static void main(String[] args) {
try {
String path = "https://api-sandbox.oftrust.net/exchangeToken";
StringEntity params = new StringEntity("{}");
String Value;
HttpClient httpClient = HttpClientBuilder.create().build();
HttpPost request = new HttpPost(path);
request.addHeader("Content-Type", "application/x-www-form-urlencoded");
request.addHeader("Accept", "application/json");
request.setEntity(params);
HttpResponse response = httpClient.execute(request);
try {
Value = EntityUtils.toString(response.getEntity()).toString();
if (Value.charAt(0) != '{' && Value.charAt(0) != '[')
Value = "\"" + Value + "\"" ;
} catch (Exception ex) {
Value = "{}";
}
StatusLine status = response.getStatusLine();
System.out.printf("{\"raw_body\":%s,\n\"status\":\"%s\",\n\"code\":\"%s\"}", Value, status, status.getStatusCode());
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
The above example should return
JSON
structured like this:
The above example should return JSON structured like this:
HTTP/1.0 200
{
"access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJzY29wZSI6bnVsbCwiZXhwIjoxNTQ1MTQzMzY1LCJzdWIiOiIwYzMyYjQ3MC03ZmRmLTQ5MWYtYjA1NS04NmIyMzYxZjljZTkiLCJpc3MiOm51bGwsImF1ZCI6IjdjMDM3MjNjLWJiZWYtNDlkMS1hNmFiLTk2OGYzOGNlODRlNiIsImlhdCI6MTU0NTA1Njk2NS4wODE2Njh9.of5sEZBpzWHqjLd2LPsQZXfS1uQWLOeqdvFtqZtq8BwnCllpebX5MyjSaahOBLXBqyAhPxafEETfMZtyAe1-9P-6imvOTv8JDjw5AbNZelPAAflZHX89AcFCJpKuI603ZqywTTyIqdijVZArkNdEfGeQhJXoSmcDLElUnixw5rJF7FKdtCGjIP4aKazRxfn2DJOOhA1BazCR3xXV42OCgMsdiRYEJ2EhcUdlmA7OT-NjAgzOgS12zfVVEM9swwIVPPc27ewd4rmStJSUYHD2hHaRXQKmJqamJfA5W-vxEJH9G6UW3wwM--ROwYHMHcDfN2HIT-AqojMqitNHZr_AlrTQCpcv-BMA2uwg7DT8MMJ0bLrrdst7Eg_ha4U8iz4CgCTlu9MJEVFUzzLMTnMI8Cc74milBJ6xpHsgJItYjC1e4dVCs_5xxLfy44npg21TOX4Uds4uwLLOhy-gnBAVRzzmCD6nkGmAnHc7Kvck_uw7WHMUeHyMfa1LZoEQhOu0AenymKoHs6gH5anCUwBRAUUdTxXIAwDLod1Q-9Hz3_NBTqiV3Nh1Kn-WswWnA0GPIdKLHt0oI-PAZ0Y1CfL9otucvZtL7UR2qXZjEq8lSX0DVlpJX9ma7RFhcBu4evrTkKSfrdQVitXWiE0q1sSh1CeqlVtnVg6dfGuMKaoY9sA",
"expires_in": 86400,
"token_type": "Bearer",
"scope": "",
"refresh_token": "T2IlwUE7A66eidXpYXgYIT3ltoLez9"
}
POST /exchangeToken
Parameters
Name | Located in | Description | Required | Type |
---|---|---|---|---|
Content-Type | header | Yes | string | |
Accept | header | The Accept header, MUST be application/json |
Yes | string |
grant_type | formData | The grant type of the login, MUST be authorization_code . |
Yes | string |
redirect_uri | formData | The redirect URI used in the authorization flow. | Yes | string |
client_id | formData | ID of OAuth client or identity. | Yes | string |
code | formData | The authorization code to exchange to an access token. | Yes | string |
client_secret | formData | The authorization code to exchange to an access token. | Yes | string |
user_id | formData | ID of authorized user to provide ACL permissions to the platform | No | string |
state | formData | The optional state, e.g. CSRF token from the original request. | No | string |
Responses
Code | Description |
---|---|
200 | |
400 | |
401 | If e.g. the authorization code has expired. |
422 |
/me
get
Description: Get information about the currently logged in user.
HTTP Request
Do you need help in using the GET /me ?
Checkout existing questions & answers Ask a question in Stack Overflow Did we miss something? Make a wish! Example for: GET /me
import requests
headers = {
"Authorization": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJzY29wZSI6bnVsbCwiZXhwIjoxNTY4MTIwMDAwLCJzdWIiOiIzMzIzNzA2Ny1lNzJjLTRmMjYtYjc4Yi05ZjllMjM0YjJlN2QiLCJhdWQiOiJmNzczZGFmZS0yMGMwLTRhMjUtYWEzZS05ZGEwYjgxYjkzMDQiLCJ0eXBlIjoiVXNlciIsImlzcyI6IkxFIiwiaWF0IjoxNTY4MDMzNjAwLjAsInNjb3BlcyI6IiJ9.b_gMNIKODrLzfooYadqI2VJGTuc7c26x8S7OncpyXA6XtZP_E3rlI9H5ot84zQS9SqHdLk23JxKdCiQCtbTpYcLn8QcUlF7mWweQmq1ewanHPHhfSb6uileQNQKGnGEVe3V4a8Hy2x_d8rOYujwFA2sfxfcEZdArAnfK_IIHfWzC5zz78c3nrT5LeqE1BP1RHzpLKkc91rcLcwa0ldKTDQlGDdi6hBYneaMGToqF3yTQxd1v_4YHLGp3i4A_TZu8wrBMoWFvJburYp45itsyElatNSwFMkNz6L7w6sxDQWTB9MznUuhk90U6bD49GljhY-Ny0XgwEzzUHeyj8oJHbkxfrJHpDHl-uNBQyPohwVwyaDdh6BDFJgM3JHOlezJuH_RbMCcUa1XqwkGhZwdXYNP7fgpTkEDY41_oRwsrPx9jM9jlvG9VBTEPFijATy-IV-tXH0VJ4pLO0fJ1IgAuUMnQJOxgnUPSuI2g_zhMLojgDMJUo1kONAWdoc7UwLMeR33ALlohLBdfnm0-thLTR3GOpuXgWC5Nx067Fy4ydwTpObrDu2LnliRFNvE2fQOXOrQKAz_BmOonL7xc2jFv5w0L9MSDfZcLzJYrMk2MF5E_fNOSiw8qW82U5a6E42FkxogN1o85AApGxvUWkdfG4MjOlGrgqW1QhdEsJLNGV2YA"
}
response = requests.get(
'https://api-sandbox.oftrust.net/me',
headers=headers
)
print({
'raw_body': response.text,
'status': response.status_code,
'code': response.status_code
})
curl -i -X GET \
-H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJzY29wZSI6bnVsbCwiZXhwIjoxNTY4MTIwMDAwLCJzdWIiOiIzMzIzNzA2Ny1lNzJjLTRmMjYtYjc4Yi05ZjllMjM0YjJlN2QiLCJhdWQiOiJmNzczZGFmZS0yMGMwLTRhMjUtYWEzZS05ZGEwYjgxYjkzMDQiLCJ0eXBlIjoiVXNlciIsImlzcyI6IkxFIiwiaWF0IjoxNTY4MDMzNjAwLjAsInNjb3BlcyI6IiJ9.b_gMNIKODrLzfooYadqI2VJGTuc7c26x8S7OncpyXA6XtZP_E3rlI9H5ot84zQS9SqHdLk23JxKdCiQCtbTpYcLn8QcUlF7mWweQmq1ewanHPHhfSb6uileQNQKGnGEVe3V4a8Hy2x_d8rOYujwFA2sfxfcEZdArAnfK_IIHfWzC5zz78c3nrT5LeqE1BP1RHzpLKkc91rcLcwa0ldKTDQlGDdi6hBYneaMGToqF3yTQxd1v_4YHLGp3i4A_TZu8wrBMoWFvJburYp45itsyElatNSwFMkNz6L7w6sxDQWTB9MznUuhk90U6bD49GljhY-Ny0XgwEzzUHeyj8oJHbkxfrJHpDHl-uNBQyPohwVwyaDdh6BDFJgM3JHOlezJuH_RbMCcUa1XqwkGhZwdXYNP7fgpTkEDY41_oRwsrPx9jM9jlvG9VBTEPFijATy-IV-tXH0VJ4pLO0fJ1IgAuUMnQJOxgnUPSuI2g_zhMLojgDMJUo1kONAWdoc7UwLMeR33ALlohLBdfnm0-thLTR3GOpuXgWC5Nx067Fy4ydwTpObrDu2LnliRFNvE2fQOXOrQKAz_BmOonL7xc2jFv5w0L9MSDfZcLzJYrMk2MF5E_fNOSiw8qW82U5a6E42FkxogN1o85AApGxvUWkdfG4MjOlGrgqW1QhdEsJLNGV2YA" \
"https://api-sandbox.oftrust.net/me"
const unirest = require("unirest");
const headers = {
"Authorization": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJzY29wZSI6bnVsbCwiZXhwIjoxNTY4MTIwMDAwLCJzdWIiOiIzMzIzNzA2Ny1lNzJjLTRmMjYtYjc4Yi05ZjllMjM0YjJlN2QiLCJhdWQiOiJmNzczZGFmZS0yMGMwLTRhMjUtYWEzZS05ZGEwYjgxYjkzMDQiLCJ0eXBlIjoiVXNlciIsImlzcyI6IkxFIiwiaWF0IjoxNTY4MDMzNjAwLjAsInNjb3BlcyI6IiJ9.b_gMNIKODrLzfooYadqI2VJGTuc7c26x8S7OncpyXA6XtZP_E3rlI9H5ot84zQS9SqHdLk23JxKdCiQCtbTpYcLn8QcUlF7mWweQmq1ewanHPHhfSb6uileQNQKGnGEVe3V4a8Hy2x_d8rOYujwFA2sfxfcEZdArAnfK_IIHfWzC5zz78c3nrT5LeqE1BP1RHzpLKkc91rcLcwa0ldKTDQlGDdi6hBYneaMGToqF3yTQxd1v_4YHLGp3i4A_TZu8wrBMoWFvJburYp45itsyElatNSwFMkNz6L7w6sxDQWTB9MznUuhk90U6bD49GljhY-Ny0XgwEzzUHeyj8oJHbkxfrJHpDHl-uNBQyPohwVwyaDdh6BDFJgM3JHOlezJuH_RbMCcUa1XqwkGhZwdXYNP7fgpTkEDY41_oRwsrPx9jM9jlvG9VBTEPFijATy-IV-tXH0VJ4pLO0fJ1IgAuUMnQJOxgnUPSuI2g_zhMLojgDMJUo1kONAWdoc7UwLMeR33ALlohLBdfnm0-thLTR3GOpuXgWC5Nx067Fy4ydwTpObrDu2LnliRFNvE2fQOXOrQKAz_BmOonL7xc2jFv5w0L9MSDfZcLzJYrMk2MF5E_fNOSiw8qW82U5a6E42FkxogN1o85AApGxvUWkdfG4MjOlGrgqW1QhdEsJLNGV2YA"
};
unirest
.get("https://api-sandbox.oftrust.net/me")
.headers(headers)
.then(({ raw_body, status, code }) => {
// output response to console as JSON
console.log(JSON.stringify({ raw_body, status, code }, null, 4));
});
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.apache.http.StatusLine;
public class Java {
public static void main(String[] args) {
try {
String path = "https://api-sandbox.oftrust.net/me";
String Value;
HttpClient httpClient = HttpClientBuilder.create().build();
HttpGet request = new HttpGet(path);
request.addHeader("Authorization", "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJzY29wZSI6bnVsbCwiZXhwIjoxNTY4MTIwMDAwLCJzdWIiOiIzMzIzNzA2Ny1lNzJjLTRmMjYtYjc4Yi05ZjllMjM0YjJlN2QiLCJhdWQiOiJmNzczZGFmZS0yMGMwLTRhMjUtYWEzZS05ZGEwYjgxYjkzMDQiLCJ0eXBlIjoiVXNlciIsImlzcyI6IkxFIiwiaWF0IjoxNTY4MDMzNjAwLjAsInNjb3BlcyI6IiJ9.b_gMNIKODrLzfooYadqI2VJGTuc7c26x8S7OncpyXA6XtZP_E3rlI9H5ot84zQS9SqHdLk23JxKdCiQCtbTpYcLn8QcUlF7mWweQmq1ewanHPHhfSb6uileQNQKGnGEVe3V4a8Hy2x_d8rOYujwFA2sfxfcEZdArAnfK_IIHfWzC5zz78c3nrT5LeqE1BP1RHzpLKkc91rcLcwa0ldKTDQlGDdi6hBYneaMGToqF3yTQxd1v_4YHLGp3i4A_TZu8wrBMoWFvJburYp45itsyElatNSwFMkNz6L7w6sxDQWTB9MznUuhk90U6bD49GljhY-Ny0XgwEzzUHeyj8oJHbkxfrJHpDHl-uNBQyPohwVwyaDdh6BDFJgM3JHOlezJuH_RbMCcUa1XqwkGhZwdXYNP7fgpTkEDY41_oRwsrPx9jM9jlvG9VBTEPFijATy-IV-tXH0VJ4pLO0fJ1IgAuUMnQJOxgnUPSuI2g_zhMLojgDMJUo1kONAWdoc7UwLMeR33ALlohLBdfnm0-thLTR3GOpuXgWC5Nx067Fy4ydwTpObrDu2LnliRFNvE2fQOXOrQKAz_BmOonL7xc2jFv5w0L9MSDfZcLzJYrMk2MF5E_fNOSiw8qW82U5a6E42FkxogN1o85AApGxvUWkdfG4MjOlGrgqW1QhdEsJLNGV2YA");
HttpResponse response = httpClient.execute(request);
try {
Value = EntityUtils.toString(response.getEntity()).toString();
if (Value.charAt(0) != '{' && Value.charAt(0) != '[')
Value = "\"" + Value + "\"" ;
} catch (Exception ex) {
Value = "{}";
}
StatusLine status = response.getStatusLine();
System.out.printf("{\"raw_body\":%s,\n\"status\":\"%s\",\n\"code\":\"%s\"}", Value, status, status.getStatusCode());
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
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.oftrust.net/v2/Context/Identity/LegalParty/Person/",
"@type": "Person",
"@id": "33237067-14c3-4801-9e50-bf08406406e2",
"email": "user@example.com",
"role": "developer",
"firstName": "Anna",
"lastName": "Bar"
}
GET /me
Parameters
Name | Located in | Description | Required | Type |
---|---|---|---|---|
Authorization | header | The Authorization header, MUST be Bearer {{access_token}} |
Yes | string |
Responses
Code | Description |
---|---|
200 | |
403 |
Message
Get Message 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
Do you need help in using the POST /messages/v1 ?
Checkout existing questions & answers Ask a question in Stack Overflow Did we miss something? Make a wish! Example for: POST /messages/v1
import requests
headers = {
"Authorization": "Bearer <ACCESS_TOKEN>",
"Content-Type": "application/json"
}
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"
]
}
response = requests.post(
'https://api-sandbox.oftrust.net/messages/v1',
headers=headers,
json=body
)
print({
'raw_body': response.text,
'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/v1"
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/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));
});
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.apache.http.StatusLine;
public class Java {
public static void main(String[] args) {
try {
String path = "https://api-sandbox.oftrust.net/messages/v1";
StringEntity params = new StringEntity("{ \"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\" ]}");
String Value;
HttpClient httpClient = HttpClientBuilder.create().build();
HttpPost request = new HttpPost(path);
request.addHeader("Authorization", "Bearer <ACCESS_TOKEN>");
request.addHeader("Content-Type", "application/json");
request.setEntity(params);
HttpResponse response = httpClient.execute(request);
try {
Value = EntityUtils.toString(response.getEntity()).toString();
if (Value.charAt(0) != '{' && Value.charAt(0) != '[')
Value = "\"" + Value + "\"" ;
} catch (Exception ex) {
Value = "{}";
}
StatusLine status = response.getStatusLine();
System.out.printf("{\"raw_body\":%s,\n\"status\":\"%s\",\n\"code\":\"%s\"}", Value, status, status.getStatusCode());
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
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 |
---|---|---|---|---|
Authorization | header | The Authorization header, MUST be Bearer {{access_token}} |
Yes | string |
body | body | Yes |
Body properties
* - Required property
- object message
- string toIdentity * - The "to" identity ID to which the message is sent to.
- string subject * - The message subject.
- string content * - The content of the message.
- array cc - List of valid identity IDs to CC the message to.
Responses
Code | Description |
---|---|
201 | |
401 | |
403 | |
404 | |
422 |
/messages/v1/{id}
get
Description: Read one message by id
HTTP Request
Do you need help in using the GET /messages/v1/{id} ?
Checkout existing questions & answers Ask a question in Stack Overflow Did we miss something? Make a wish! Example for: GET /messages/v1/{id}
import requests
headers = {
"Authorization": "Bearer <ACCESS_TOKEN>"
}
response = requests.get(
'https://api-sandbox.oftrust.net/messages/v1/{id}',
headers=headers
)
print({
'raw_body': response.text,
'status': response.status_code,
'code': response.status_code
})
curl -i -X GET \
-H "Authorization: Bearer <ACCESS_TOKEN>" \
"https://api-sandbox.oftrust.net/messages/v1/{id}"
const unirest = require("unirest");
const headers = {
"Authorization": "Bearer <ACCESS_TOKEN>"
};
unirest
.get("https://api-sandbox.oftrust.net/messages/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));
});
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.apache.http.StatusLine;
public class Java {
public static void main(String[] args) {
try {
String path = "https://api-sandbox.oftrust.net/messages/v1/{id}";
String Value;
HttpClient httpClient = HttpClientBuilder.create().build();
HttpGet request = new HttpGet(path);
request.addHeader("Authorization", "Bearer <ACCESS_TOKEN>");
HttpResponse response = httpClient.execute(request);
try {
Value = EntityUtils.toString(response.getEntity()).toString();
if (Value.charAt(0) != '{' && Value.charAt(0) != '[')
Value = "\"" + Value + "\"" ;
} catch (Exception ex) {
Value = "{}";
}
StatusLine status = response.getStatusLine();
System.out.printf("{\"raw_body\":%s,\n\"status\":\"%s\",\n\"code\":\"%s\"}", Value, status, status.getStatusCode());
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
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 |
Authorization | header | The Authorization header, MUST be Bearer {{access_token}} |
Yes | string |
Responses
Code | Description |
---|---|
200 | |
401 | |
403 | |
404 |
put
Description: Update a message by id
HTTP Request
Do you need help in using the PUT /messages/v1/{id} ?
Checkout existing questions & answers Ask a question in Stack Overflow Did we miss something? Make a wish! Example for: PUT /messages/v1/{id}
import requests
headers = {
"Authorization": "Bearer <ACCESS_TOKEN>",
"Content-Type": "application/json"
}
body = {
"subject": "Go to the grocery store",
"content": "Remember to buy milk!"
}
response = requests.put(
'https://api-sandbox.oftrust.net/messages/v1/{id}',
headers=headers,
json=body
)
print({
'raw_body': response.text,
'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/v1/{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/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));
});
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPut;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.apache.http.StatusLine;
public class Java {
public static void main(String[] args) {
try {
String path = "https://api-sandbox.oftrust.net/messages/v1/{id}";
StringEntity params = new StringEntity("{ \"subject\": \"Go to the grocery store\", \"content\": \"Remember to buy milk!\"}");
String Value;
HttpClient httpClient = HttpClientBuilder.create().build();
HttpPut request = new HttpPut(path);
request.addHeader("Authorization", "Bearer <ACCESS_TOKEN>");
request.addHeader("Content-Type", "application/json");
request.setEntity(params);
HttpResponse response = httpClient.execute(request);
try {
Value = EntityUtils.toString(response.getEntity()).toString();
if (Value.charAt(0) != '{' && Value.charAt(0) != '[')
Value = "\"" + Value + "\"" ;
} catch (Exception ex) {
Value = "{}";
}
StatusLine status = response.getStatusLine();
System.out.printf("{\"raw_body\":%s,\n\"status\":\"%s\",\n\"code\":\"%s\"}", Value, status, status.getStatusCode());
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
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 |
Authorization | header | The Authorization header, MUST be Bearer {{access_token}} |
Yes | string |
body | body | Yes |
Body properties
* - Required property
- object message
- string toIdentity * - The "to" identity ID to which the message is sent to.
- string subject * - The message subject.
- string content * - The content of the message.
- array cc - List of valid identity IDs to CC the message to.
Responses
Code | Description |
---|---|
200 | |
401 | |
403 | |
404 | |
422 |
delete
Description: Delete a message by id
HTTP Request
Do you need help in using the DELETE /messages/v1/{id} ?
Checkout existing questions & answers Ask a question in Stack Overflow Did we miss something? Make a wish! Example for: DELETE /messages/v1/{id}
import requests
headers = {
"Authorization": "Bearer <ACCESS_TOKEN>"
}
response = requests.delete(
'https://api-sandbox.oftrust.net/messages/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/messages/v1/{id}"
const unirest = require("unirest");
const headers = {
"Authorization": "Bearer <ACCESS_TOKEN>"
};
unirest
.delete("https://api-sandbox.oftrust.net/messages/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));
});
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpDelete;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.apache.http.StatusLine;
public class Java {
public static void main(String[] args) {
try {
String path = "https://api-sandbox.oftrust.net/messages/v1/{id}";
String Value;
HttpClient httpClient = HttpClientBuilder.create().build();
HttpDelete request = new HttpDelete(path);
request.addHeader("Authorization", "Bearer <ACCESS_TOKEN>");
HttpResponse response = httpClient.execute(request);
try {
Value = EntityUtils.toString(response.getEntity()).toString();
if (Value.charAt(0) != '{' && Value.charAt(0) != '[')
Value = "\"" + Value + "\"" ;
} catch (Exception ex) {
Value = "{}";
}
StatusLine status = response.getStatusLine();
System.out.printf("{\"raw_body\":%s,\n\"status\":\"%s\",\n\"code\":\"%s\"}", Value, status, status.getStatusCode());
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
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 |
Authorization | header | The Authorization header, MUST be Bearer {{access_token}} |
Yes | string |
Responses
Code | Description |
---|---|
204 | |
401 | |
403 | |
404 |
/messages/v1/{id}/read
post
Description: Marks a message read by the currently logged in user.
HTTP Request
Do you need help in using the POST /messages/v1/{id}/read ?
Checkout existing questions & answers Ask a question in Stack Overflow Did we miss something? Make a wish! Example for: POST /messages/v1/{id}/read
import requests
headers = {
"Authorization": "Bearer <ACCESS_TOKEN>"
}
response = requests.post(
'https://api-sandbox.oftrust.net/messages/v1/{id}/read',
headers=headers
)
print({
'raw_body': response.text,
'status': response.status_code,
'code': response.status_code
})
curl -i -X POST \
-H "Authorization: Bearer <ACCESS_TOKEN>" \
"https://api-sandbox.oftrust.net/messages/v1/{id}/read"
const unirest = require("unirest");
const headers = {
"Authorization": "Bearer <ACCESS_TOKEN>"
};
unirest
.post("https://api-sandbox.oftrust.net/messages/v1/{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));
});
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.apache.http.StatusLine;
public class Java {
public static void main(String[] args) {
try {
String path = "https://api-sandbox.oftrust.net/messages/v1/{id}/read";
String Value;
HttpClient httpClient = HttpClientBuilder.create().build();
HttpPost request = new HttpPost(path);
request.addHeader("Authorization", "Bearer <ACCESS_TOKEN>");
HttpResponse response = httpClient.execute(request);
try {
Value = EntityUtils.toString(response.getEntity()).toString();
if (Value.charAt(0) != '{' && Value.charAt(0) != '[')
Value = "\"" + Value + "\"" ;
} catch (Exception ex) {
Value = "{}";
}
StatusLine status = response.getStatusLine();
System.out.printf("{\"raw_body\":%s,\n\"status\":\"%s\",\n\"code\":\"%s\"}", Value, status, status.getStatusCode());
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
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 |
Authorization | header | The Authorization header, MUST be Bearer {{access_token}} |
Yes | string |
Responses
Code | Description |
---|---|
200 | |
401 | |
403 |
/messages/v1/{toIdentity}/list
get
Description: List messages sent to "to"-identity.
HTTP Request
Do you need help in using the GET /messages/v1/{toIdentity}/list ?
Checkout existing questions & answers Ask a question in Stack Overflow Did we miss something? Make a wish! Example for: GET /messages/v1/{toIdentity}/list
import requests
headers = {
"Authorization": "Bearer <ACCESS_TOKEN>"
}
response = requests.get(
'https://api-sandbox.oftrust.net/messages/v1/{toIdentity}/list',
headers=headers
)
print({
'raw_body': response.text,
'status': response.status_code,
'code': response.status_code
})
curl -i -X GET \
-H "Authorization: Bearer <ACCESS_TOKEN>" \
"https://api-sandbox.oftrust.net/messages/v1/{toIdentity}/list"
const unirest = require("unirest");
const headers = {
"Authorization": "Bearer <ACCESS_TOKEN>"
};
unirest
.get("https://api-sandbox.oftrust.net/messages/v1/{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));
});
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.apache.http.StatusLine;
public class Java {
public static void main(String[] args) {
try {
String path = "https://api-sandbox.oftrust.net/messages/v1/{toIdentity}/list";
String Value;
HttpClient httpClient = HttpClientBuilder.create().build();
HttpGet request = new HttpGet(path);
request.addHeader("Authorization", "Bearer <ACCESS_TOKEN>");
HttpResponse response = httpClient.execute(request);
try {
Value = EntityUtils.toString(response.getEntity()).toString();
if (Value.charAt(0) != '{' && Value.charAt(0) != '[')
Value = "\"" + Value + "\"" ;
} catch (Exception ex) {
Value = "{}";
}
StatusLine status = response.getStatusLine();
System.out.printf("{\"raw_body\":%s,\n\"status\":\"%s\",\n\"code\":\"%s\"}", Value, status, status.getStatusCode());
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
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 |
Authorization | header | The Authorization header, MUST be Bearer {{access_token}} |
Yes | string |
Responses
Code | Description |
---|---|
200 | |
401 | |
403 |
Product
Get Product 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. Note that when creating a new data product, the developer who creates it MUST belong to a group (organization), and POST that group ID in the request when creating the data product.
Version: v1
/products/v1
post
Description: Create a new product
HTTP Request
Do you need help in using the POST /products/v1 ?
Checkout existing questions & answers Ask a question in Stack Overflow Did we miss something? Make a wish! Example for: POST /products/v1
import requests
headers = {
"Authorization": "Bearer eyJ0e.....GciOiJSUzI1NiJ9.eyJzY29wZ....SI6bnVsbCwiZXhwIjoxN",
"Content-Type": "application/json"
}
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 ...",
"groupId": "0a52c776-1c9c-42b1-ac03-b64c04abded2"
}
response = requests.post(
'https://api-sandbox.oftrust.net/products/{version}',
headers=headers,
json=body
)
print({
'raw_body': response.text,
'status': response.status_code,
'code': response.status_code
})
curl -i -X POST \
-H "Authorization: Bearer eyJ0e.....GciOiJSUzI1NiJ9.eyJzY29wZ....SI6bnVsbCwiZXhwIjoxN" \
-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 ...\",
\"groupId\": \"0a52c776-1c9c-42b1-ac03-b64c04abded2\"
}" "https://api-sandbox.oftrust.net/products/{version}"
const unirest = require("unirest");
const headers = {
"Authorization": "Bearer eyJ0e.....GciOiJSUzI1NiJ9.eyJzY29wZ....SI6bnVsbCwiZXhwIjoxN",
"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 ...",
"groupId": "0a52c776-1c9c-42b1-ac03-b64c04abded2"
};
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));
});
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.apache.http.StatusLine;
public class Java {
public static void main(String[] args) {
try {
String path = "https://api-sandbox.oftrust.net/products/{version}";
StringEntity params = new StringEntity("{ \"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 ...\", \"groupId\": \"0a52c776-1c9c-42b1-ac03-b64c04abded2\"}");
String Value;
HttpClient httpClient = HttpClientBuilder.create().build();
HttpPost request = new HttpPost(path);
request.addHeader("Authorization", "Bearer eyJ0e.....GciOiJSUzI1NiJ9.eyJzY29wZ....SI6bnVsbCwiZXhwIjoxN");
request.addHeader("Content-Type", "application/json");
request.setEntity(params);
HttpResponse response = httpClient.execute(request);
try {
Value = EntityUtils.toString(response.getEntity()).toString();
if (Value.charAt(0) != '{' && Value.charAt(0) != '[')
Value = "\"" + Value + "\"" ;
} catch (Exception ex) {
Value = "{}";
}
StatusLine status = response.getStatusLine();
System.out.printf("{\"raw_body\":%s,\n\"status\":\"%s\",\n\"code\":\"%s\"}", Value, status, status.getStatusCode());
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
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",
"authorizationLayer": "None"
}
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 |
Body properties
* - Required property
- object productCreate
- string productCode * - The product code for the product.
- string dataContext * - The URL to the data context for the product. The data context defines the keys in the `data` object returned from the translator. Think of it like "output" context.
- string parameterContext * - The URL to the context for the parameters of the product. The parameter context defines the keys in the `parameters` object that are sent in the request to the data broker. Think of it like the "input" context.
- string translatorUrl * - The URL to the translator.
- string name * - The name of the product.
- array organizationPublicKeys * - Organization public keys. Each object in the list MUST have the keys `url` and `type`, where `url` is the full URL to the public key used for signing the data, and the `type` defines the type of the signature.
- string description - The description of the product.
- string imageUrl - Optional URL to an image for the product.
- string groupId * - The group where the user is a member of. This group will be the developer of the data product.
- string authorizationLayer - Optional parameter, default for “authorizationLayer” will be None. The only accepted values are None and Broker.When the product has the authorizationLayer set to Broker, consume permission needs to be set as True for the application. Additionally, when you are using a x-user-token, the user identity needs to have the consume permission.
Responses
Code | Description |
---|---|
201 | |
401 | |
422 |
get
Description: Lists all available products. NOTE: This is a CORS enabled endpoint. Supports pagination.
HTTP Request
Do you need help in using the GET /products/v1 ?
Checkout existing questions & answers Ask a question in Stack Overflow Did we miss something? Make a wish! 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.text,
'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));
});
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.apache.http.StatusLine;
public class Java {
public static void main(String[] args) {
try {
String path = "https://api-sandbox.oftrust.net/products/{version}?offset=200&limit=400";
String Value;
HttpClient httpClient = HttpClientBuilder.create().build();
HttpGet request = new HttpGet(path);
HttpResponse response = httpClient.execute(request);
try {
Value = EntityUtils.toString(response.getEntity()).toString();
if (Value.charAt(0) != '{' && Value.charAt(0) != '[')
Value = "\"" + Value + "\"" ;
} catch (Exception ex) {
Value = "{}";
}
StatusLine status = response.getStatusLine();
System.out.printf("{\"raw_body\":%s,\n\"status\":\"%s\",\n\"code\":\"%s\"}", Value, status, status.getStatusCode());
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
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"
}
],
"pagination": {
"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,
"totalCount": 10
}
}
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 | |
422 |
/products/v1/{product_code}
get
Description: Reads a single product by product code. NOTE: This is a CORS enabled endpoint.
HTTP Request
Do you need help in using the GET /products/v1/{product_code} ?
Checkout existing questions & answers Ask a question in Stack Overflow Did we miss something? Make a wish! 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.text,
'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));
});
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.apache.http.StatusLine;
public class Java {
public static void main(String[] args) {
try {
String path = "https://api-sandbox.oftrust.net/products/{version}/{product_code}";
String Value;
HttpClient httpClient = HttpClientBuilder.create().build();
HttpGet request = new HttpGet(path);
HttpResponse response = httpClient.execute(request);
try {
Value = EntityUtils.toString(response.getEntity()).toString();
if (Value.charAt(0) != '{' && Value.charAt(0) != '[')
Value = "\"" + Value + "\"" ;
} catch (Exception ex) {
Value = "{}";
}
StatusLine status = response.getStatusLine();
System.out.printf("{\"raw_body\":%s,\n\"status\":\"%s\",\n\"code\":\"%s\"}", Value, status, status.getStatusCode());
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
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",
"authorizationLayer": "None"
}
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
Do you need help in using the PUT /products/v1/{product_code} ?
Checkout existing questions & answers Ask a question in Stack Overflow Did we miss something? Make a wish! Example for: PUT /products/v1/{product_code}
import requests
headers = {
"Authorization": "Bearer eyJ0e.....GciOiJSUzI1NiJ9.eyJzY29wZ....SI6bnVsbCwiZXhwIjoxN",
"Content-Type": "application/json"
}
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 ...",
"authorizationLayer": "None"
}
response = requests.put(
'https://api-sandbox.oftrust.net/products/{version}/{product_code}',
headers=headers,
json=body
)
print({
'raw_body': response.text,
'status': response.status_code,
'code': response.status_code
})
curl -i -X PUT \
-H "Authorization: Bearer eyJ0e.....GciOiJSUzI1NiJ9.eyJzY29wZ....SI6bnVsbCwiZXhwIjoxN" \
-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 ...\",
\"authorizationLayer\": \"None\"
}" "https://api-sandbox.oftrust.net/products/{version}/{product_code}"
const unirest = require("unirest");
const headers = {
"Authorization": "Bearer eyJ0e.....GciOiJSUzI1NiJ9.eyJzY29wZ....SI6bnVsbCwiZXhwIjoxN",
"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 ...",
"authorizationLayer": "None"
};
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));
});
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPut;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.apache.http.StatusLine;
public class Java {
public static void main(String[] args) {
try {
String path = "https://api-sandbox.oftrust.net/products/{version}/{product_code}";
StringEntity params = new StringEntity("{ \"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 ...\", \"authorizationLayer\": \"None\"}");
String Value;
HttpClient httpClient = HttpClientBuilder.create().build();
HttpPut request = new HttpPut(path);
request.addHeader("Authorization", "Bearer eyJ0e.....GciOiJSUzI1NiJ9.eyJzY29wZ....SI6bnVsbCwiZXhwIjoxN");
request.addHeader("Content-Type", "application/json");
request.setEntity(params);
HttpResponse response = httpClient.execute(request);
try {
Value = EntityUtils.toString(response.getEntity()).toString();
if (Value.charAt(0) != '{' && Value.charAt(0) != '[')
Value = "\"" + Value + "\"" ;
} catch (Exception ex) {
Value = "{}";
}
StatusLine status = response.getStatusLine();
System.out.printf("{\"raw_body\":%s,\n\"status\":\"%s\",\n\"code\":\"%s\"}", Value, status, status.getStatusCode());
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
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",
"authorizationLayer": "None"
}
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 |
Body properties
* - Required property
- object product
- string productCode * - The unique identifiable code for the product.
- string dataContext * - The URL to the data context for the product. The data context defines the keys in the `data` object returned from the translator. Think of it like "output" context.
- string parameterContext * - The URL to the context for the parameters of the product. The parameter context defines the keys in the `parameters` object that are sent in the request to the data broker. Think of it like the "input" context.
- string translatorUrl * - The URL to the corresponding translator for the product.
- string name * - The name of the product.
- array organizationPublicKeys * - Organization public keys. Each object in the list MUST have the keys `url` and `type`, where `url` is the full URL to the public key used for signing the data, and the `type` defines the type of the signature.
- string description - The description of the product.
- string imageUrl - Optional URL to an image for the product.
- string authorizationLayer - Update the "authorizationLayer" only if it is specified in the update call
Responses
Code | Description |
---|---|
200 | |
401 | |
403 | |
404 | |
422 |
delete
Description: Delete a product by product code
HTTP Request
Do you need help in using the DELETE /products/v1/{product_code} ?
Checkout existing questions & answers Ask a question in Stack Overflow Did we miss something? Make a wish! Example for: DELETE /products/v1/{product_code}
import requests
headers = {
"Authorization": "Bearer eyJ0e.....GciOiJSUzI1NiJ9.eyJzY29wZ....SI6bnVsbCwiZXhwIjoxN"
}
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 eyJ0e.....GciOiJSUzI1NiJ9.eyJzY29wZ....SI6bnVsbCwiZXhwIjoxN" \
"https://api-sandbox.oftrust.net/products/{version}/{product_code}"
const unirest = require("unirest");
const headers = {
"Authorization": "Bearer eyJ0e.....GciOiJSUzI1NiJ9.eyJzY29wZ....SI6bnVsbCwiZXhwIjoxN"
};
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));
});
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpDelete;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.apache.http.StatusLine;
public class Java {
public static void main(String[] args) {
try {
String path = "https://api-sandbox.oftrust.net/products/{version}/{product_code}";
String Value;
HttpClient httpClient = HttpClientBuilder.create().build();
HttpDelete request = new HttpDelete(path);
request.addHeader("Authorization", "Bearer eyJ0e.....GciOiJSUzI1NiJ9.eyJzY29wZ....SI6bnVsbCwiZXhwIjoxN");
HttpResponse response = httpClient.execute(request);
try {
Value = EntityUtils.toString(response.getEntity()).toString();
if (Value.charAt(0) != '{' && Value.charAt(0) != '[')
Value = "\"" + Value + "\"" ;
} catch (Exception ex) {
Value = "{}";
}
StatusLine status = response.getStatusLine();
System.out.printf("{\"raw_body\":%s,\n\"status\":\"%s\",\n\"code\":\"%s\"}", Value, status, status.getStatusCode());
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
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 | |
401 | |
403 | |
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
You can read practical authentication example from Developer Portal App development guide
You also take a look at sample app from Github if you prefer code driven learning.
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:
- Login to Sandbox environment World application (https://world-sandbox.oftrust.net)
- Get the
Authorization
cookie value from your browser. Cookie contains yourBearer
token. Cookie is valid for several hours, enough for testing.
Here's an example from Chrome Browser DevTools
For production:
- To get Bearer token, you need to set up your application with OAuth logic.
- Sample app contains information about the Bearer token as well.
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:
- X-Pot-Signature (HMAC-SHA256 signature in base64 encoded format),
- X-Pot-App and (The requesting application's client ID)
- X-Pot-Token (The currently logged in user's OAuth access token) as well.
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:
- Login to World app and initiate new application registration.
- Fill in the required information and submit.
- 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 create an issue in Github.