REST API Tutorial - List Write for Root Entities

The input of list write and the output of list read uses the same structure. You can perform the list read, modify some values and write them back.

Update

The HTTP method POST instead of GET is used, the body contains the data to be written. The data in the body has the same structure as a read result, but only the values of columns, formatData, includeObjectsInProtocol and rows are relevant.

The fields have to be specified in the columns section.

Example

The short description and attribute value is updated, new values are Update short English A001 resp. light blue for A001 and red as attribute value for A002. The value of the short description of A002 remains unchanged by setting the value to null.

The example uses the external identifier instead of the internal id as the internal ID is different on each system and cannot be used for copy and paste example.

External identifier are written in single quotes: 'A001'@'RestTutorial' instead of somethink like 39861@11639 (see also entry ENTITY_ITEM in REST Datatypes ).

POST http://localhost:1501/rest/V1.0/list/Article

Message body
{
"columns": [
{
"identifier": "ArticleLang.DescriptionShort(English)"
},
{
"identifier": "ArticleAttributeValue.Value(\"Front Color\",English,DEFAULT)"
}
],
"rows": [
{
"object": {
"id": "'A001'@'RestTutorial'"
},
"values": [
"Updated Short English A001",
"light blue"
]
},
{
"object": {
"id": "'A002'@'RestTutorial'"
},
"values": [
null,
"red"
]
}
]
}


A protocol is returned containing created resp. updated items and errors resp. warnings.

If the object part of the protocol is not required, set includeObjectsInProtocol to false. This improves performance significantly.

Example with error

Errors are reported in the returned protocol. This example sets the attribute Length to unknown for item A001 which is not a valid decimal value.

Message body
{
"columns": [
{
"identifier": "ArticleAttributeValue.Value(Length,\"Language independent\",DEFAULT)"
}
],
"rows": [
{
"object": {
"id": "'A001'@'RestTutorial'"
},
"values": [
"unknown"
]
},
{
"object": {
"id": "'A002'@'RestTutorial'"
},
"values": [
"23"
]
}
]
}

Create

The request is the same POST request as for update, but the object entry has to use the external identifier instead of the internal id.

So if you want to create an item with the external identifier (Supplier AID) A001 in the master catalog, you have to write it as 'A001'@1 or 'A001'@'MASTER'.

See also entry ENTITY_ITEM in REST Datatypes.

Example

A new item is created with four fields.

POST http://localhost:1501/rest/V1.0/list/Article

Message Body
{
"columns": [
{
"identifier": "ArticleLang.DescriptionShort(English)"
},
{
"identifier": "ArticleAttributeValue.Value(\"Front color\",English,DEFAULT)"
}
],
"rows": [
{
"object": {
"id": "'A003'@'RestTutorial'"
},
"values": [
"Created Short English A003",
"green"
]
}
]
}