Create environment unified model
/environment-unified-model
Install a unified model in a specific environment, optionally with overrides. If a record already exists for that (environment_id, unified_model_id) pair, the existing record is returned. You have the flexibility to customize a Unified Model and its configuration to better suit your specific needs. Customizing the models allow you to override default mappings, add new resources, and tailor the unified apis to fit seamlessly within your environment. Read more about Installing Unified Models
An example of how you can override the properties of the base Unified Model Mapping-
{
"override":{
"resources":{
"orders":{
"integration_mapping":{
"bigcommerce":{
"list":{
"request_body_mapping":"{\n \"id\": response.id & '',\n
\"currency\": response.currency_code"
}
}
}
}
}
}
}
Like wise use the override key to specify any overrides on the Base Unified Model.
Request Body
The environment to install the unified model in. Required, also with an API token (use the token's own environment).
8a2b104d-74a6-47f2-b93e-c6b611e82391Optional override object for resources, scopes, webhooks, or docs. Deep-merged on top of the base unified model.
Per-integration documentation overrides.
Resource-level overrides keyed by resource name.
A null value is a tombstone: it removes an inherited resource from this environment's effective unified model. Omitting the key cannot say that — overrides are deep-merged, so an absent key means "inherit from the base model". The tombstone is stripped while merging, so the resource is simply absent from the returned unified_model rather than present with a null value.
Per-integration extra OAuth scopes appended to the base unified-model scopes.
Per-integration JSONata expressions that route inbound webhooks to unified-model resources.
The ID of the unified model to install.
7c5c8cc2-e68e-4af8-84d1-4ceea1489338Response Body
Timestamp when this record was created.
2024-01-10T10:00:00.000ZThe ID of the environment where this unified model is installed.
1ba1f401-7183-47c5-9e39-e8e257e3c795The ID of the environment-unified-model record.
4af1e38e-1d84-4bea-8ef4-2d705aec43bcAn optional object containing environment-level overrides for the unified model. Deep-merged on top of the base unified model. See EnvironmentUnifiedModelOverride for the typed shape.
{
"resources": {
"users": {
"description": "Overrides the user resource description for this environment.",
"integration_mapping": {
"my_integration": {
"list": {
"path_mapping": "/v2/users"
}
}
}
}
}
}Per-integration documentation overrides.
Resource-level overrides keyed by resource name.
A null value is a tombstone: it removes an inherited resource from this environment's effective unified model. Omitting the key cannot say that — overrides are deep-merged, so an absent key means "inherit from the base model". The tombstone is stripped while merging, so the resource is simply absent from the returned unified_model rather than present with a null value.
Per-integration extra OAuth scopes appended to the base unified-model scopes.
Per-integration JSONata expressions that route inbound webhooks to unified-model resources.
The category of the unified model.
hrisThe date and time when the unified model was created.
2021-08-10T10:00:00.000ZA brief description of what this unified model represents.
This model provides a user directory interface for various HRIS integrations.Per-resource documentation (pricing plan / scopes / instructions).
The ID of the unified model.
7c5c8cc2-e68e-4af8-84d1-4ceea1489338A list of environment IDs where this unified model is installed.
The name of the unified model.
user-directoryMap of resource name (e.g. users, contacts) → resource definition (UnifiedModelResource).
{
"users": {
"description": "A resource representing user objects",
"schema": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"email": {
"type": "string"
}
}
},
"integration_mapping": {
"my_integration": {
"list": {
"resource": "/users",
"method": "get"
}
}
}
}
}Per-resource OAuth/permission scopes required to call its methods.
The sharing policy of the unified model.
denyallowaskdeny
10 properties
Whether the team allows impersonation.
falseThe date and time when the team was created.
2021-08-10T10:00:00.000ZThe domain of the team.
example.comThe ID of the team.
05daecaf-4365-42e8-8370-8127de5dd717Whether the team is verified or not.
trueWhether the team is white-labeled or not.
falseThe URL of the team's logo.
https://example.com/logo.pngThe name of the team.
My Awesome TeamA link to the team's Terms of Service, if available.
https://example.com/tosThe date and time when the team was last updated.
2021-08-10T10:00:00.000ZThe ID of the team that owns this unified model.
05daecaf-4365-42e8-8370-8127de5dd717The date and time when the unified model was last updated.
2021-08-10T10:30:00.000ZThe current version of the unified model.
3Per-resource webhook routing expression (JSONata that decides whether an inbound webhook should be delivered to this resource).
The ID of the unified model being installed or overridden.
7c5c8cc2-e68e-4af8-84d1-4ceea1489338Timestamp when this record was last updated.
2024-01-11T12:30:00.000ZErrors
| Status | Description |
|---|---|
400 | Bad request (e.g. not shared) |
403 | Forbidden if user has no access to that environment |
truto env-unified-models create \
-b '{
"unified_model_id": "7c5c8cc2-e68e-4af8-84d1-4ceea1489338",
"environment_id": "8a2b104d-74a6-47f2-b93e-c6b611e82391",
"override": {}
}' \
-o jsonimport Truto from '@truto/truto-ts-sdk';
const truto = new Truto({
token: '<your_api_token>',
});
const body = {
"unified_model_id": "7c5c8cc2-e68e-4af8-84d1-4ceea1489338",
"environment_id": "8a2b104d-74a6-47f2-b93e-c6b611e82391",
"override": {}
};
const result = await truto.environmentUnifiedModel.create(body);
console.log(result);curl -X POST 'https://api.truto.one/environment-unified-model' \
-H 'Authorization: Bearer <your_api_token>' \
-H 'Content-Type: application/json' \
-d '{
"unified_model_id": "7c5c8cc2-e68e-4af8-84d1-4ceea1489338",
"environment_id": "8a2b104d-74a6-47f2-b93e-c6b611e82391",
"override": {}
}'const body = {
"unified_model_id": "7c5c8cc2-e68e-4af8-84d1-4ceea1489338",
"environment_id": "8a2b104d-74a6-47f2-b93e-c6b611e82391",
"override": {}
};
const response = await fetch('https://api.truto.one/environment-unified-model', {
method: 'POST',
headers: {
'Authorization': 'Bearer <your_api_token>',
'Content-Type': 'application/json',
},
body: JSON.stringify(body),
});
const data = await response.json();
console.log(data);import requests
url = "https://api.truto.one/environment-unified-model"
headers = {
"Authorization": "Bearer <your_api_token>",
"Content-Type": "application/json",
}
params = {
}
payload = {
"unified_model_id": "7c5c8cc2-e68e-4af8-84d1-4ceea1489338",
"environment_id": "8a2b104d-74a6-47f2-b93e-c6b611e82391",
"override": {}
}
response = requests.post(url, headers=headers, params=params, json=payload)
print(response.json())