How to transfer entity including ACL objects to another PIM system

Hint

Setting the ACL flag via REST to an item does NOT execute the underlying logic like inheritance of ACL objects to sub objects.

An other limitation is at the moment: The set ACL id has to exist at the system.

Use case

This page will describe how to transfer objects with assigned object rights from one P360 system (source) to an other P360 system (target) using the Service API.

Item objects are used as example.

Flow

  1. Source system: Read the affected items via REST, if available the item brings its own ACL reference id

  2. Source system: Read the necessary ACL objects with the previous found reference ids

  3. Target system: Write the ACL objects

  4. Target system: Write items with new ACL reference ids

Detail REST calls

Used objects

Item no (source system)

Item no (target system)

ACL id (source system)

ACL id (target system)

Principal id (source and target system)

ACL flag (source and target system)

Catalog name (source system)

Catalog name (target system)

Find items with ACL reference

First we have to find the ACL ids used by each item:

Request - GET

GET - http://host:1512/rest/V1.0/list/Article/byCatalog?catalog= CatalogToTransfer &fields=Article.SupplierAID,Article.AclFlag,Article.AclProxy&metaData=true

Response

{
"cacheId": "20160802_104907_0",
"entityIdentifier": "Article",
"totalSize": 3,
"startIndex": 0,
"pageSize": 100,
"rowCount": 3,
"columnCount": 3,
"columns": [
{
"identifier": "Article.SupplierAID",
"dataType": "STRING",
"name": "Item no."
},
{
"identifier": "Article.AclFlag",
"dataType": "STRING",
"name": "Object right type"
},
{
"identifier": "Article.AclProxy",
"dataType": "ENTITY_ITEM",
"name": "Object rights"
}
],
"rows": [
{
"object": {
"id": "2120@1002",
"label": "itemToTransfer001",
"entityId": 1000
},
"values": [
" itemToTransfer001 ",
" Individual ",
{
"id": " 9 ",
"label": "Object rights 9",
"entityId": 4400
}
]
},
{
"object": {
"id": "2121@1002",
"label": "itemToTransfer002",
"entityId": 1000
},
"values": [
" itemToTransfer002 ",
" Individual ",
{
"id": " 10 ",
"label": "Object rights 10",
"entityId": 4400
}
]
},
{
"object": {
"id": "2122@1002",
"label": "itemToTransfer003",
"entityId": 1000
},
"values": [
" itemToTransfer003 ",
" Individual ",
{
"id": " 10 ",
"label": "Object rights 10",
"entityId": 4400
}
]
}
]
}

Find ACL objects by id

Now we load the ACL objects by the ACL id. Each ACL object has to be loaded with a separate request.

Request - GET

GET - http://host:1512/rest/V1.0/security/acl/ 9

Response

{
"id": 9 ,
"entries": [
{
"principal": {
"id": "' AllRights '",
"entityId": 2700
},
"fullPermission": true,
"deletePermission": true,
"writePermission": true,
"readPermission": true
},
{
"principal": {
"id": "' Heiler Product Manager '",
"entityId": 2800
},
"fullPermission": false,
"deletePermission": false,
"writePermission": true,
"readPermission": true
}
]
}

Load ACL object for id 10.

Request - GET

GET - http://host:1512/rest/V1.0/security/acl/ 10

Response

{
"id": 10 ,
"entries": [
{
"principal": {
"id": "' specialUser '",
"entityId": 2600
},
"fullPermission": true,
"deletePermission": true,
"writePermission": true,
"readPermission": true
},
{
"principal": {
"id": "' Heiler Product Manager '",
"entityId": 2800
},
"fullPermission": false,
"deletePermission": false,
"writePermission": false,
"readPermission": true
}
]
}

Create ACL object in target system

Be sure that the principal references of the ACL objects are set up correct. Each ACL object gets created by a separate request.

Request - POST

POST - http://host:1512/rest/V1.0/security/acl

POST Body

{
"entries": [
{
"principal": {
"id": "' AllRights '",
"entityId": 2700
},
"fullPermission": true,
"deletePermission": true,
"writePermission": true,
"readPermission": true
},
{
"principal": {
"id": "' Heiler Product Manager '",
"entityId": 2800
},
"fullPermission": false,
"deletePermission": false,
"writePermission": true,
"readPermission": true
}
]
}

Response

{
"id": 25 ,
"entries": [
{
"principal": {
"id": "' AllRights '",
"entityId": 2700
},
"fullPermission": true,
"deletePermission": true,
"writePermission": true,
"readPermission": true
},
{
"principal": {
"id": "' Heiler Product Manager '",
"entityId": 2800
},
"fullPermission": false,
"deletePermission": false,
"writePermission": true,
"readPermission": true
}
]
}

Create 2nd ACL object (source system id 10 ).

Request - POST

POST - http://host:1512/rest/V1.0/security/acl

POST Body

{
"entries": [
{
"principal": {
"id": "' specialUser '",
"entityId": 2600
},
"fullPermission": true,
"deletePermission": true,
"writePermission": true,
"readPermission": true
},
{
"principal": {
"id": "' Heiler Product Manager '",
"entityId": 2800
},
"fullPermission": false,
"deletePermission": false,
"writePermission": false,
"readPermission": true
}
]
}

Response

{
"id": 26 ,
"entries": [
{
"principal": {
"id": "' specialUser '",
"entityId": 2600
},
"fullPermission": true,
"deletePermission": true,
"writePermission": true,
"readPermission": true
},
{
"principal": {
"id": "' Heiler Product Manager '",
"entityId": 2800
},
"fullPermission": false,
"deletePermission": false,
"writePermission": false,
"readPermission": true
}
]
}

Create items in target system with references to created ACL objects

In that sample call only the items with the corresponding ACL references are created. Of course it is also possible to create the items first and update the items with a 2nd REST call to set the ACL references.

Please note: The reference has to be done with the ACL object id generated by the target system. In our sample the ACL objects are related to each other like follows:

ACL id source system

ACL id target system

9

25

10

26

Request - POST

POST - http://host:1512/rest/ V1.0/list/Article

POST Body

{
"columns": [
{
"identifier": "Article.AclFlag"
},
{
"identifier": "Article.AclProxy"
}
],
"rows": [
{
"object": {
"id": "' itemToTransfer001 '@' CatalogToTransfer '"
},
"values": [
" Individual ",
" 25 "
]
},
{
"object": {
"id": "' itemToTransfer002 '@' CatalogToTransfer '"
},
"values": [
" Individual ",
" 26 "
]
},
{
"object": {
"id": "' itemToTransfer003 '@' CatalogToTransfer '"
},
"values": [
" Individual ",
" 26 "
]
}
]
}

Response

{
"counters": {
"errors": 0,
"warnings": 0,
"createdObjects": 3,
"updatedObjects": 0,
"objectsWithErrors": 0,
"objectsWithWarnings": 0
},
"entries": [],
"objects": [
{
"row": 0,
"object": {
"id": "2145@1009",
"label": " itemToTransfer001 ",
"entityId": 1000
},
"status": [
"CREATED"
]
},
{
"row": 1,
"object": {
"id": "2146@1009",
"label": " itemToTransfer002 ",
"entityId": 1000
},
"status": [
"CREATED"
]
},
{
"row": 2,
"object": {
"id": "2147@1009",
"label": " itemToTransfer003 ",
"entityId": 1000
},
"status": [
"CREATED"
]
}
]
}

More example for assignment of entity with new ACL reference ids in target system

Assrotment

ArticleAssortment is used as example:

images/download/attachments/487621015/ArticleAssortmentACL.JPG

Request - POST

POST - http://host:1512/rest/ V1.0/list/ArticleAssortment

POST Body

{
"columns": [
{
"identifier": "ArticleAssortment.AclFlag"
},
{
"identifier": "ArticleAssortment.AclProxy"
}
],
"rows": [
{
"object": {
"id": "' ArticleAssortment1 '@' ACL '"
},
"values": [
" Individual ",
" 29 "
]
}
]
}

Response

{

"counters": {

"errors": 0,

"warnings": 0,

"createdObjects": 0,

"updatedObjects": 1,

"objectsWithErrors": 0,

"objectsWithWarnings": 0

},

"entries": [],

"objects": [

{

"row": 0,

"object": {

"id": "4",

"label": "assortmentName1",

"entityId": 2100

},

"status": [

"UPDATED"

]

}

]

}

Export template

Get id-name map for all export temlates

We need a trick to get all id-name mapping for export template, because no identifier field is defined for the Entity "ExportTemplate" in standard Product 360, which is but meaningful for REST call.

Set the entity ExportTemplate to support the service API in Repository

images/download/attachments/487621015/Repo_ExportTemplate_SupportRest.JPG

Call following REST to get id-name map:

Response

{

"cacheId": "20161114_173525_0",

"entityIdentifier": "ExportTemplate",

"totalSize": 3,

"startIndex": 0,

"pageSize": 100,

"rowCount": 3,

"columnCount": 0,

"columns": [],

"rows": [

{

"object": {

"id": " 2 ",

"label": " Supplier export template ",

"entityId": 3800

},

"values": []

},

{

"object": {

"id": " 9 ",

"label": " exportWithMediaPortal_EN ",

"entityId": 3800

},

"values": []

},

{

"object": {

"id": " 10 ",

"label": " ExportTemp1 ",

"entityId": 3800

},

"values": []

}

]

}

Assign ACL to desired export template

Then you can assign ACL to ExportTemplate like other root entities:

Request - POST

POST - http://host:1512/rest/ V1.0/list/ExportTemplate

POST Body

{
"columns": [
{
"identifier": "ExportTemplate.AclFlag"
},
{
"identifier": "ExportTemplate.AclProxy"
}
],
"rows": [
{
"object": {
"id": " 10 "
},
"values": [
" Individual ",
" 25 "
]
}
]
}

Response

{

"counters": {

"errors": 0,

"warnings": 0,

"createdObjects": 0,

"updatedObjects": 1,

"objectsWithErrors": 0,

"objectsWithWarnings": 0

},

"entries": [],

"objects": [

{

"row": 0,

"object": {

"id": " 10 ",

"label": " ExportTemp1 ",

"entityId": 3800

},

"status": [

"UPDATED"

]

}

]

}