-
Notifications
You must be signed in to change notification settings - Fork 1
OtClientBulk
$client = new OtClientBulk($key, $secret, $lang);
- key (Access Key)
- secret (Secret for access key)
- language (2 symbol lang identifier)
Get full OTAPI catalog for supported providers
$client->getBriefCatalog('otc-46');
- 'otc-46' is optional parameter if you what to get only specified tree.
Start and process bulk search
$client->getBulkSearchDecoded($frameSize, $xmlParameters, $asStream);
$frameSize
- number of items you whant to receive
$parameters
- framePosition (offset for search, default 0)
- frameSize (items amount for search, default 1000, max value 10000)
$xmlParameters
Filter for search
$xmlParameters = new OtXmlParameters();
$xmlParameters->setCategoryId('otc-46');
Otapi category Id for search $xmlParameters->setMinVolume(30); Min amount of sales
$asStream To prevent memory overuse do not read answer to buffer, work with stream. It use low memory, but need more time.
Method return offers
$client->runBulkSearchItems($parameters, $xmlParameters);
$parameters OtParameters
$parameters = new OtParameters();
$parameters->setFrameSize(5000); // Items count you need
$parameters->setFramePosition(0);
$xmlParameters
$xmlParameters = new OtXmlParameters();
$xmlParameters->setCategoryId('otc-46'); // CategoryId for serach
$xmlParameters->setMinVolume(30); // Min volume sales
Retrun $activityId for getBulkSearchItemsResult
$client->getBulkSearchItemsResult($activityId);
$activityId form runBulkSearchItems request
return json string with all data If Result IsFinished = FALSE repeat request. Answer is not ready.
Start bulk request for specified item Ids
$client->runBulkItems(['123','125','854']);
Array of ItemIds as method parameter
Return activityId for getBulkItemsResult method
$client->getBulkItemsResult($activityId);
$activityId form runBulkSearchItems request
return json string with all data If Result IsFinished = FALSE repeat request. Answer is not ready.
$client->getBulkItemsAtOnce(['123','125','854']);
$client->getBulkItemsDecoded($items, $asStream);
$items array of offer you need
['123','125','854']
$asStream To prevent memory overuse do not read answer to buffer, work with stream. It use low memory, but need more time.
This method start bulk items (runBulkItems) and wait for answer. May take a long time (30 or more seconds).
As answer, you will get JsonMachine object. Then you can use it in loop to parse all items.