Quick Start
Instance and Token
To continue with our quick start, you will have to have a Blocworx instance made available to you and a user with an authorization token created. Please contact us for assistance on getting this set up.
Simple Request to Get Data from a Bloc
In the below examples we will use example.mydomain.com as the domain your Blocworx instance is hosted on, and [AUTHTOKEN] will represent the token that will be provided to you. The Bloc ID in this example will be 1234.
In this request we will be simply getting data from a bloc without filters or any more criteria. For more advanced Get Data API endpoints check out our Get Data API Reference.
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://example.mydomain.com/api/get-data',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_POSTFIELDS =>'{
    "blocId": 1234
}',
  CURLOPT_HTTPHEADER => array(
    'Authorization: Bearer [AUTHTOKEN]',
    'Content-Type: application/json'
  ),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;var settings = {
  "url": "https://example.mydomain.com/api/get-data",
  "method": "GET",
  "timeout": 0,
  "headers": {
    "Authorization": "Bearer [AUTHTOKEN]",
    "Content-Type": "application/json"
  },
  "data": JSON.stringify({
    "blocId": 1234
  }),
};
$.ajax(settings).done(function (response) {
  console.log(response);
});
var https = require('follow-redirects').https;
var fs = require('fs');
var options = {
  'method': 'GET',
  'hostname': 'example.mydomain.com',
  'path': '/api/get-data',
  'headers': {
    'Authorization': 'Bearer [AUTHTOKEN]',
    'Content-Type': 'application/json'
  },
  'maxRedirects': 20
};
var req = https.request(options, function (res) {
  var chunks = [];
  res.on("data", function (chunk) {
    chunks.push(chunk);
  });
  res.on("end", function (chunk) {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
  res.on("error", function (error) {
    console.error(error);
  });
});
var postData = JSON.stringify({
  "blocId": 1234
});
req.write(postData);
req.end();import requests
import json
url = "https://example.mydomain.com/api/get-data"
payload = json.dumps({
  "blocId": 1234
})
headers = {
  'Authorization': 'Bearer [AUTHTOKEN]',
  'Content-Type': 'application/json'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)Last updated