Data Feeds - PureClarity/php-sdk GitHub Wiki
Data Feed classes reside in the PureClarity\Api\Feed\Type namespace and each feed type has its own class
- PureClarity\Api\Feed\Type\Brand
- PureClarity\Api\Feed\Type\Category
- PureClarity\Api\Feed\Type\Order
- PureClarity\Api\Feed\Type\Product
- PureClarity\Api\Feed\Type\User
Each feed class builds a JSON string of the data provided to it and sends it to PureClarity's feed endpoint in manageable chunks of data.
Usage
To use a feed class, you need to instantiate the class, passing the account details:
$feed = new \PureClarity\Api\Feed\Type\Product($accessKey, $secretKey, $region);
Param | Type | Description |
---|---|---|
$accessKey | string | PureClarity Account access key |
$secretKey | string | PureClarity Account secret key |
$region | integer | PureClarity Region |
See What account data should I use? for more information on what these parameters should be.
Then once you've instantiated the class, there are 3 functions you need to call:
Function name | Purpose |
---|---|
start | Builds the start of the json file to be sent |
append | appends a row of data to the feed, converting it to json and sending to PureClarity in chunks as needed |
end | builds the end of the feed file, and sends all remaining data |
Example:
$feedData = <data pulled from your system>
$feed = new \PureClarity\Api\Feed\Type\Product($accessKey, $secretKey, $region);
$feed->start();
foreach ($feedData as $row) {
$feed->append($row);
}
$feed->end();
Data format
Each feed type has fields that are required, see individual pages for more details