diff --git a/README.md b/README.md index 48d8f24..6c15b05 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,7 @@ use Databox\Api\DefaultApi; use Databox\ApiException; use Databox\Configuration; use Databox\Model\PushData as DataboxPushData; +use Databox\Model\PushDataAttribute; use GuzzleHttp\Client; execute(); @@ -79,8 +80,19 @@ function execute() ->setKey('') // for e.g. sessions ->setValue(125) ->setDate('2017-01-01T00:00:00Z') // Date in ISO8601 format - ->setUnit('') // for e.g. $ - ->setAttributes(['']); // for e.g. ['US'] + ->setUnit(''); // for e.g. $ + + // Optional + if (true) { // If you want to push data to a specific dimension + $pushDataAttribute = new PushDataAttribute( + [ + 'key' => '', // for e.g. country + 'value' => '' // for e.g. US + ] + ); + + $pushData->setAttributes([$pushDataAttribute]); + } try { $apiInstance->dataPost([$pushData]); diff --git a/src/examples/pushData/PushData.php b/src/examples/pushData/PushData.php index 89249a9..bf6cb89 100644 --- a/src/examples/pushData/PushData.php +++ b/src/examples/pushData/PushData.php @@ -6,6 +6,7 @@ use Databox\ApiException; use Databox\Configuration; use Databox\Model\PushData as DataboxPushData; +use Databox\Model\PushDataAttribute; use GuzzleHttp\Client; execute(); @@ -33,8 +34,19 @@ function execute() ->setKey('') // for e.g. sessions ->setValue(125) ->setDate('2017-01-01T00:00:00Z') // Date in ISO8601 format - ->setUnit('') // for e.g. $ - ->setAttributes(['']); // for e.g. ['US'] + ->setUnit(''); // for e.g. $ + + // Optional + if (true) { // If you want to push data to a specific dimension + $pushDataAttribute = new PushDataAttribute( + [ + 'key' => '', // for e.g. country + 'value' => '' // for e.g. US + ] + ); + + $pushData->setAttributes([$pushDataAttribute]); + } try { $apiInstance->dataPost([$pushData]);