Blocworx API

Updating Data

Update Records by Matching Field Values

This endpoint updates one or more records in a bloc by matching exact field-value pairs.

POST https://example.mydomain.com/api/update-records-by-matching-values

Request Body

NameTypeDescription
blocId*stringThe ID of the bloc to update. This may be a UUID or numeric ID depending on your instance.
fieldsToUpdate*objectField slugs and the values to apply to matching records. Example: { "employee_name": "Jane Doe", "status": "Complete" }
searchItems*objectField slugs and exact values used to find records to update. Example: { "employee_id": "5830" }

Matching Behavior

  • Matching uses exact key/value equality
  • All matching records are updated
  • If no records match, the request still succeeds and returns an empty array of updated IDs

200 Success Response

Records Updated

{
  "updated_record_ids": [
    1223259
  ]
}

No Matching Records

{
  "updated_record_ids": []
}

Error Responses

400 Bad Request

Returned when required request fields are missing.

{
  "error": "Search Key/Value pairs or Bloc ID or Search Fields to update have not been provided"
}

Additional validation failures may return a message field instead of error, depending on the failure path.

401 Unauthorized

{
  "message": "You are not authorized to access this bloc"
}

Example Requests

cURL

curl --request POST 'https://example.mydomain.com/api/update-records-by-matching-values' \
  --header 'Authorization: Bearer [AUTHTOKEN]' \
  --header 'Content-Type: application/json' \
  --data '{
    "blocId": "a1489634-4009-4cc0-8a65-9965f5a1bea7",
    "fieldsToUpdate": {
      "field_number_2": "Updated Value"
    },
    "searchItems": {
      "field_number_1": "Rafael"
    }
  }'

JavaScript

const settings = {
  url: 'https://example.mydomain.com/api/update-records-by-matching-values',
  method: 'POST',
  timeout: 0,
  headers: {
    Authorization: 'Bearer [AUTHTOKEN]',
    'Content-Type': 'application/json'
  },
  data: JSON.stringify({
    blocId: 'a1489634-4009-4cc0-8a65-9965f5a1bea7',
    fieldsToUpdate: {
      field_number_2: 'Updated Value'
    },
    searchItems: {
      field_number_1: 'Rafael'
    }
  })
};

$.ajax(settings).done(function (response) {
  console.log(response);
});

Node.js

const request = require('request');

const options = {
  method: 'POST',
  url: 'https://example.mydomain.com/api/update-records-by-matching-values',
  headers: {
    Authorization: 'Bearer [AUTHTOKEN]',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    blocId: 'a1489634-4009-4cc0-8a65-9965f5a1bea7',
    fieldsToUpdate: {
      field_number_2: 'Updated Value'
    },
    searchItems: {
      field_number_1: 'Rafael'
    }
  })
};

request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

Python

import requests

url = "https://example.mydomain.com/api/update-records-by-matching-values"

payload = {
    "blocId": "a1489634-4009-4cc0-8a65-9965f5a1bea7",
    "fieldsToUpdate": {
        "field_number_2": "Updated Value"
    },
    "searchItems": {
        "field_number_1": "Rafael"
    }
}

headers = {
    "Authorization": "Bearer [AUTHTOKEN]",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)
print(response.text)