Using SDK
Connect using DataBrew SDK
Describes how to connect to a pipeline using DataBrew SDK to receive data
In order to connect to DataBrew’s streaming pipeline using the SDK, you need to follow the steps below:
1
First Step
Obtain the API key from the DataBrew platform. Go to https://app.databrew.tech/settings/api-keys and create a new API Key
2
Second Step
Find your pipeline public ID from the DataBrew platform. Go to https://app.databrew.tech/pipelines and find the pipeline you want to connect to. Open the details and press the “Connect to stream” button. You will find the public ID there
3
Third Step
Use the following code snippet to connect to the pipeline using the SDK:
composer install usedatabrew/stream-sdk-php
<?php
require 'vendor/autoload.php';
use DataBrew\Sdk;
use DataBrew\Options;
$opts = new Options();
$opts->setApiKey("api-key");
$sdk = new Sdk($opts);
foreach ($sdk->subscribe("pipelineid")->responses() as $response) {
echo "Response external PK: " . $response->getExternalPk() . "\n";
}
Was this page helpful?