Adding Data

Adding Data

Adds Data to Blocworx

POST https://example.mydomain.com/api/add-data

Request Body

Name
Type
Description

scanStationID*

integer

The ID of the bloc you want to add data to. This is the last number in the URL of the bloc, in this example it is 1234: https://example.mydomain.com/module/module-name/bloc/1234

jobID

integer

The ID of the module

dataToAdd

object

A json object of data to add

{"returnedStationID":123456}
<?php

$url = "https://subdomain.blocworx.com/api/add-data";
$token = "[AUTHTOKEN]";

$postFields = [
    'scanStationID' => '7603',
    'jobID' => '1304',
    'dataToAdd' => '{"field_1":"Test","another_one":"test","last_one":"testing 12"}',
];

$ch = curl_init($url);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    "Content-Type: multipart/form-data",
    "Authorization: Bearer {$token}"
]);

$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error: ' . curl_error($ch);
} else {
    echo 'Response: ' . $response;
}

curl_close($ch);

Last updated