Skip to content

Modify record data and/or metadata attributes using patch operations

Request

The API represents the patch update mechanism for records. It allows updating multiple records in one request. The API supports metadata update only (Legal Tags, ACLs and Tags) if the request body media type is application/json. The API supports metadata and data update (Legal Tags, ACLs, Tags, Ancestry, Kind, Meta and Data) if the request body media type is application/json-patch+json. Please choose the appropriate media type from the Request body dropdown. The currently supported operations are replace, add, and remove. Required roles: users.datalake.editors or users.datalake.admins.

Security
bearer
Headers
data-partition-idstringrequired

desired data partition id

Body
queryobjectrequired

A list of records' unique identifiers in whole Data Platform. It indicates which records need to be updated. Record ids should follow the naming convention:{data-partition-id}:{object-type}:{uuid}."

Example:
{ "ids": [ "slb-osdu-prod-des-prod-testing:work-product-component--WellLog:a6d6-63fc9a0bbac1" ] }
opsArray of objects(PatchOperation)required
Example:
[ { "op": "add", "path": "/acl/viewers", "value": [ … ] }, { "op": "replace", "path": "/legal/legaltags", "value": [ … ] }, { "op": "remove", "path": "/tags", "value": [ … ] } ]
curl -i -X PATCH \
  https://as5.api.enterprisedata.slb.com/api/storage/v2/records \
  -H 'Authorization: Bearer <YOUR_JWT_HERE>' \
  -H 'Content-Type: application/json' \
  -H 'data-partition-id: string' \
  -d '{
    "query": {
      "ids": [
        "slb-osdu-prod-des-prod-testing:work-product-component--WellLog:a6d6-63fc9a0bbac1"
      ]
    },
    "ops": [
      {
        "op": "add",
        "path": "/acl/viewers",
        "value": [
          "data.default.viewers@slb-osdu-prod-des-prod-testing.{domain}.com"
        ]
      },
      {
        "op": "replace",
        "path": "/legal/legaltags",
        "value": [
          "slb-osdu-prod-des-prod-testing-default-legal"
        ]
      },
      {
        "op": "remove",
        "path": "/tags",
        "value": [
          "dataflowId"
        ]
      }
    ]
  }'

Responses

Records metaData updated successfully. All records' metadata was updated.

Body
recordCountinteger, (int32)

Number of records updated successfully.

recordIdsArray of strings

List of updated record ids.

notFoundRecordIdsArray of strings
unauthorizedRecordIdsArray of strings

List of record ids that were not updated - user is not authorized.

lockedRecordIdsArray of strings

Records may be locked and not updated during metadata update, due to optimistic lock.

Response
{ "recordCount": 0, "recordIds": [ "string" ], "notFoundRecordIds": [ "string" ], "unauthorizedRecordIds": [ "string" ], "lockedRecordIds": [ "string" ] }