Update a record partially - 7.3

MDM query language and REST data access

Version
7.3
Language
English
Product
Talend Data Fabric
Talend MDM Platform
Module
Talend MDM Server
Talend MDM Web UI
Content
Data Governance > Consolidating data
Data Governance > Retrieving data
Last publication date
2024-02-06
Updates a data record partially in the specified data container. The record will be provided in the request content as XML.
Request
PATCH /services/rest/data/{containerName}

The body is an XML representation of part of the record to be updated. The element Id in the request body determines which record is to be updated.

Parameters
  • containerName: This is a String value which specifies the name of the data container in which you want to update a data record partially.
  • 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 true.
  • pivot: This is a String value which represents the XPath to a multi-occurrence element where data needs to be added, replaced, or deleted in the item of interest.
  • overwrite: This is a Boolean value which controls whether to overwrite the existing list of values for a multi-occurrence element with the new one or just append new values to the existing list without deduplication. By default, it is true, which means the existing list of values will be replaced by the new one. Its value becomes invalid when the delete parameter value is set to true.
  • delete: This is a Boolean value which controls whether to remove the values that match the input values for a multi-occurrence element. By default, it is false.
  • key: This is a String value which represents the XPath relative to the pivot and helps identifying a complex type sub-element of the multi-occurence element defined by the pivot parameter. If this parameter is not specified, all sub-elements of the multi-occurence element with an XPath matching that of the sub-element of the source XML will be replaced. If more than one sub-element matches the key, the first one will be updated. If no sub-element matches the key, it will be added at the end.
  • position: This is an integer value which represents the position in which new values will be appended. If not specified, new values will be appended at the end.
Headers
  • Content-Type: application/xml or text/xml
    Note: 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, and the data record identified by the element Id is updated partially according to the provided input.
  • 400 BAD REQUEST: The request contains invalid parameter, for example, nonexistent storage name, wrong XML document, invalid storage type, or nonexistent record Id.
  • 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.
Limitation This REST API does not support updating a record partially for the Role entity in the PROVISIONING system data container.

Sample requests

Suppose there is a record like below in an entity Family:

<Family>
    <Id>1</Id>
    <Name>Lee</Name>
    <Kids>
        <Kid>
            <Name>David</Name>
            <Age>10</Age>
            <Habits>
                <Habit>Basketball</Habit>
                <Habit>Tennis</Habit>
            </Habits>
        </Kid>
        <Kid>
            <Name>James</Name>
            <Age>8</Age>
        </Kid>
        <Kid>
            <Name>Kate</Name>
            <Age>6</Age>
        </Kid>
    </Kids>
</Family>

With the delete value set to true, the pivot value set to Family/Kids/Kid, and the key value set to /Name, the following sample request will remove the multi-occurence element Kid identified by James:

<Person>
    <Id>1</Id>
    <Kids>
        <Kid>
            <Name>James</Name>
        </Kid>
    </Kids>
</Person>

With the overwrite value set to false, the delete value set to false, the pivot value set to Family/Kids/Kid[1]/Habits/Habit (Kid[1] indicates the first kid) , the key value not specified or set to ., and the position value set to 2, the following sample request will append two values to the multi-occurence element Habit after <Habit>Basketball</Habit> for the first kid:

<Person>
    <Id>1</Id>
    <Kids>
        <Kid>
            <Habits>
                <Habit>Football</Habit>
                <Habit>Table tennis</Habit>
            </Habits>
        </Kid>
    </Kids>
</Person>