Examples of using Records API for external systems
The API allows you to work with Citeck system data within the familiar interface of your information system.
Using the Records API, you can perform any actions with data stored in any of the Citeck microservices. Read more about Records API
API usage examples:
retrieving and modifying route information;
managing the set and composition of user groups.
Important
To ensure correct sending of HTTP requests, configure authentication according to the article
Searching and Downloading a Document
URL |
{{host}}/gateway/api/records/query
|
Type |
POST |
Request |
{
"query": {
"sourceId": "emodel/aro-internal-type",
"query": {
"att": "_status",
"t": "eq",
"val": "new"
},
"language": "predicate"
},
"attributes": [
"_content.url"
]
}
|
Response |
{
"records": [
{
"id": "emodel/aro-internal-type@86edb336-7816-41fa-9809-680a077e0b5e",
"attributes": {
"_content.url": "/gateway/emodel/api/ecos/webapp/content?ref=aro-internal-type%4086edb336-7816-41fa-9809-680a077e0b5e&att=content"
}
},
{
"id": "emodel/aro-internal-type@dde85aac-e875-471c-a44d-a4135fc7c56a",
"attributes": {
"_content.url": "/gateway/emodel/api/ecos/webapp/content?ref=aro-internal-type%40dde85aac-e875-471c-a44d-a4135fc7c56a&att=content"
}
}
],
"errors": [],
"hasMore": false,
"totalCount": 2
}
|
Then make a GET request to download the content:
GET {{host}}/gateway/emodel/api/ecos/webapp/content?ref=aro-internal-type%40dde85aac-e875-471c-a44d-a4135fc7c56a&att=content
Downloading a Document
URL |
{{host}}/gateway/api/records/query
|
Type |
POST |
Request |
{
"records": [
"emodel/aro-internal-type@e3b81a2b-cdc9-42bc-abbc-a6a564aedbb8"
],
"attributes": [
"_content.url"
]
}
|
Response |
{
"records": [
{
"id": "emodel/aro-internal-type@e3b81a2b-cdc9-42bc-abbc-a6a564aedbb8",
"attributes": {
"_content.url": "/gateway/emodel/api/ecos/webapp/content?ref=aro-internal-type%40e3b81a2b-cdc9-42bc-abbc-a6a564aedbb8&att=content"
}
}
],
"errors": []
}
|
Then make a GET request to download the content:
GET {{host}}/gateway/emodel/api/ecos/webapp/content?ref=aro-internal-type%40e3b81a2b-cdc9-42bc-abbc-a6a564aedbb8&att=content
Managing Routes
Getting a List of Routes
URL |
{{host}}/gateway/api/records/query
|
Type |
POST |
Request |
{"query":{
"sourceId":"alfresco/",
"query":{
"att":"_type",
"val":"emodel/type@testdl-routeTemplateItem",
"t":"eq"
},
"language":"predicate",
"page":{"skipCount":0,"maxItems":10,"page":1},
"consistency":"EVENTUAL",
"sortBy":[{"attribute":"cm:created","ascending":false}]},
"attributes":["testdl:rtCode?disp"]
}
|
Response |
{
"records": [
{
"id": "alfresco/@workspace://SpacesStore/820f88b5-e722-4bc0-933f-926d57e728aa",
"attributes": {
"testdl:rtCode?disp": "1"
}
}
],
"errors": [],
"hasMore": false,
"totalCount": 1
}
|
Getting Hierarchy by Levels
URL |
{{host}}/gateway/alfresco/alfresco/s/api/orgstruct/v2/group/_orgstruct_home_/children?addAdminGroup=true&branch=true&excludeAuthorities=&group=true&role=true&user=true
|
Type |
GET |
Response |
[
{
"nodeRef": "workspace://SpacesStore/03094bf2-1395-4ded-98ff-3aba20698260",
"fullName": "GROUP_all",
"shortName": "all",
"displayName": "Все пользователи",
"authorityType": "GROUP",
"groupType": "branch",
"groupSubType": "company"
},
{
"nodeRef": "workspace://SpacesStore/6ac1289b-45c6-43b5-ad95-fdbbe1302d69",
"fullName": "GROUP_company",
"shortName": "company",
"displayName": "Организация",
"authorityType": "GROUP",
"groupType": "branch",
"groupSubType": "company"
}
]
|
Modifying a Route (Adding/Removing Users/Groups to/from a Route)
URL |
{{host}}/gateway/api/records/mutate
|
Type |
POST |
Request |
{
"records": [
{
"id":"alfresco/@workspace://SpacesStore/820f88b5-e722-4bc0-933f-926d57e728aa", // ID маршрута
"attributes":{
"testdl:templateRouteSignerAssoc?str":"workspace://SpacesStore/15d05def-45fd-41cf-bf8d-96ecd422edea", // этап, на который необходимо добавить пользователя/группу (указать ID пользователя/группы), если необходимо удалить с этапа, то указать “”
"_state?str":"submitted"
}
}
]
}
|
Response |
{
"records": [
{
"id": "alfresco/@workspace://SpacesStore/820f88b5-e722-4bc0-933f-926d57e728aa",
"attributes": {}
}
],
"errors": []
}
|
Managing the Set and Composition of Groups
Viewing a List of Users
URL |
{{host}}/gateway/api/records/query
|
Type |
POST |
Request |
{
"query":{
"query":{
"t":"and",
"val":[{"t":"eq","att":"TYPE","val":"cm:person"}]},
"language":"predicate",
"consistency":"EVENTUAL",
"page":{"maxItems":10,"skipCount":0}},
"attributes":{"fullName":".disp","userName":"userName"}
}
|
Response |
{
"records": [
{
"id": "alfresco/@workspace://SpacesStore/e0d4333e-97e1-4d42-a4d0-83e4259ed936",
"attributes": {
"fullName": "Guest",
"userName": "guest"
}
},
{
"id": "alfresco/@workspace://SpacesStore/6985ba61-155a-4ae8-aeb3-28acbc59f5f4",
"attributes": {
"fullName": "system",
"userName": "system"
}
},
{
"id": "alfresco/@workspace://SpacesStore/15d05def-45fd-41cf-bf8d-96ecd422edea",
"attributes": {
"fullName": "Administrator",
"userName": "admin"
}
}
],
"errors": [],
"hasMore": false,
"totalCount": 3
}
|
Getting the List of Groups a User Belongs To
URL |
{{host}}/gateway/api/records/query
|
Type |
POST |
Request |
{"records":
["people@admin"],
"attributes":
["groups[]"]
}
|
Response |
{
"records": [
{
"id": "people@admin",
"attributes": {
"groups[]": [
"ALFRESCO_ADMINISTRATORS",
"ALFRESCO_MODEL_ADMINISTRATORS"
]
}
}
],
"errors": []
}
|
Removing/Adding a User to a Group
URL |
{{host}}/gateway/api/records/mutate
|
Type |
POST |
Request |
{"records":[
{
"id":"emodel/person@someuser",
"attributes":{
"att_add_authorityGroups":"emodel/authority-group@GROUP_company_accountancy"
}}]}
|
att_add_authorityGroups – adding to a group
att_rem_authorityGroups – removing from a group
Viewing Group Contents
Viewing Users in a Group
URL |
{{host}}/gateway/api/records/query
|
Type |
POST |
Request |
{"query":{
"sourceId": "emodel/person",
"query": {"t": "contains", "a": "authorityGroups", "v": "emodel/authority-group@orders-technologist"},
"language": "predicate"
}}
|
Response |
{
"records": [
"emodel/person@someuser"
],
"errors": [],
"hasMore": false,
"totalCount": 1
}
|
Viewing Groups within Groups
Viewing groups within a group is similar to viewing users in a group, but the sourceId is “emodel/authority-group“.
Viewing users or groups considering the hierarchy downwards (i.e., specifying the root of the organizational structure or any other group, but also searching in all subgroups) - the same as viewing users in a group, but using authorityGroupsFull instead of authorityGroups
Field |
Name |
|---|---|
fullName |
Full Name |
shortName |
Short Name |
id |
Record ID |
nodeRef |
Link to the record in the Citeck system |
displayName |
Display Name |
authorityType |
Authority Type User/Group |
groupType |
Group Type |
groupSubType |
Subgroup Type |
userName |
Login |
templateRouteSignerAssoc |
The stage to which a user/group needs to be added (specify the user/group ID), if removal from the stage is needed, specify “” |
att_add_authorityGroups |
att_add_authorityGroups – adding to a group
att_rem_authorityGroups – removing from a group
|
rtCode |
Template Code |
_state |
State Type |
errors |
Error value, if an error occurred during the request |
hasMore |
Whether there are more records |
totalCount |
Total number of records found |
disp |
Value for display |
value |
Value |
Parameter |
Value |
|---|---|
Block “page” |
Parameter for configuring pagination.
Optional parameter.
|
Block “sortBy” |
Parameter for sorting.
Optional parameter.
|
Block “attributes“ |
Parameters (see Table 1) that need to be obtained in the output.
Optional parameter.
You can omit parameters in “attributes“ or remove this block and get a list of record IDs as output.
|
sourceId |
Data source for search. In this case, alfresco.
Possible options:
• reports-data
• alfresco
|
query |
Required predicate query for searching records |
att |
Attribute name |
val |
Value |
t |
Predicate types.
Possible options:
• starts
• ends
• or
• and
• empty
• not
• eq
• gt
• ge
• lt
• le
• like
• in
• contains
|
language |
Query language. Currently, only predicate is supported. |
consistency |
Consistency
Possible options:
• EVENTUAL
• TRANSACTIONAL
• DEFAULT
• TRANSACTIONAL_IF_POSSIBLE
|
Making Changes to a Record
{
"records": [
{
"id": "alfresco/@workspace://SpacesStore/10a8c2e8-2c14-4c64-83b3-06b8bfc45006", //id workspace, в который данные необходимо добавить
"attributes": {
"testpkg: poAssoc?assoc": [
"dict@testpkg:po-alias-4" // alias должен быть уникальным в пределах запроса, можно задать константой
]
}
},
{
"id": "dict@testpkg: po",
"attributes": {
"_alias?str": "dict@testpkg:po-alias-4",
"testpkg:poValue?str": "1234567890",
"testpkg: poPpsDate?str":"2023-05-19T00:00:00Z",
"_state?str": "submitted",
"_formInfo?json": {
"submitName": {
"en": "Сохранить"
},
"formId": "testpkg-po-form"
}
}
}
]
}
Adding Data
{
"records": [
{
"id": "alfresco/@workspace://SpacesStore/10a8c2e8-2c14-4c64-83b3-06b8bfc45006",
"attributes": {
"att_add_testpkg: poAssoc?assoc": [
"dict@testpkg:po-alias-4"
]
}
},
{
"id": "dict@testpkg: po",
"attributes": {
"_alias?str": "dict@testpkg:po-alias-4",
"testpkg:poValue?str": "1234567890",
"testpkg: poPpsDate?str":"2023-05-19T00:00:00Z",
"_state?str": "submitted",
"_formInfo?json": {
"submitName": {
"en": "Сохранить"
},
"formId": "testpkg-po-form"
}
}
}
]
}
Sending a Request to Alfresco-FTS
To send a request to Alfresco (Alfresco-FTS) via Records, specify in the URL:
URL - https://{{host}}/gateway/api/records/query
body
{
"query": {
"sourceId": "alfresco/",
"language": "fts-alfresco",
"query": "{{fts-query}}"
},
"version": 1
}