Skip to main content Skip to complementary content
Close announcements banner

Create or update records in batch mode

Creates or updates multiple data records pertaining to one or several entities in a data container in batch mode. The records will be provided in the request content as XML or JSON.

Information noteNote: Your submitted ID will be used to create the record even if the ID is set to be auto-generated in the data model. An update operation will be performed if a record with the same ID already exists in MDM.

You can also perform partial update of many records that pertain to one entity in one single bulk operation through the REST API. For more information, see How to perform mass partial update on MDM data records through the REST API.

Request
POST /services/rest/data/{containerName}/batch

The body is an XML or JSON representation of one or more records to be created or updated. The records in XML representation must be enclosed by a root tag with an arbitrary name, such as records. Each record contains:

  • one or more primary key fields with values, which are mandatory because they will be used to specify the record you want to create or update. If the record does not exist in the data container, it will be created. If the record already exists in the data container, it will be updated accordingly.
  • other fields defined for the specified entity, in which the mandatory fields must have values.
Parameters
  • containerName: This is a String value which specifies the name of the data container in which you want to create or update multiple data records.
  • container: This is a String value which represents the type of the data container. It is either MASTER (default) or STAGING.
  • updateReport: This is a Boolean value which controls whether to generate a journal entry (update report). By default, it is false.
  • beforeSaving: This is a Boolean value which controls whether to invoke a Before Saving process. By default, it is false. If the beforeSaving parameter is set to true, the updateReport parameter must also be set to true, since a journal entry (update report) needs to be generated to invoke the Before Saving process.
Headers
  • Content-Type: application/xml or text/xml or application/json
    Information noteNote: If the XML declaration is included in the XML request content and the encoding attribute is used, you must set its value to UTF-8.
  • Authorization: Basic Authentication scheme
Response No content.
Status
  • 200 OK: The operation is executed successfully.
  • 400 BAD REQUEST: The request contains invalid parameter, for example, invalid storage name, invalid storage type, or wrong XML document.
  • 401 UNAUTHORIZED: Login fails, invalid username or password.
  • 403 FORBIDDEN: Missing required permission, for example, no required WRITE permission.
  • 404 NOT FOUND: The resource does not exist, for example, invalid service URL.
  • 500 INTERNAL SERVER ERROR: Other errors, for example, the Before Saving process returns error.
Limitation This REST API does not support creating or updating multiple records in batch mode for the Role entity in the PROVISIONING system data container.

Sample request in XML format

<records>
    <Store>
        <Id>100001</Id>
        <Address>Beijing APM</Address>
    </Store>
    <Store>
        <Id>100002</Id>
        <Address>Beijing Department Store</Address>
    </Store>
    <Product>
        <Picture>/imageserver/upload/TalendShop/dog.jpg</Picture>
        <Id>231035933</Id>
        <Name>Talend Dog T-Shirt</Name>
        <Description>Doggie t-shirt from American Apparel</Description>
        <Features>
            <Sizes>
                <Size>Small</Size>
                <Size>Medium</Size>
                <Size>Large</Size>
                <Size>X-Large</Size>
            </Sizes>
            <Colors>
                <Color>White</Color>
            </Colors>
        </Features>
        <Availability>false</Availability>
        <Price>16.99</Price>
        <Family>[3]</Family>
        <OnlineStore>Talend Shop@@http://www.cafepress.com/Talend.231035933</OnlineStore>
        <Stores>
            <Store>100001</Store>
            <Store>100002</Store>
        </Stores>
    </Product>
</records>

Sample request in JSON format

[
    {
        "Store": {
            "Id": "100001",
            "Address": "Beijing APM"
        }
    },
    {
        "Store": {
            "Id": "100002",
            "Address": "Beijing Department Store"
        }
    },
    {
        "Product": {
            "Picture": "/imageserver/upload/TalendShop/dog.jpg",
            "Id": "231035933",
            "Name": "Talend Dog T-Shirt",
            "Description": "Doggie t-shirt from American Apparel",
            "Features": {
                "Sizes": {
                    "Size": [
                        "Small",
                        "Medium",
                        "Large",
                        "X-Large"
                    ]
                },
                "Colors": {"Color": "White"}
            },
            "Availability": "false",
            "Price": "16.99",
            "Family": "[3]",
            "OnlineStore": "Talend Shop@@http://www.cafepress.com/Talend.231035933",
            "Stores": {
                "Store": [
                    "100001",
                    "100002"
                ]
            }
        }
    }
]

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!