Entities
Host: https://crm-service.<domain>. All endpoints need a service token or a user with the customers.use claim.
Get an entity
/api/v2/entity/{humanId}crm-service| Query | Description |
|---|---|
fields | Comma separated field list, e.g. fields=data.name,data.city |
include, exclude | Comma separated lists, alternative to fields |
- curl
- JavaScript
- Python
- R
curl -s "https://crm-service.scenid.cloud/api/v2/entity/SC-ZW2VEG?fields=data.name,data.city" \
-H "Authorization: Bearer $TOKEN"
const response = await fetch('https://crm-service.scenid.cloud/api/v2/entity/SC-ZW2VEG?fields=data.name,data.city', {
headers: { Authorization: `Bearer ${token}` }
})
console.log(response.status, await response.json())
import requests
response = requests.get(
"https://crm-service.scenid.cloud/api/v2/entity/SC-ZW2VEG?fields=data.name,data.city",
headers={"Authorization": f"Bearer {token}"},
)
print(response.status_code, response.json())
library(httr2)
response <- request("https://crm-service.scenid.cloud/api/v2/entity/SC-ZW2VEG?fields=data.name,data.city") |>
req_auth_bearer_token(token) |>
req_error(is_error = \(r) FALSE) |>
req_perform()
resp_status(response)
resp_body_json(response)
{
"id": "6f0f…",
"humanId": "SC-ZW2VEG",
"entityType": "ou",
"data": { "name": "Nordlicht Holding GmbH", "city": "Hamburg" }
}
Errors: 400 entity/not-found. The type is not checked, the same route returns companies, people and groups. Users only see what their group ACLs permit, service tokens see everything.
List entities
/api/v2/entities/listcrm-service| Body | Type | Description |
|---|---|---|
entityTypes | string[] | Required. ou, person, group |
fields | string[] | Extra fields |
filterModel | object | { logicOperator, items: [{ field, operator, value }] } |
hideInactive | boolean | Hide data.active = false |
sort | array | ES clauses, or { field, sort } with pagination |
pagination | { page, pageSize } | Optional. Response becomes { rows, totalCount } |
- curl
- JavaScript
- Python
- R
curl -s https://crm-service.scenid.cloud/api/v2/entities/list \
-H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' \
-d '{
"entityTypes": ["ou"],
"fields": ["data.city"],
"filterModel": {
"logicOperator": "and",
"items": [{ "field": "data.city", "operator": "equals", "value": "Hamburg" }]
},
"hideInactive": true
}'
const response = await fetch('https://crm-service.scenid.cloud/api/v2/entities/list', {
method: 'POST',
headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' },
body: JSON.stringify({
entityTypes: ['ou'],
fields: ['data.city'],
filterModel: {
logicOperator: 'and',
items: [{ field: 'data.city', operator: 'equals', value: 'Hamburg' }]
},
hideInactive: true
})
})
console.log(response.status, await response.json())
import requests
response = requests.post(
"https://crm-service.scenid.cloud/api/v2/entities/list",
headers={"Authorization": f"Bearer {token}"},
json={
"entityTypes": ["ou"],
"fields": ["data.city"],
"filterModel": {
"logicOperator": "and",
"items": [{"field": "data.city", "operator": "equals", "value": "Hamburg"}],
},
"hideInactive": True,
},
)
print(response.status_code, response.json())
library(httr2)
response <- request("https://crm-service.scenid.cloud/api/v2/entities/list") |>
req_auth_bearer_token(token) |>
req_body_json(list(
entityTypes = list("ou"),
fields = list("data.city"),
filterModel = list(
logicOperator = "and",
items = list(list(field = "data.city", operator = "equals", value = "Hamburg"))
),
hideInactive = TRUE
)) |>
req_error(is_error = \(r) FALSE) |>
req_perform()
resp_status(response)
resp_body_json(response)
[
{ "entityType": "ou", "id": "…", "humanId": "SC-ZW2VEG", "data": { "name": "Nordlicht Holding GmbH", "city": "Hamburg" }, "score": 1 }
]
Without pagination all matches are returned (read in pages of 10,000). With pagination: { "rows": […], "totalCount": 123 }, limited to a 10,000 result window (entity/pagination-window-exceeded).
Filter operators: strings contains, doesNotContain, startsWith, endsWith, equals, isEmpty, isNotEmpty. Booleans equals, isEmpty, isNotEmpty. Virtual fields __GROUPS__, __MEMBERS__, __EMPLOYEES__, __EMPLOYMENTS__, __ROLES__ with includes / excludes.
Search entities
/api/v2/entities/searchcrm-service| Body | Description |
|---|---|
entityType | Required. One type |
quickFilter | Free text (n-gram) |
filterModel, fields, sort, hideInactive | As above |
searchSubEntities | Include sub-entities |
idsOnly | Identifiers only |
Returns an array ordered by score. For ou, ancestors of the matches are appended.
- curl
- JavaScript
- Python
- R
curl -s https://crm-service.scenid.cloud/api/v2/entities/search \
-H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' \
-d '{"entityType":"ou","quickFilter":"nordl","fields":["data.city"]}'
const response = await fetch('https://crm-service.scenid.cloud/api/v2/entities/search', {
method: 'POST',
headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' },
body: JSON.stringify({ entityType: 'ou', quickFilter: 'nordl', fields: ['data.city'] })
})
console.log(response.status, await response.json())
import requests
response = requests.post(
"https://crm-service.scenid.cloud/api/v2/entities/search",
headers={"Authorization": f"Bearer {token}"},
json={"entityType": "ou", "quickFilter": "nordl", "fields": ["data.city"]},
)
print(response.status_code, response.json())
library(httr2)
response <- request("https://crm-service.scenid.cloud/api/v2/entities/search") |>
req_auth_bearer_token(token) |>
req_body_json(list(
entityType = "ou",
quickFilter = "nordl",
fields = list("data.city")
)) |>
req_error(is_error = \(r) FALSE) |>
req_perform()
resp_status(response)
resp_body_json(response)