All URLs are written relative to the BE MDM URL
If BE is on http://localhost:8082/universe-backend
, then /api/v2/draft/upsert
corresponds to http://localhost:8082/universe-backend/api/v2/draft/upsert
Each request must have a header Authorization
, in which the authorization token is transmitted (Getting a token
Authorization)
Examples for working with drafts
In the example, we have a registry (the system name of the registry - reg_test
) with the following simple attributes:
System name |
Display Name |
Type |
System Type Name |
---|---|---|---|
name |
name |
Строка |
String |
quantity |
quantity |
Integer |
Integer |
price |
price |
Number |
Number |
date |
date |
date |
Date |
is_active |
is_active |
Boolean |
Boolean |
In the example we have a directory (the system name of the directory - lookup_test
) with the following simple attributes:
System name |
Display name |
Type |
System name type |
---|---|---|---|
name |
Name |
Line |
String |
quantity |
Quantity |
Integer |
Integer |
price |
Price |
Numerical |
Number |
date |
Date |
Date |
Date |
is_active |
Active |
Logical |
Boolean |
And a code attribute (is unique and immutable after the record is created)
System name |
Display name |
Type |
System name type |
---|---|---|---|
article_number |
Article number |
Line |
String |
Creating a registry entry with a draft:
We remember the drafted of the created draft
We remember the etalon Id of the created record
Creating a registry entry without a draft, immediately published:
Saving a new registry entry to a draft with draftId = 0
We remember the etalon Id of the created record
Changing a registry entry with a draft:
Need an etalonId record
Memorizing the draftID of the draft
Changing a registry entry without a draft is immediately published:
Need an etalonId record
Saving a modified registry entry to a draft with draftId = 0
Deleting a registry entry:
Need an etalonId record
Creating a directory entry with a draft:
Memorizing the draftId of the draft
We remember the etalonId of the created record
Creating a directory entry without a draft, immediately published:
Creating a directory entry in a draft with draftId = 0
We remember the etalonId of the created record
Changing a directory entry with a draft:
Need an etalonId record
Memorizing the draftID of the draft
Getting a directory entry by etalonId with the right draftId
Changing a directory entry without a draft is immediately published:
Need an etalonId record
Getting a directory entry by etalonId with draftId = 0
Saving a modified directory entry in a draft with draftId = 0
Deleting a directory entry:
Need an etalonId Record
Authorization¶
Getting an authorization token
POST
/api/v2/core/authentication/login
Request body
{
"userName": "admin",
"password": "admin",
"locale": "ru"
}
Response
{
"details": { //The list of errors, if any, is present in all results
"info": [],
"warning": [],
"error": []
},
"token": "7dc491c5-312e-4e2f-8491-c5312e9e2fb2", //The token we need
"rights": [],
"userInfo": {
"createdAt": "2023-08-16T11:20:03.296237Z",
"updatedAt": null,
"createdBy": null,
"updatedBy": null,
"login": "admin",
"firstName": "Admin",
"middleName": null,
"lastName": "Root",
"fullName": "Admin Root",
"admin": true,
"active": true,
"email": "mail@example.com",
"locale": "ru",
"tags": [],
"roles": [
"ADMIN"
],
"delegatedRoles": [],
"rolesData": [
{
"createdAt": null,
"updatedAt": null,
"createdBy": null,
"updatedBy": null,
"name": "ADMIN",
"displayName": "Administrator",
"type": "SYSTEM",
"rights": [],
"securityLabels": [],
"properties": []
}
],
"securityLabels": [],
"properties": [],
"external": false,
"securityDataSource": "UNIDATA",
"emailNotification": false
},
"forcePasswordChange": false,
"tokenTTL": 1800,
"buildVersion": "app.version.app.svn_revision.app.build_number app.build_date",
"forceLicenseChange": null
}
Registries and directories¶
Creating a draft data model¶
POST
/api/v2/draft/upsert
Request body
{
"type": "data-model", //"data-model" - draft data model
"subjectId": "default", //Since there is only one model, то default
"description": "Draft from 16.08.2023 14:31:52", //Optional comment/description to the draft
"tags": [],
"parameters": {}
}
Response
{
"details": {
"info": [],
"warning": [],
"error": []
},
"draft": {
"type": "data-model",
"subjectId": "default",
"description": "Draft from 16.08.2023 14:31:52",
"owner": "admin",
"ownerFullName": "Admin Root",
"createdBy": "admin",
"updatedBy": null,
"draftId": 2, //ID draft, you need to remember in order to make changes to the model in this draft
"parentDraftId": null,
"editionsCount": 0,
"createDate": "2023-08-16T11:31:52.277Z",
"updateDate": null,
"tags": [],
"state": "RUNNING" //CREATED - the draft has been created, but it has not been worked with yet. RUNNING - working with the draft
}
}
Creating a registry¶
POST
/api/v2/data/model/register-entities/upsert
Request body
{
"draftId": 2, //ID a draft within which we create a registry. To create an immediately published registry, set 0
"registerEntity": {
"name": "reg_test",
"displayName": "Test registry",
"description": "Test registry for documentation",
"hasData": false,
"isPublished": false,
"groupName": "",
"version": "",
"dashboardVisible": false,
"validityPeriod": null,
"externalIdGenerationStrategy": null,
"mergeSettings": null,
"simpleAttributes": [
{
"dictionaryDataType": "",
"defaultUnitId": null,
"displayable": true,
"enumDataType": "",
"linkDataType": "",
"lookupEntityCodeAttributeType": "",
"lookupEntityDisplayAttributes": [],
"lookupEntitySearchAttributes": [],
"lookupEntityType": "",
"lookupIsHierarchical": false,
"mainDisplayable": true,
"nullable": false,
"searchable": true,
"searchCaseInsensitive": false,
"searchMorphologically": false,
"simpleDataType": "String",
"valueId": null,
"unique": false,
"useAttributeNameForDisplay": false,
"name": "name",
"displayName": "Name",
"description": "",
"readOnly": false,
"hidden": false,
"order": 1,
"customProperties": [
{
"name": "DATACARD_ATTRIBUTE_TYPE",
"value": "default"
},
{
"name": "DATACARD_ATTRIBUTE_PREVIEW_TYPE",
"value": "default"
}
]
},
{
"dictionaryDataType": "",
"defaultUnitId": null,
"displayable": true,
"enumDataType": "",
"linkDataType": "",
"lookupEntityCodeAttributeType": "",
"lookupEntityDisplayAttributes": [],
"lookupEntitySearchAttributes": [],
"lookupEntityType": "",
"lookupIsHierarchical": false,
"mainDisplayable": false,
"nullable": true,
"searchable": false,
"searchCaseInsensitive": false,
"searchMorphologically": false,
"simpleDataType": "Integer",
"valueId": null,
"unique": false,
"useAttributeNameForDisplay": false,
"name": "quantity",
"displayName": "Quantity",
"description": "",
"readOnly": false,
"hidden": false,
"order": 3,
"customProperties": [
{
"name": "DATACARD_ATTRIBUTE_TYPE",
"value": "default"
},
{
"name": "DATACARD_ATTRIBUTE_PREVIEW_TYPE",
"value": "default"
}
]
},
{
"dictionaryDataType": "",
"defaultUnitId": null,
"displayable": true,
"enumDataType": "",
"linkDataType": "",
"lookupEntityCodeAttributeType": "",
"lookupEntityDisplayAttributes": [],
"lookupEntitySearchAttributes": [],
"lookupEntityType": "",
"lookupIsHierarchical": false,
"mainDisplayable": false,
"nullable": true,
"searchable": true,
"searchCaseInsensitive": false,
"searchMorphologically": false,
"simpleDataType": "Boolean",
"valueId": null,
"unique": false,
"useAttributeNameForDisplay": false,
"name": "is_active",
"displayName": "Active",
"description": "",
"readOnly": false,
"hidden": false,
"order": 4,
"customProperties": [
{
"name": "DATACARD_ATTRIBUTE_TYPE",
"value": "default"
},
{
"name": "DATACARD_ATTRIBUTE_PREVIEW_TYPE",
"value": "default"
}
]
},
{
"dictionaryDataType": "",
"defaultUnitId": null,
"displayable": true,
"enumDataType": "",
"linkDataType": "",
"lookupEntityCodeAttributeType": "",
"lookupEntityDisplayAttributes": [],
"lookupEntitySearchAttributes": [],
"lookupEntityType": "",
"lookupIsHierarchical": false,
"mainDisplayable": false,
"nullable": true,
"searchable": false,
"searchCaseInsensitive": false,
"searchMorphologically": false,
"simpleDataType": "Date",
"valueId": null,
"unique": false,
"useAttributeNameForDisplay": false,
"name": "date",
"displayName": "Data",
"description": "",
"readOnly": false,
"hidden": false,
"order": 5,
"customProperties": [
{
"name": "DATACARD_ATTRIBUTE_TYPE",
"value": "default"
},
{
"name": "DATACARD_ATTRIBUTE_PREVIEW_TYPE",
"value": "default"
}
]
},
{
"dictionaryDataType": "",
"defaultUnitId": null,
"displayable": true,
"enumDataType": "",
"linkDataType": "",
"lookupEntityCodeAttributeType": "",
"lookupEntityDisplayAttributes": [],
"lookupEntitySearchAttributes": [],
"lookupEntityType": "",
"lookupIsHierarchical": false,
"mainDisplayable": false,
"nullable": true,
"searchable": true,
"searchCaseInsensitive": false,
"searchMorphologically": false,
"simpleDataType": "Number",
"valueId": null,
"unique": false,
"useAttributeNameForDisplay": false,
"name": "rate",
"displayName": "Цена",
"description": "",
"readOnly": false,
"hidden": false,
"order": 2,
"customProperties": [
{
"name": "DATACARD_ATTRIBUTE_TYPE",
"value": "default"
},
{
"name": "DATACARD_ATTRIBUTE_PREVIEW_TYPE",
"value": "default"
}
]
}
],
"complexAttributes": [],
"arrayAttributes": [],
"relations": [],
"attributeGroups": [],
"customProperties": []
}
}
Response
{
"details": {
"info": [],
"warning": [],
"error": []
},
"draftId": 2
}
Getting a registry¶
GET
/api/v2/data/model/register-entities/reg_test?draftId=2
reg_test - the system name of the registry you are looking for
draftId - the draft in which we are looking for the registry to search for the published set the registry version draftId=0
Response
{
"details": {
"info": [],
"warning": [],
"error": []
},
"registerEntity": {
"simpleAttributes": [
{
"name": "name",
"displayName": "Name",
"description": "",
"readOnly": false,
"hidden": false,
"rights": {
"createdAt": null,
"updatedAt": null,
"createdBy": null,
"updatedBy": null,
"securedResource": {
"id": "DATA:reg_test.name",
"name": null,
"displayName": null,
"type": null,
"category": null,
"parent": null,
"children": null
},
"rights": [
"READ",
"DELETE",
"CREATE",
"UPDATE"
]
},
"customProperties": [
{
"name": "DATACARD_ATTRIBUTE_TYPE",
"value": "default"
},
{
"name": "DATACARD_ATTRIBUTE_PREVIEW_TYPE",
"value": "default"
}
],
"nullable": false,
"unique": false,
"searchable": true,
"simpleDataType": "String",
"displayable": true,
"mainDisplayable": true,
"generationStrategy": null,
"enumDataType": "",
"lookupEntityType": "",
"lookupEntityCodeAttributeType": null,
"lookupEntityDisplayAttributes": [],
"lookupIsHierarchical": false,
"lookupMaxHierarchyLevel": 0,
"dictionaryDataType": "",
"lookupEntitySearchAttributes": [],
"useAttributeNameForDisplay": false,
"linkDataType": "",
"valueId": null,
"defaultUnitId": null,
"order": 1,
"searchMorphologically": false,
"searchCaseInsensitive": false
},
{
"name": "quantity",
"displayName": "Quantity",
"description": "",
"readOnly": false,
"hidden": false,
"rights": {
"createdAt": null,
"updatedAt": null,
"createdBy": null,
"updatedBy": null,
"securedResource": {
"id": "DATA:reg_test.quantity",
"name": null,
"displayName": null,
"type": null,
"category": null,
"parent": null,
"children": null
},
"rights": [
"READ",
"DELETE",
"CREATE",
"UPDATE"
]
},
"customProperties": [
{
"name": "DATACARD_ATTRIBUTE_TYPE",
"value": "default"
},
{
"name": "DATACARD_ATTRIBUTE_PREVIEW_TYPE",
"value": "default"
}
],
"nullable": true,
"unique": false,
"searchable": false,
"simpleDataType": "Integer",
"displayable": true,
"mainDisplayable": false,
"generationStrategy": null,
"enumDataType": "",
"lookupEntityType": "",
"lookupEntityCodeAttributeType": null,
"lookupEntityDisplayAttributes": [],
"lookupIsHierarchical": false,
"lookupMaxHierarchyLevel": 0,
"dictionaryDataType": "",
"lookupEntitySearchAttributes": [],
"useAttributeNameForDisplay": false,
"linkDataType": "",
"valueId": null,
"defaultUnitId": null,
"order": 3,
"searchMorphologically": false,
"searchCaseInsensitive": false
},
{
"name": "is_active",
"displayName": "Active",
"description": "",
"readOnly": false,
"hidden": false,
"rights": {
"createdAt": null,
"updatedAt": null,
"createdBy": null,
"updatedBy": null,
"securedResource": {
"id": "DATA:reg_test.is_active",
"name": null,
"displayName": null,
"type": null,
"category": null,
"parent": null,
"children": null
},
"rights": [
"READ",
"DELETE",
"CREATE",
"UPDATE"
]
},
"customProperties": [
{
"name": "DATACARD_ATTRIBUTE_TYPE",
"value": "default"
},
{
"name": "DATACARD_ATTRIBUTE_PREVIEW_TYPE",
"value": "default"
}
],
"nullable": true,
"unique": false,
"searchable": true,
"simpleDataType": "Boolean",
"displayable": true,
"mainDisplayable": false,
"generationStrategy": null,
"enumDataType": "",
"lookupEntityType": "",
"lookupEntityCodeAttributeType": null,
"lookupEntityDisplayAttributes": [],
"lookupIsHierarchical": false,
"lookupMaxHierarchyLevel": 0,
"dictionaryDataType": "",
"lookupEntitySearchAttributes": [],
"useAttributeNameForDisplay": false,
"linkDataType": "",
"valueId": null,
"defaultUnitId": null,
"order": 4,
"searchMorphologically": false,
"searchCaseInsensitive": false
},
{
"name": "date",
"displayName": "Date",
"description": "",
"readOnly": false,
"hidden": false,
"rights": {
"createdAt": null,
"updatedAt": null,
"createdBy": null,
"updatedBy": null,
"securedResource": {
"id": "DATA:reg_test.date",
"name": null,
"displayName": null,
"type": null,
"category": null,
"parent": null,
"children": null
},
"rights": [
"READ",
"DELETE",
"CREATE",
"UPDATE"
]
},
"customProperties": [
{
"name": "DATACARD_ATTRIBUTE_TYPE",
"value": "default"
},
{
"name": "DATACARD_ATTRIBUTE_PREVIEW_TYPE",
"value": "default"
}
],
"nullable": true,
"unique": false,
"searchable": false,
"simpleDataType": "Date",
"displayable": true,
"mainDisplayable": false,
"generationStrategy": null,
"enumDataType": "",
"lookupEntityType": "",
"lookupEntityCodeAttributeType": null,
"lookupEntityDisplayAttributes": [],
"lookupIsHierarchical": false,
"lookupMaxHierarchyLevel": 0,
"dictionaryDataType": "",
"lookupEntitySearchAttributes": [],
"useAttributeNameForDisplay": false,
"linkDataType": "",
"valueId": null,
"defaultUnitId": null,
"order": 5,
"searchMorphologically": false,
"searchCaseInsensitive": false
},
{
"name": "rate",
"displayName": "Rate",
"description": "",
"readOnly": false,
"hidden": false,
"rights": {
"createdAt": null,
"updatedAt": null,
"createdBy": null,
"updatedBy": null,
"securedResource": {
"id": "DATA:reg_test.rate",
"name": null,
"displayName": null,
"type": null,
"category": null,
"parent": null,
"children": null
},
"rights": [
"READ",
"DELETE",
"CREATE",
"UPDATE"
]
},
"customProperties": [
{
"name": "DATACARD_ATTRIBUTE_TYPE",
"value": "default"
},
{
"name": "DATACARD_ATTRIBUTE_PREVIEW_TYPE",
"value": "default"
}
],
"nullable": true,
"unique": false,
"searchable": true,
"simpleDataType": "Number",
"displayable": true,
"mainDisplayable": false,
"generationStrategy": null,
"enumDataType": "",
"lookupEntityType": "",
"lookupEntityCodeAttributeType": null,
"lookupEntityDisplayAttributes": [],
"lookupIsHierarchical": false,
"lookupMaxHierarchyLevel": 0,
"dictionaryDataType": "",
"lookupEntitySearchAttributes": [],
"useAttributeNameForDisplay": false,
"linkDataType": "",
"valueId": null,
"defaultUnitId": null,
"order": 2,
"searchMorphologically": false,
"searchCaseInsensitive": false
}
],
"arrayAttributes": [],
"entityDependency": null,
"customProperties": [],
"name": "reg_test",
"displayName": "Test registry",
"description": "Test registry for documentation",
"order": 0,
"version": "1",
"complexAttributes": [],
"hasData": false,
"modelName": null,
"relations": [],
"mergeSettings": null,
"attributeGroups": [],
"relationGroups": [],
"flyweight": false,
"validityPeriod": null,
"externalIdGenerationStrategy": null,
"hierarchical": false,
"maxHierarchyLevel": 0,
"dashboardVisible": false
}
}
Getting a list of registries/directories¶
GET
/api/v2/data/model/entity-groups?draftId=2
draftId - the draft in which we are looking for, to search for published versions registers /directories set draftId=0
Response .. code:: json
- {
"name": "ROOT", "displayName": "Root group", "parentName": null, "type": "group", "children": [
- {
"name": "reg_test", "displayName": "Test registry", "parentName": "ROOT", "type": "register", "leaf": true
}
], "leaf": false
}
Creating a directory¶
POST
/api/v2/data/model/lookup-entities/upsert
Request body
{
"draftId": 2,
"lookupEntity": {
"hierarchical": false,
"name": "lookup_test",
"displayName": "Test reference",
"description": "Test reference for documentation",
"hasData": false,
"isPublished": false,
"groupName": "",
"version": "",
"dashboardVisible": false,
"validityPeriod": null,
"codeAttribute": {
"displayable": true,
"mainDisplayable": false,
"nullable": false,
"searchable": true,
"searchCaseInsensitive": false,
"searchMorphologically": false,
"simpleDataType": "String",
"unique": true,
"name": "article_number",
"displayName": "Article",
"description": "",
"readOnly": false,
"hidden": false,
"order": 0,
"generationStrategy": null,
"customProperties": [
{
"name": "DATACARD_ATTRIBUTE_TYPE",
"value": "default"
},
{
"name": "DATACARD_ATTRIBUTE_PREVIEW_TYPE",
"value": "default"
}
]
},
"externalIdGenerationStrategy": null,
"mergeSettings": null,
"simpleAttributes": [
{
"dictionaryDataType": "",
"defaultUnitId": null,
"displayable": true,
"enumDataType": "",
"linkDataType": "",
"lookupEntityCodeAttributeType": "",
"lookupEntityDisplayAttributes": [],
"lookupEntitySearchAttributes": [],
"lookupEntityType": "",
"lookupIsHierarchical": false,
"mainDisplayable": true,
"nullable": false,
"searchable": true,
"searchCaseInsensitive": true,
"searchMorphologically": true,
"simpleDataType": "String",
"valueId": null,
"unique": false,
"useAttributeNameForDisplay": false,
"name": "name",
"displayName": "Name",
"description": "",
"readOnly": false,
"hidden": false,
"order": 1,
"customProperties": [
{
"name": "DATACARD_ATTRIBUTE_TYPE",
"value": "default"
},
{
"name": "DATACARD_ATTRIBUTE_PREVIEW_TYPE",
"value": "default"
}
]
},
{
"dictionaryDataType": "",
"defaultUnitId": null,
"displayable": true,
"enumDataType": "",
"linkDataType": "",
"lookupEntityCodeAttributeType": "",
"lookupEntityDisplayAttributes": [],
"lookupEntitySearchAttributes": [],
"lookupEntityType": "",
"lookupIsHierarchical": false,
"mainDisplayable": false,
"nullable": true,
"searchable": false,
"searchCaseInsensitive": false,
"searchMorphologically": false,
"simpleDataType": "Date",
"valueId": null,
"unique": false,
"useAttributeNameForDisplay": false,
"name": "date",
"displayName": "Дата",
"description": "",
"readOnly": false,
"hidden": false,
"order": 2,
"customProperties": [
{
"name": "DATACARD_ATTRIBUTE_TYPE",
"value": "default"
},
{
"name": "DATACARD_ATTRIBUTE_PREVIEW_TYPE",
"value": "default"
}
]
},
{
"dictionaryDataType": "",
"defaultUnitId": null,
"displayable": true,
"enumDataType": "",
"linkDataType": "",
"lookupEntityCodeAttributeType": "",
"lookupEntityDisplayAttributes": [],
"lookupEntitySearchAttributes": [],
"lookupEntityType": "",
"lookupIsHierarchical": false,
"mainDisplayable": false,
"nullable": false,
"searchable": true,
"searchCaseInsensitive": false,
"searchMorphologically": false,
"simpleDataType": "Boolean",
"valueId": null,
"unique": false,
"useAttributeNameForDisplay": false,
"name": "is_active",
"displayName": "Active",
"description": "",
"readOnly": false,
"hidden": false,
"order": 3,
"customProperties": [
{
"name": "DATACARD_ATTRIBUTE_TYPE",
"value": "default"
},
{
"name": "DATACARD_ATTRIBUTE_PREVIEW_TYPE",
"value": "default"
}
]
},
{
"dictionaryDataType": "",
"defaultUnitId": null,
"displayable": true,
"enumDataType": "",
"linkDataType": "",
"lookupEntityCodeAttributeType": "",
"lookupEntityDisplayAttributes": [],
"lookupEntitySearchAttributes": [],
"lookupEntityType": "",
"lookupIsHierarchical": false,
"mainDisplayable": false,
"nullable": false,
"searchable": true,
"searchCaseInsensitive": false,
"searchMorphologically": false,
"simpleDataType": "Integer",
"valueId": null,
"unique": false,
"useAttributeNameForDisplay": false,
"name": "quantity",
"displayName": "Quantity",
"description": "",
"readOnly": false,
"hidden": false,
"order": 4,
"customProperties": [
{
"name": "DATACARD_ATTRIBUTE_TYPE",
"value": "default"
},
{
"name": "DATACARD_ATTRIBUTE_PREVIEW_TYPE",
"value": "default"
}
]
},
{
"dictionaryDataType": "",
"defaultUnitId": null,
"displayable": true,
"enumDataType": "",
"linkDataType": "",
"lookupEntityCodeAttributeType": "",
"lookupEntityDisplayAttributes": [],
"lookupEntitySearchAttributes": [],
"lookupEntityType": "",
"lookupIsHierarchical": false,
"mainDisplayable": false,
"nullable": true,
"searchable": true,
"searchCaseInsensitive": false,
"searchMorphologically": false,
"simpleDataType": "Number",
"valueId": null,
"unique": false,
"useAttributeNameForDisplay": false,
"name": "rate",
"displayName": "Rate",
"description": "",
"readOnly": false,
"hidden": false,
"order": 5,
"customProperties": [
{
"name": "DATACARD_ATTRIBUTE_TYPE",
"value": "default"
},
{
"name": "DATACARD_ATTRIBUTE_PREVIEW_TYPE",
"value": "default"
}
]
}
],
"aliasCodeAttributes": [],
"arrayAttributes": [],
"attributeGroups": [],
"customProperties": []
}
}
Response
{
"details": {
"info": [],
"warning": [],
"error": []
},
"draftId": 2
}
Getting a draft of the data model¶
POST
/api/v2/draft/drafts
Request body
{
"query": {
"type": "data-model", //Drafts of the data model
"draftId": 2 //The draft you are looking for
},
"offset": 0,
"limit": 100
}
Response
{
"details": {
"info": [],
"warning": [],
"error": []
},
"drafts": [
{
"type": "data-model",
"subjectId": "default",
"description": "Draft from 16.08.2023 14:31:52",
"owner": "admin",
"ownerFullName": "Admin Root",
"createdBy": "admin",
"updatedBy": "admin",
"draftId": 2,
"parentDraftId": null,
"editionsCount": 3,
"createDate": "2023-08-16T11:31:52.278647Z",
"updateDate": "2023-08-16T11:51:08.953977Z",
"tags": [],
"state": "RUNNING"
}
],
"totalCount": 1
}
Publishing a draft¶
POST
/api/v2/draft/publish
Request body
{
"draftId": 2, //ID of the draft being published
"force": false, //Forced publication
"delete": true //Deleting a draft after publication
}
Response
{
"details": {
"info": [],
"warning": [],
"error": []
},
"draft": {
"type": "data-model",
"subjectId": "default",
"description": "Draft from 16.08.2023 14:31:52",
"owner": "admin",
"ownerFullName": "Admin Root",
"createdBy": "admin",
"updatedBy": "admin",
"draftId": 2,
"parentDraftId": null,
"editionsCount": 3,
"createDate": "2023-08-16T11:31:52.278647Z",
"updateDate": "2023-08-16T11:51:08.953977Z",
"tags": [],
"state": "PUBLISHED"
}
}
Registry Entries¶
Creating a draft for a new registry entry¶
POST
/api/v2/draft/upsert
Request body
{
"type": "record", //Provider for draft - type records
"subjectId": "", //There is no object yet, so there is no record ID
"description": "example draft to add record to entity", //Optional draft description
"parameters": { //Parameters for linking the draft to the desired registry
"namespace" : "register", //Registry namespace
"entity-name" : "reg_test" //Name of the registry
}
}
Response
{
"details": {
"info": [],
"warning": [],
"error": []
},
"draft": {
"type": "record",
"subjectId": "",
"description": "example draft to add record to entity",
"owner": "admin",
"ownerFullName": "Admin Root",
"createdBy": "admin",
"updatedBy": null,
"draftId": 3, //The ID of the draft that you need to remember to work with it
"parentDraftId": null,
"editionsCount": 0,
"createDate": "2023-07-17T11:05:20.678+03:00",
"updateDate": null,
"tags": [
"namespace:register",
"entity-name:reg_test"
],
"state": "CREATED" //Created
}
}
Saving a new registry entry to a draft¶
POST
/api/v2/data/atomic
Request body
{
"payload": {
"org.unidata.mdm.rest.v2.data": {
"draftId": 3, //The ID of the draft that we created for this record, if the value is 0, then the record will be published immediately
"dataRecord": { //Record data
"etalonId": "", //The record is new, so it doesn't have the ID of the reference record yet
"externalId": {
"externalId": "0379a510-3c2e-11ee-bb05-b3c44289bffc", //A unique external ID, it will be possible to update the record using it. Created by the API user. String value, for example, "reg_test_123"
"sourceSystem": "universe" //The source system, on behalf of which the entry is made, together with the external ID forms the key. Required field
},
"displayName": "",
"entityName": "reg_test", //Registry system name
"version": "",
"modified": false,
"validFrom": "1900-01-01T00:00:00.000Z", //The beginning of the period of relevance. Optionally, you can leave it empty to use the default period
"validTo": "2500-12-31T23:59:59.999Z", //The end of the period of relevance. Optionally, you can leave it empty to use the default period
"createDate": "",
"updateDate": "",
"simpleAttributes": [ //List of simple attributes
{ //String attribute "name"
"targetEtalonId": null,
"valueId": "",
"unitId": "",
"displayValue": null,
"value": "Some kind of name", //Attribute value
"type": "String", //Attribute type, here "String"
"name": "name", //The attribute's system name, here "name"
"hidden": false //For hidden attributes
},
{ //Numerical attribute "rate"
"targetEtalonId": null,
"valueId": "",
"unitId": "",
"displayValue": null,
"value": 1234.56,
"type": "Number", //Attribute type, here "Numeric"
"name": "rate",
"hidden": false
},
{ //Integer attribute "quantity"
"targetEtalonId": null,
"valueId": "",
"unitId": "",
"displayValue": null,
"value": 987,
"type": "Integer", //Attribute type, here "Integer"
"name": "quantity",
"hidden": false
},
{ //Logical attribute "is_active"
"targetEtalonId": null,
"valueId": "",
"unitId": "",
"displayValue": null,
"value": true,
"type": "Boolean", //Attribute type, here "Logical"
"name": "is_active",
"hidden": false
},
{ //The "date" attribute of the Date type
"targetEtalonId": null,
"valueId": "",
"unitId": "",
"displayValue": null,
"value": "2023-08-16",
"type": "Date", //Attribute type, here "Date"
"name": "date",
"hidden": false
}
],
"complexAttributes": [],
"arrayAttributes": [],
"codeAttributes": []
}
}
}
}
Response
{
"details": {
"info": [],
"warning": [],
"error": []
},
"payload": {
"org.unidata.mdm.rest.v2.matching.data": null,
"org.unidata.mdm.rest.v2.data": {
"details": {
"info": [],
"warning": [],
"error": []
},
"recordKeys": {
"etalonKey": {
"id": "4d25f80f-3c2e-11ee-bc14-393b8ca6fb76",
"status": "ACTIVE"
},
"originKeys": [
{
"externalId": {
"externalId": "0379a510-3c2e-11ee-bb05-b3c44289bffc",
"sourceSystem": "universe"
},
"enrichment": false,
"revision": 0,
"status": "ACTIVE",
"createDate": null,
"updateDate": null,
"createdBy": null,
"updatedBy": null
}
],
"entityName": "reg_test",
"lsn": {
"lsn": null,
"shard": 9
},
"node": 0,
"createDate": "2023-08-16T12:13:25.54Z",
"updateDate": "2023-08-16T12:13:25.54Z",
"createdBy": "admin",
"updatedBy": "admin",
"active": true,
"published": false,
"parent": null,
"children": []
},
"etalon": {
"simpleAttributes": [
{
"name": "name",
"type": "String",
"displayValue": null,
"targetEtalonId": null,
"valueId": null,
"unitId": null,
"value": "Some kind of name"
},
{
"name": "date",
"type": "Date",
"displayValue": null,
"targetEtalonId": null,
"valueId": null,
"unitId": null,
"value": "2023-08-16"
},
{
"name": "quantity",
"type": "Integer",
"displayValue": null,
"targetEtalonId": null,
"valueId": null,
"unitId": null,
"value": 987
},
{
"name": "is_active",
"type": "Boolean",
"displayValue": null,
"targetEtalonId": null,
"valueId": null,
"unitId": null,
"value": true
},
{
"name": "rate",
"type": "Number",
"displayValue": null,
"targetEtalonId": null,
"valueId": null,
"unitId": null,
"value": 1234.56
}
],
"arrayAttributes": [],
"complexAttributes": [],
"codeAttributes": [],
"etalonId": "4d25f80f-3c2e-11ee-bc14-393b8ca6fb76",
"modified": false,
"version": 0,
"entityName": "reg_test",
"namespace": "register",
"validFrom": "1900-01-01T00:00:00Z",
"validTo": "2500-12-31T23:59:59.999Z",
"status": "ACTIVE",
"lsn": null,
"createDate": "2023-08-16T12:13:25.540Z",
"createdBy": "admin",
"updateDate": "2023-08-16T12:13:25.540Z",
"updatedBy": "admin",
"rights": null,
"operationType": "DIRECT",
"diffToDraft": null,
"published": false
},
"relationsResult": {
"details": {
"info": [],
"warning": [],
"error": []
},
"etalonId": null,
"etalonRelations": null
}
},
"org.unidata.mdm.rest.v2.dq.data": null
}
}
Getting a draft registry entry¶
POST
/api/v2/draft/drafts
Request body
{
"query": {
"type": "record",
"draftId": 3
},
"offset": 0,
"limit": 100
}
Response
{
"details": {
"info": [],
"warning": [],
"error": []
},
"drafts": [
{
"type": "record",
"subjectId": "4d25f80f-3c2e-11ee-bc14-393b8ca6fb76",
"description": "Draft from 16.08.2023 15:11:21",
"owner": "admin",
"ownerFullName": "Admin Root",
"createdBy": "admin",
"updatedBy": "admin",
"draftId": 3,
"parentDraftId": null,
"editionsCount": 1,
"createDate": "2023-08-16T12:11:21.849982Z",
"updateDate": "2023-08-16T12:13:25.540263Z",
"tags": [
"entity-name:reg_test",
"namespace:register",
"record-external-id:0379a510-3c2e-11ee-bb05-b3c44289bffc\u001freg_test\u001funiverse",
"operation-code:UPSERT_DATA"
],
"state": "RUNNING"
}
],
"totalCount": 1
}
Publishing a draft registry entry¶
POST
/api/v2/draft/publish
Request body
{
"draftId": 3, //ID of the draft being published
"force": false, //Forced publication
"delete": true //Deleting a draft after publication
}
Response
{
"details": {
"info": [],
"warning": [],
"error": []
},
"draft": {
"type": "record",
"subjectId": "4d25f80f-3c2e-11ee-bc14-393b8ca6fb76",
"description": "Draft from 16.08.2023 15:11:21",
"owner": "admin",
"ownerFullName": "Admin Root",
"createdBy": "admin",
"updatedBy": "admin",
"draftId": 3,
"parentDraftId": null,
"editionsCount": 1,
"createDate": "2023-08-16T12:11:21.849982Z",
"updateDate": "2023-08-16T12:13:25.540263Z",
"tags": [
"entity-name:reg_test",
"namespace:register",
"record-external-id:0379a510-3c2e-11ee-bb05-b3c44289bffc\u001freg_test\u001funiverse",
"operation-code:UPSERT_DATA"
],
"state": "PUBLISHED" //Published
}
}
Getting a published registry entry by etalonId¶
POST
http://localhost:8082/universe-backend/api/v2/data/atomic/get
Request body
{
"payload": {
"org.unidata.mdm.rest.v2.data": {
"etalonId": "4d25f80f-3c2e-11ee-bc14-393b8ca6fb76",
"entityName": "reg_test",
"draftId": 0, //Published version
"timelineDate": "1900-01-01T00:00:00.000Z"
}
}
}
Response
{
"details": {
"info": [],
"warning": [],
"error": []
},
"payload": {
"org.unidata.mdm.rest.v2.matching.data": {
"results": []
},
"org.unidata.mdm.rest.v2.data": {
"details": {
"info": [],
"warning": [],
"error": []
},
"recordKeys": {
"etalonKey": {
"id": "4d25f80f-3c2e-11ee-bc14-393b8ca6fb76",
"status": "ACTIVE"
},
"originKeys": [
{
"externalId": {
"externalId": "0379a510-3c2e-11ee-bb05-b3c44289bffc",
"sourceSystem": "universe"
},
"enrichment": false,
"revision": 1,
"status": "ACTIVE",
"createDate": "2023-08-16T12:13:25.542Z",
"updateDate": null,
"createdBy": "admin",
"updatedBy": null
}
],
"entityName": "reg_test",
"lsn": {
"lsn": 1,
"shard": 9
},
"node": 0,
"createDate": "2023-08-16T12:13:25.542Z",
"updateDate": "2023-08-16T12:13:25.543Z",
"createdBy": "admin",
"updatedBy": "admin",
"active": true,
"published": true,
"parent": null,
"children": []
},
"etalon": {
"simpleAttributes": [
{
"name": "name",
"type": "String",
"displayValue": null,
"targetEtalonId": null,
"valueId": null,
"unitId": null,
"value": "Some kind of name"
},
{
"name": "date",
"type": "Date",
"displayValue": null,
"targetEtalonId": null,
"valueId": null,
"unitId": null,
"value": "2023-08-16"
},
{
"name": "quantity",
"type": "Integer",
"displayValue": null,
"targetEtalonId": null,
"valueId": null,
"unitId": null,
"value": 987
},
{
"name": "is_active",
"type": "Boolean",
"displayValue": null,
"targetEtalonId": null,
"valueId": null,
"unitId": null,
"value": true
},
{
"name": "rate",
"type": "Number",
"displayValue": null,
"targetEtalonId": null,
"valueId": null,
"unitId": null,
"value": 1234.56
}
],
"arrayAttributes": [],
"complexAttributes": [],
"codeAttributes": [],
"etalonId": "4d25f80f-3c2e-11ee-bc14-393b8ca6fb76",
"modified": false,
"version": 0,
"entityName": "reg_test",
"namespace": "register",
"validFrom": "1900-01-01T00:00:00Z",
"validTo": "2500-12-31T23:59:59.999Z",
"status": "ACTIVE",
"lsn": {
"lsn": 1,
"shard": 9
},
"createDate": "2023-08-16T12:13:25.542Z",
"createdBy": "admin",
"updateDate": "2023-08-16T12:13:25.543Z",
"updatedBy": "admin",
"rights": null,
"operationType": "DIRECT",
"diffToDraft": null,
"published": true
},
"origins": null,
"vistory": null
},
"org.unidata.mdm.rest.v2.dq.data": {
"results": []
}
}
}
Creating a draft to modify a registry entry¶
POST
/api/v2/draft/upsert
Request body
{
"type": "record",
"subjectId": "4d25f80f-3c2e-11ee-bc14-393b8ca6fb76", //etalonId the record we want to change
"description": "Draft from 16.08.2023 15:27:02",
"tags": [
"entity-name:reg_test",
"namespace:register"
],
"parameters": {
"entity-name": "reg_test"
}
}
Response
{
"details": {
"info": [],
"warning": [],
"error": []
},
"draft": {
"type": "record",
"subjectId": "4d25f80f-3c2e-11ee-bc14-393b8ca6fb76",
"description": "Draft from 16.08.2023 15:27:02",
"owner": "admin",
"ownerFullName": "Admin Root",
"createdBy": "admin",
"updatedBy": null,
"draftId": 4,
"parentDraftId": null,
"editionsCount": 0,
"createDate": "2023-08-16T12:27:02.764Z",
"updateDate": null,
"tags": [
"entity-name:reg_test",
"namespace:register"
],
"state": "CREATED"
}
}
Getting the version of a registry entry from a draft¶
If we want a published version, then we set draftId=0
The record is the “org.unidata.mdm.rest.v2.data” object in the response
POST
/api/v2/data/atomic/get
Request body
{
"payload": {
"org.unidata.mdm.rest.v2.data": {
"etalonId": "4d25f80f-3c2e-11ee-bc14-393b8ca6fb76",
"entityName": "reg_test",
"draftId": 4,
"timelineDate": "1900-01-01T00:00:00.000Z"
}
}
}
Response
{
"details": {
"info": [],
"warning": [],
"error": []
},
"payload": {
"org.unidata.mdm.rest.v2.matching.data": {
"results": []
},
"org.unidata.mdm.rest.v2.data": {
"details": {
"info": [],
"warning": [],
"error": []
},
"recordKeys": {
"etalonKey": {
"id": "4d25f80f-3c2e-11ee-bc14-393b8ca6fb76",
"status": "ACTIVE"
},
"originKeys": [
{
"externalId": {
"externalId": "0379a510-3c2e-11ee-bb05-b3c44289bffc",
"sourceSystem": "universe"
},
"enrichment": false,
"revision": 1,
"status": "ACTIVE",
"createDate": "2023-08-16T12:13:25.542Z",
"updateDate": null,
"createdBy": "admin",
"updatedBy": null
}
],
"entityName": "reg_test",
"lsn": {
"lsn": 1,
"shard": 9
},
"node": 0,
"createDate": "2023-08-16T12:13:25.542Z",
"updateDate": "2023-08-16T12:13:25.543Z",
"createdBy": "admin",
"updatedBy": "admin",
"active": true,
"published": true,
"parent": null,
"children": []
},
"etalon": {
"simpleAttributes": [
{
"name": "name",
"type": "String",
"displayValue": null,
"targetEtalonId": null,
"valueId": null,
"unitId": null,
"value": "Some kind of name"
},
{
"name": "date",
"type": "Date",
"displayValue": null,
"targetEtalonId": null,
"valueId": null,
"unitId": null,
"value": "2023-08-16"
},
{
"name": "quantity",
"type": "Integer",
"displayValue": null,
"targetEtalonId": null,
"valueId": null,
"unitId": null,
"value": 987
},
{
"name": "is_active",
"type": "Boolean",
"displayValue": null,
"targetEtalonId": null,
"valueId": null,
"unitId": null,
"value": true
},
{
"name": "rate",
"type": "Number",
"displayValue": null,
"targetEtalonId": null,
"valueId": null,
"unitId": null,
"value": 1234.56
}
],
"arrayAttributes": [],
"complexAttributes": [],
"codeAttributes": [],
"etalonId": "4d25f80f-3c2e-11ee-bc14-393b8ca6fb76",
"modified": false,
"version": 0,
"entityName": "reg_test",
"namespace": "register",
"validFrom": "1900-01-01T00:00:00Z",
"validTo": "2500-12-31T23:59:59.999Z",
"status": "ACTIVE",
"lsn": {
"lsn": 1,
"shard": 9
},
"createDate": "2023-08-16T12:13:25.542Z",
"createdBy": "admin",
"updateDate": "2023-08-16T12:13:25.543Z",
"updatedBy": "admin",
"rights": null,
"operationType": "DIRECT",
"diffToDraft": null,
"published": true
},
"origins": null,
"vistory": null
},
"org.unidata.mdm.rest.v2.dq.data": {
"results": []
}
}
}
Saving a modified registry entry to a draft¶
If you set draftId=0, the entry will be published immediately without a draft
This is an insertion of a record, so in order not to change the attribute value and not to clear it, you need to insert their values from the existing version
A record change is a complete rewrite of a record by etalonId or a combination of externalId and source system from Saving a new entry to a draft
For comments on the fields, see Saving a new entry to a draft
POST
/api/v2/data/atomic
Request body
{
"payload": {
"org.unidata.mdm.rest.v2.data": {
"draftId": 4,
"dataRecord": {
"etalonId": "4d25f80f-3c2e-11ee-bc14-393b8ca6fb76",
"displayName": "",
"entityName": "reg_test",
"namespace": "register",
"version": "0",
"modified": false,
"validFrom": "1900-01-01T00:00:00.000Z",
"validTo": "2500-12-31T23:59:59.999Z",
"createDate": "2023-08-16T12:13:25.542Z",
"updateDate": "2023-08-16T12:13:25.543Z",
"status": "ACTIVE",
"simpleAttributes": [
{
"targetEtalonId": null,
"valueId": "",
"unitId": "",
"displayValue": null,
"value": "Some kind of changed name",
"type": "String",
"name": "name",
"hidden": false
},
{
"targetEtalonId": null,
"valueId": "",
"unitId": "",
"displayValue": null,
"value": "2023-08-17",
"type": "Date",
"name": "date",
"hidden": false
},
{
"targetEtalonId": null,
"valueId": "",
"unitId": "",
"displayValue": null,
"value": 123,
"type": "Integer",
"name": "quantity",
"hidden": false
},
{
"targetEtalonId": null,
"valueId": "",
"unitId": "",
"displayValue": null,
"value": false,
"type": "Boolean",
"name": "is_active",
"hidden": false
},
{
"targetEtalonId": null,
"valueId": "",
"unitId": "",
"displayValue": null,
"value": 9876.43,
"type": "Number",
"name": "rate",
"hidden": false
}
],
"complexAttributes": [],
"arrayAttributes": [],
"codeAttributes": []
}
}
}
}
Response
{
"details": {
"info": [],
"warning": [],
"error": []
},
"payload": {
"org.unidata.mdm.rest.v2.matching.data": null,
"org.unidata.mdm.rest.v2.data": {
"details": {
"info": [],
"warning": [],
"error": []
},
"recordKeys": {
"etalonKey": {
"id": "4d25f80f-3c2e-11ee-bc14-393b8ca6fb76",
"status": "ACTIVE"
},
"originKeys": [
{
"externalId": {
"externalId": "0379a510-3c2e-11ee-bb05-b3c44289bffc",
"sourceSystem": "universe"
},
"enrichment": false,
"revision": 1,
"status": "ACTIVE",
"createDate": "2023-08-16T12:13:25.542Z",
"updateDate": null,
"createdBy": "admin",
"updatedBy": null
}
],
"entityName": "reg_test",
"lsn": {
"lsn": 1,
"shard": 9
},
"node": 0,
"createDate": "2023-08-16T12:13:25.542Z",
"updateDate": "2023-08-16T12:31:10.835Z",
"createdBy": "admin",
"updatedBy": "admin",
"active": true,
"published": true,
"parent": null,
"children": []
},
"etalon": {
"simpleAttributes": [
{
"name": "name",
"type": "String",
"displayValue": null,
"targetEtalonId": null,
"valueId": null,
"unitId": null,
"value": "Some kind of changed name"
},
{
"name": "date",
"type": "Date",
"displayValue": null,
"targetEtalonId": null,
"valueId": null,
"unitId": null,
"value": "2023-08-17"
},
{
"name": "quantity",
"type": "Integer",
"displayValue": null,
"targetEtalonId": null,
"valueId": null,
"unitId": null,
"value": 123
},
{
"name": "is_active",
"type": "Boolean",
"displayValue": null,
"targetEtalonId": null,
"valueId": null,
"unitId": null,
"value": false
},
{
"name": "rate",
"type": "Number",
"displayValue": null,
"targetEtalonId": null,
"valueId": null,
"unitId": null,
"value": 9876.43
}
],
"arrayAttributes": [],
"complexAttributes": [],
"codeAttributes": [],
"etalonId": "4d25f80f-3c2e-11ee-bc14-393b8ca6fb76",
"modified": false,
"version": 0,
"entityName": "reg_test",
"namespace": "register",
"validFrom": "1900-01-01T00:00:00Z",
"validTo": "2500-12-31T23:59:59.999Z",
"status": "ACTIVE",
"lsn": {
"lsn": 1,
"shard": 9
},
"createDate": "2023-08-16T12:13:25.542Z",
"createdBy": "admin",
"updateDate": "2023-08-16T12:31:10.835Z",
"updatedBy": "admin",
"rights": null,
"operationType": "DIRECT",
"diffToDraft": null,
"published": true
},
"relationsResult": {
"details": {
"info": [],
"warning": [],
"error": []
},
"etalonId": null,
"etalonRelations": null
}
},
"org.unidata.mdm.rest.v2.dq.data": null
}
}
Publishing a draft with a modified registry entry¶
POST
/api/v2/draft/publish
Request body
{
"draftId": 4,
"force": false,
"delete": true
}
Response
{
"details": {
"info": [],
"warning": [],
"error": []
},
"draft": {
"type": "record",
"subjectId": "4d25f80f-3c2e-11ee-bc14-393b8ca6fb76",
"description": "Draft from 16.08.2023 15:27:02",
"owner": "admin",
"ownerFullName": "Admin Root",
"createdBy": "admin",
"updatedBy": "admin",
"draftId": 4,
"parentDraftId": null,
"editionsCount": 1,
"createDate": "2023-08-16T12:27:02.765353Z",
"updateDate": "2023-08-16T12:31:10.835374Z",
"tags": [
"entity-name:reg_test",
"namespace:register",
"record-external-id:0379a510-3c2e-11ee-bb05-b3c44289bffc\u001freg_test\u001funiverse",
"operation-code:UPSERT_DATA"
],
"state": "PUBLISHED"
}
}
Deleting a registry entry¶
DELETE
/api/v2/data/records/delete/reg_test/4d25f80f-3c2e-11ee-bc14-393b8ca6fb76?wipe=false&inactivateEtalon=true
The request above for the logical deletion of the record with the deactivation of the reference is the standard behavior
reg_test
- the system name of the registry from which we are deleting4d25f80f-3c2e-11ee-bc14-393b8ca6fb76
- etalonId of the record being deletedwipe
-false
- logical deletion, can be restored,true
- physical removalinactivateEtalon
- deactivating the record reference
Returns the version of the record before deleting
Response
{
"details": {
"info": [],
"warning": [],
"error": []
},
"recordKeys": {
"etalonKey": {
"id": "4d25f80f-3c2e-11ee-bc14-393b8ca6fb76",
"status": "ACTIVE"
},
"originKeys": [
{
"externalId": {
"externalId": "0379a510-3c2e-11ee-bb05-b3c44289bffc",
"sourceSystem": "universe"
},
"enrichment": false,
"revision": 2,
"status": "ACTIVE",
"createDate": "2023-08-16T12:13:25.542Z",
"updateDate": null,
"createdBy": "admin",
"updatedBy": null
}
],
"entityName": "reg_test",
"lsn": {
"lsn": 1,
"shard": 9
},
"node": 0,
"createDate": "2023-08-16T12:13:25.542Z",
"updateDate": "2023-08-16T12:31:10.838Z",
"createdBy": "admin",
"updatedBy": "admin",
"active": true,
"published": true,
"parent": null,
"children": []
},
"key": "4d25f80f-3c2e-11ee-bc14-393b8ca6fb76"
}
Getting a logically deleted record¶
POST
/api/v2/data/atomic/get
Request body
{
"payload": {
"org.unidata.mdm.rest.v2.data": {
"etalonId": "4d25f80f-3c2e-11ee-bc14-393b8ca6fb76",
"entityName": "reg_test",
"draftId": 0,
"timelineDate": "1900-01-01T00:00:00.000Z"
}
}
}
Response
{
"details": {
"info": [],
"warning": [],
"error": []
},
"payload": {
"org.unidata.mdm.rest.v2.matching.data": {
"results": []
},
"org.unidata.mdm.rest.v2.data": {
"details": {
"info": [],
"warning": [],
"error": []
},
"recordKeys": {
"etalonKey": {
"id": "4d25f80f-3c2e-11ee-bc14-393b8ca6fb76",
"status": "INACTIVE"
},
"originKeys": [
{
"externalId": {
"externalId": "0379a510-3c2e-11ee-bb05-b3c44289bffc",
"sourceSystem": "universe"
},
"enrichment": false,
"revision": 2,
"status": "ACTIVE",
"createDate": "2023-08-16T12:13:25.542Z",
"updateDate": null,
"createdBy": "admin",
"updatedBy": null
}
],
"entityName": "reg_test",
"lsn": {
"lsn": 1,
"shard": 9
},
"node": 0,
"createDate": "2023-08-16T12:13:25.542Z",
"updateDate": "2023-08-16T12:35:47.033Z",
"createdBy": "admin",
"updatedBy": "admin",
"active": false,
"published": true,
"parent": null,
"children": []
},
"etalon": {
"simpleAttributes": [
{
"name": "name",
"type": "String",
"displayValue": null,
"targetEtalonId": null,
"valueId": null,
"unitId": null,
"value": "Some kind of changed name"
},
{
"name": "date",
"type": "Date",
"displayValue": null,
"targetEtalonId": null,
"valueId": null,
"unitId": null,
"value": "2023-08-17"
},
{
"name": "quantity",
"type": "Integer",
"displayValue": null,
"targetEtalonId": null,
"valueId": null,
"unitId": null,
"value": 123
},
{
"name": "is_active",
"type": "Boolean",
"displayValue": null,
"targetEtalonId": null,
"valueId": null,
"unitId": null,
"value": false
},
{
"name": "rate",
"type": "Number",
"displayValue": null,
"targetEtalonId": null,
"valueId": null,
"unitId": null,
"value": 9876.43
}
],
"arrayAttributes": [],
"complexAttributes": [],
"codeAttributes": [],
"etalonId": "4d25f80f-3c2e-11ee-bc14-393b8ca6fb76",
"modified": false,
"version": 0,
"entityName": "reg_test",
"namespace": "register",
"validFrom": "1900-01-01T00:00:00Z",
"validTo": "2500-12-31T23:59:59.999Z",
"status": "INACTIVE",
"lsn": {
"lsn": 1,
"shard": 9
},
"createDate": "2023-08-16T12:13:25.542Z",
"createdBy": "admin",
"updateDate": "2023-08-16T12:35:47.033Z",
"updatedBy": "admin",
"rights": null,
"operationType": "DIRECT",
"diffToDraft": null,
"published": true
},
"origins": null,
"vistory": null
},
"org.unidata.mdm.rest.v2.dq.data": {
"results": []
}
}
}
Inserting entries into the directory¶
Creating a draft for a new directory entry¶
POST
/api/v2/draft/upsert
Request body
{
"type": "record", //Provider for records
"subjectId": "", //There is no object yet
"description": "example draft to add record to reference set",
"parameters": {
"namespace" : "lookup", //Registry namespace
"entity-name" : "lookup_test" //Name of the registry
}
}
Response
{
"details": {
"info": [],
"warning": [],
"error": []
},
"draft": {
"type": "record",
"subjectId": "",
"description": "example draft to add record to reference set",
"owner": "admin",
"ownerFullName": "Admin Root",
"createdBy": "admin",
"updatedBy": null,
"draftId": 5,
"parentDraftId": null,
"editionsCount": 0,
"createDate": "2023-07-17T11:05:20.678+03:00",
"updateDate": null,
"tags": [
"namespace:lookup",
"entity-name:lookup_test"
],
"state": "CREATED"
}
}
Creating a directory entry in a draft¶
If draftId = 0, then the record is immediately published.
Look at Saving a new registry entry to a draft for comments on fields
The code attribute is unique and has not been changed after saving
POST
/api/v2/data/atomic
Request body
{
"payload": {
"org.unidata.mdm.rest.v2.data": {
"draftId": 5,
"dataRecord": {
"etalonId": "",
"externalId": {
"externalId": "0e460f30-3c40-11ee-9ad3-6df0a9cf14b3",
"sourceSystem": "universe"
},
"displayName": "",
"entityName": "lookup_test",
"version": "",
"modified": false,
"validFrom": "1900-01-01T00:00:00.000Z",
"validTo": "2500-12-31T23:59:59.999Z",
"createDate": "",
"updateDate": "",
"simpleAttributes": [
{
"targetEtalonId": null,
"valueId": "",
"unitId": "",
"displayValue": null,
"value": "Some kind of name",
"type": "String",
"name": "name",
"hidden": false
},
{
"targetEtalonId": null,
"valueId": "",
"unitId": "",
"displayValue": null,
"value": "2023-08-16",
"type": "Date",
"name": "date",
"hidden": false
},
{
"targetEtalonId": null,
"valueId": "",
"unitId": "",
"displayValue": null,
"value": true,
"type": "Boolean",
"name": "is_active",
"hidden": false
},
{
"targetEtalonId": null,
"valueId": "",
"unitId": "",
"displayValue": null,
"value": 123,
"type": "Integer",
"name": "quantity",
"hidden": false
},
{
"targetEtalonId": null,
"valueId": "",
"unitId": "",
"displayValue": null,
"value": 456.78,
"type": "Number",
"name": "rate",
"hidden": false
}
],
"complexAttributes": [],
"arrayAttributes": [],
"codeAttributes": [ //Code attributes
{ //Code attribute "article_number" type String
"value": "art123", //Attribute value
"type": "String", //Тип "String"
"name": "article_number", //System attribute name
"hidden": false
}
]
}
}
}
}
Response
{
"details": {
"info": [],
"warning": [],
"error": []
},
"payload": {
"org.unidata.mdm.rest.v2.matching.data": null,
"org.unidata.mdm.rest.v2.data": {
"details": {
"info": [],
"warning": [],
"error": []
},
"recordKeys": {
"etalonKey": {
"id": "32e70bd8-3c40-11ee-bc14-393b8ca6fb76",
"status": "ACTIVE"
},
"originKeys": [
{
"externalId": {
"externalId": "0e460f30-3c40-11ee-9ad3-6df0a9cf14b3",
"sourceSystem": "universe"
},
"enrichment": false,
"revision": 0,
"status": "ACTIVE",
"createDate": null,
"updateDate": null,
"createdBy": null,
"updatedBy": null
}
],
"entityName": "lookup_test",
"lsn": {
"lsn": null,
"shard": 0
},
"node": 0,
"createDate": "2023-08-16T14:21:32.459Z",
"updateDate": "2023-08-16T14:21:32.459Z",
"createdBy": "admin",
"updatedBy": "admin",
"active": true,
"published": false,
"parent": null,
"children": []
},
"etalon": {
"simpleAttributes": [
{
"name": "name",
"type": "String",
"displayValue": null,
"targetEtalonId": null,
"valueId": null,
"unitId": null,
"value": "Some kind of name"
},
{
"name": "date",
"type": "Date",
"displayValue": null,
"targetEtalonId": null,
"valueId": null,
"unitId": null,
"value": "2023-08-16"
},
{
"name": "is_active",
"type": "Boolean",
"displayValue": null,
"targetEtalonId": null,
"valueId": null,
"unitId": null,
"value": true
},
{
"name": "quantity",
"type": "Integer",
"displayValue": null,
"targetEtalonId": null,
"valueId": null,
"unitId": null,
"value": 123
},
{
"name": "rate",
"type": "Number",
"displayValue": null,
"targetEtalonId": null,
"valueId": null,
"unitId": null,
"value": 456.78
}
],
"arrayAttributes": [],
"complexAttributes": [],
"codeAttributes": [
{
"name": "article_number",
"type": "String",
"value": "art123",
"supplementary": []
}
],
"etalonId": "32e70bd8-3c40-11ee-bc14-393b8ca6fb76",
"modified": false,
"version": 0,
"entityName": "lookup_test",
"namespace": "lookup",
"validFrom": "1900-01-01T00:00:00Z",
"validTo": "2500-12-31T23:59:59.999Z",
"status": "ACTIVE",
"lsn": null,
"createDate": "2023-08-16T14:21:32.459Z",
"createdBy": "admin",
"updateDate": "2023-08-16T14:21:32.459Z",
"updatedBy": "admin",
"rights": null,
"operationType": "DIRECT",
"diffToDraft": null,
"published": false
},
"relationsResult": {
"details": {
"info": [],
"warning": [],
"error": []
},
"etalonId": null,
"etalonRelations": null
}
},
"org.unidata.mdm.rest.v2.dq.data": null
}
}
Publishing a draft of a new directory entry¶
POST
/api/v2/draft/publish
Request body
{
"draftId": 5,
"force": false,
"delete": true
}
Response
{
"details": {
"info": [],
"warning": [],
"error": []
},
"draft": {
"type": "record",
"subjectId": "32e70bd8-3c40-11ee-bc14-393b8ca6fb76",
"description": "Draft from 16.08.2023 17:20:30",
"owner": "admin",
"ownerFullName": "Admin Root",
"createdBy": "admin",
"updatedBy": "admin",
"draftId": 5,
"parentDraftId": null,
"editionsCount": 1,
"createDate": "2023-08-16T14:20:30.862543Z",
"updateDate": "2023-08-16T14:21:32.45892Z",
"tags": [
"entity-name:lookup_test",
"record-external-id:0e460f30-3c40-11ee-9ad3-6df0a9cf14b3\u001flookup_test\u001funiverse",
"operation-code:UPSERT_DATA",
"namespace:lookup"
],
"state": "PUBLISHED"
}
}
Changing a directory entry¶
Getting a directory entry by etalonId¶
POST
/api/v2/data/atomic/get
Request body
{
"payload": {
"org.unidata.mdm.rest.v2.data": {
"etalonId": "32e70bd8-3c40-11ee-bc14-393b8ca6fb76",
"entityName": "lookup_test",
"draftId": 0, //0 - published record or draft record ID
"timelineDate": "1900-01-01T00:00:00.000Z"
}
}
}
Response
{
"details": {
"info": [],
"warning": [],
"error": []
},
"payload": {
"org.unidata.mdm.rest.v2.matching.data": {
"results": []
},
"org.unidata.mdm.rest.v2.data": {
"details": {
"info": [],
"warning": [],
"error": []
},
"recordKeys": {
"etalonKey": {
"id": "32e70bd8-3c40-11ee-bc14-393b8ca6fb76",
"status": "ACTIVE"
},
"originKeys": [
{
"externalId": {
"externalId": "0e460f30-3c40-11ee-9ad3-6df0a9cf14b3",
"sourceSystem": "universe"
},
"enrichment": false,
"revision": 1,
"status": "ACTIVE",
"createDate": "2023-08-16T14:21:32.461Z",
"updateDate": null,
"createdBy": "admin",
"updatedBy": null
}
],
"entityName": "lookup_test",
"lsn": {
"lsn": 1,
"shard": 0
},
"node": 0,
"createDate": "2023-08-16T14:21:32.461Z",
"updateDate": "2023-08-16T14:21:32.462Z",
"createdBy": "admin",
"updatedBy": "admin",
"active": true,
"published": true,
"parent": null,
"children": []
},
"etalon": {
"simpleAttributes": [
{
"name": "name",
"type": "String",
"displayValue": null,
"targetEtalonId": null,
"valueId": null,
"unitId": null,
"value": "Some kind of name"
},
{
"name": "date",
"type": "Date",
"displayValue": null,
"targetEtalonId": null,
"valueId": null,
"unitId": null,
"value": "2023-08-16"
},
{
"name": "is_active",
"type": "Boolean",
"displayValue": null,
"targetEtalonId": null,
"valueId": null,
"unitId": null,
"value": true
},
{
"name": "quantity",
"type": "Integer",
"displayValue": null,
"targetEtalonId": null,
"valueId": null,
"unitId": null,
"value": 123
},
{
"name": "rate",
"type": "Number",
"displayValue": null,
"targetEtalonId": null,
"valueId": null,
"unitId": null,
"value": 456.78
}
],
"arrayAttributes": [],
"complexAttributes": [],
"codeAttributes": [
{
"name": "article_number",
"type": "String",
"value": "art123",
"supplementary": []
}
],
"etalonId": "32e70bd8-3c40-11ee-bc14-393b8ca6fb76",
"modified": false,
"version": 0,
"entityName": "lookup_test",
"namespace": "lookup",
"validFrom": "1900-01-01T00:00:00Z",
"validTo": "2500-12-31T23:59:59.999Z",
"status": "ACTIVE",
"lsn": {
"lsn": 1,
"shard": 0
},
"createDate": "2023-08-16T14:21:32.461Z",
"createdBy": "admin",
"updateDate": "2023-08-16T14:21:32.462Z",
"updatedBy": "admin",
"rights": null,
"operationType": "DIRECT",
"diffToDraft": null,
"published": true
},
"origins": null,
"vistory": null
},
"org.unidata.mdm.rest.v2.dq.data": {
"results": []
}
}
}
Creating a draft of a directory entry to change¶
POST
/api/v2/draft/upsert
Request body
{
"type": "record",
"subjectId": "32e70bd8-3c40-11ee-bc14-393b8ca6fb76",
"description": "Draft from 16.08.2023 17:29:00",
"tags": [
"entity-name:lookup_test",
"namespace:lookup"
],
"parameters": {
"entity-name": "lookup_test"
}
}
Response
{
"details": {
"info": [],
"warning": [],
"error": []
},
"draft": {
"type": "record",
"subjectId": "32e70bd8-3c40-11ee-bc14-393b8ca6fb76",
"description": "Draft from 16.08.2023 17:29:00",
"owner": "admin",
"ownerFullName": "Admin Root",
"createdBy": "admin",
"updatedBy": null,
"draftId": 6,
"parentDraftId": null,
"editionsCount": 0,
"createDate": "2023-08-16T14:29:00.012Z",
"updateDate": null,
"tags": [
"entity-name:lookup_test",
"namespace:lookup"
],
"state": "CREATED"
}
}
Saving a modified directory entry in a draft¶
The code attribute cannot be changed
If you set draftId=0, the entry will be published immediately without a draft
This is an insertion of a record, so in order not to change the attribute value and not to clear it, you need to insert their values from the existing version
A record change is a complete rewrite of the record by etalonId or a combination of externalId and source system from this request Saving a new entry to a draft
For comments on the fields, see Saving a new entry to a draft
POST
/api/v2/data/atomic
Request body
{
"payload": {
"org.unidata.mdm.rest.v2.data": {
"draftId": 6,
"dataRecord": {
"etalonId": "32e70bd8-3c40-11ee-bc14-393b8ca6fb76",
"displayName": "",
"entityName": "lookup_test",
"namespace": "lookup",
"version": "0",
"modified": false,
"validFrom": "1900-01-01T00:00:00.000Z",
"validTo": "2500-12-31T23:59:59.999Z",
"createDate": "2023-08-16T14:21:32.461Z",
"updateDate": "2023-08-16T14:21:32.462Z",
"status": "ACTIVE",
"simpleAttributes": [
{
"targetEtalonId": null,
"valueId": "",
"unitId": "",
"displayValue": null,
"value": "Some new name",
"type": "String",
"name": "name",
"hidden": false
},
{
"targetEtalonId": null,
"valueId": "",
"unitId": "",
"displayValue": null,
"value": "2023-08-17",
"type": "Date",
"name": "date",
"hidden": false
},
{
"targetEtalonId": null,
"valueId": "",
"unitId": "",
"displayValue": null,
"value": false,
"type": "Boolean",
"name": "is_active",
"hidden": false
},
{
"targetEtalonId": null,
"valueId": "",
"unitId": "",
"displayValue": null,
"value": 987,
"type": "Integer",
"name": "quantity",
"hidden": false
},
{
"targetEtalonId": null,
"valueId": "",
"unitId": "",
"displayValue": null,
"value": 123.45,
"type": "Number",
"name": "rate",
"hidden": false
}
],
"complexAttributes": [],
"arrayAttributes": [],
"codeAttributes": [
{
"value": "art123",
"supplementary": [],
"type": "String",
"name": "article_number",
"hidden": false
}
]
}
}
}
}
Response
{
"details": {
"info": [],
"warning": [],
"error": []
},
"payload": {
"org.unidata.mdm.rest.v2.matching.data": null,
"org.unidata.mdm.rest.v2.data": {
"details": {
"info": [],
"warning": [],
"error": []
},
"recordKeys": {
"etalonKey": {
"id": "32e70bd8-3c40-11ee-bc14-393b8ca6fb76",
"status": "ACTIVE"
},
"originKeys": [
{
"externalId": {
"externalId": "0e460f30-3c40-11ee-9ad3-6df0a9cf14b3",
"sourceSystem": "universe"
},
"enrichment": false,
"revision": 1,
"status": "ACTIVE",
"createDate": "2023-08-16T14:21:32.461Z",
"updateDate": null,
"createdBy": "admin",
"updatedBy": null
}
],
"entityName": "lookup_test",
"lsn": {
"lsn": 1,
"shard": 0
},
"node": 0,
"createDate": "2023-08-16T14:21:32.461Z",
"updateDate": "2023-08-16T14:31:27.344Z",
"createdBy": "admin",
"updatedBy": "admin",
"active": true,
"published": true,
"parent": null,
"children": []
},
"etalon": {
"simpleAttributes": [
{
"name": "name",
"type": "String",
"displayValue": null,
"targetEtalonId": null,
"valueId": null,
"unitId": null,
"value": "Some new name"
},
{
"name": "date",
"type": "Date",
"displayValue": null,
"targetEtalonId": null,
"valueId": null,
"unitId": null,
"value": "2023-08-17"
},
{
"name": "is_active",
"type": "Boolean",
"displayValue": null,
"targetEtalonId": null,
"valueId": null,
"unitId": null,
"value": false
},
{
"name": "quantity",
"type": "Integer",
"displayValue": null,
"targetEtalonId": null,
"valueId": null,
"unitId": null,
"value": 987
},
{
"name": "rate",
"type": "Number",
"displayValue": null,
"targetEtalonId": null,
"valueId": null,
"unitId": null,
"value": 123.45
}
],
"arrayAttributes": [],
"complexAttributes": [],
"codeAttributes": [
{
"name": "article_number",
"type": "String",
"value": "art123",
"supplementary": []
}
],
"etalonId": "32e70bd8-3c40-11ee-bc14-393b8ca6fb76",
"modified": false,
"version": 0,
"entityName": "lookup_test",
"namespace": "lookup",
"validFrom": "1900-01-01T00:00:00Z",
"validTo": "2500-12-31T23:59:59.999Z",
"status": "ACTIVE",
"lsn": {
"lsn": 1,
"shard": 0
},
"createDate": "2023-08-16T14:21:32.461Z",
"createdBy": "admin",
"updateDate": "2023-08-16T14:31:27.344Z",
"updatedBy": "admin",
"rights": null,
"operationType": "DIRECT",
"diffToDraft": null,
"published": true
},
"relationsResult": {
"details": {
"info": [],
"warning": [],
"error": []
},
"etalonId": null,
"etalonRelations": null
}
},
"org.unidata.mdm.rest.v2.dq.data": null
}
}
Publishing a draft of the modified directory entry¶
POST
/api/v2/draft/publish
Request body
{
"draftId": 6,
"force": false,
"delete": true
}
Response
{
"details": {
"info": [],
"warning": [],
"error": []
},
"draft": {
"type": "record",
"subjectId": "32e70bd8-3c40-11ee-bc14-393b8ca6fb76",
"description": "Draft fromDraft from 16.08.2023 17:29:00",
"owner": "admin",
"ownerFullName": "Admin Root",
"createdBy": "admin",
"updatedBy": "admin",
"draftId": 6,
"parentDraftId": null,
"editionsCount": 1,
"createDate": "2023-08-16T14:29:00.01399Z",
"updateDate": "2023-08-16T14:31:27.344691Z",
"tags": [
"entity-name:lookup_test",
"record-external-id:0e460f30-3c40-11ee-9ad3-6df0a9cf14b3\u001flookup_test\u001funiverse",
"operation-code:UPSERT_DATA",
"namespace:lookup"
],
"state": "PUBLISHED"
}
}
Deleting a directory entry¶
DELETE
/api/v2/data/records/delete/lookup_test/32e70bd8-3c40-11ee-bc14-393b8ca6fb76?wipe=false&inactivateEtalon=true
The request above for the logical deletion of the record with the deactivation of the reference is the default behavior
lookup_test
- the system name of the registry from which we are deleting32e70bd8-3c40-11ee-bc14-393b8ca6fb76
- etalonId of the record being deletedwipe
-false
- logical deletion, can be restored,true
- physical removalinactivateEtalon
- deactivating the record reference
Returns the version of the record before deleting
Response
{
"details": {
"info": [],
"warning": [],
"error": []
},
"recordKeys": {
"etalonKey": {
"id": "32e70bd8-3c40-11ee-bc14-393b8ca6fb76",
"status": "ACTIVE"
},
"originKeys": [
{
"externalId": {
"externalId": "0e460f30-3c40-11ee-9ad3-6df0a9cf14b3",
"sourceSystem": "universe"
},
"enrichment": false,
"revision": 2,
"status": "ACTIVE",
"createDate": "2023-08-16T14:21:32.461Z",
"updateDate": null,
"createdBy": "admin",
"updatedBy": null
}
],
"entityName": "lookup_test",
"lsn": {
"lsn": 1,
"shard": 0
},
"node": 0,
"createDate": "2023-08-16T14:21:32.461Z",
"updateDate": "2023-08-16T14:31:27.347Z",
"createdBy": "admin",
"updatedBy": "admin",
"active": true,
"published": true,
"parent": null,
"children": []
},
"key": "32e70bd8-3c40-11ee-bc14-393b8ca6fb76"
}
Creating and deleting entries without a draft¶
The request body specifies draftId = 0
Deleting a draft¶
POST
/api/v2/draft/remove
Request body
{
"type": "record",
"entityId": "",
"draftId": 8
}
Response
{
"details": {
"info": [],
"warning": [],
"error": []
},
"success": true
}
Getting Record periods¶
GET
/api/v2/data/records/lookup_test/timeline/32e70bd8-3c40-11ee-bc14-393b8ca6fb76?draftId=6
lookup_test
- system name of the registry/directory32e70bd8-3c40-11ee-bc14-393b8ca6fb76
- etalon RecordIddraftId
- The ID of the draft record or 0 to get published version
Response
{
"timeline": {
"etalonId": "32e70bd8-3c40-11ee-bc14-393b8ca6fb76",
"timeline": [
{
"dateFrom": "1900-01-01T00:00:00Z",
"dateTo": "2500-12-31T23:59:59.999Z",
"active": true,
"contributors": [
{
"originId": "7c1d91cb-3c40-11ee-bc14-393b8ca6fb76",
"version": 0,
"sourceSystem": "universe",
"status": "ACTIVE",
"owner": "lookup_test"
}
]
}
]
}
}