Hi there.
I have recently signed up and I am using a barebones api to do some testing.
I have then created an app and imported products / categories etc from my clients account, so far so good. There are about 74 items, and 4 categories.
However, when i go to grab items, unfiltered, I get 4 results.
If I attempt to filter by returning only categories, I get 1 result.
If I attempt to filter by returning only items, I get 3 results.
So for some reason only I only ever get 4 results total.
Here is the code I am using
// Creating the client
$this->client = new SquareClient([
'accessToken' => env('SQUARE_TOKEN'),
'environment' => Environment::SANDBOX
]);
// Grabbing all items
$api = $this->client->getCatalogApi();
try {
$response = $api->listCatalog();
print_r($response->getResult());
} catch (\Exception $e) {
echo '<div style="color: #f00">';
print_r($e);
echo '</div>';
}
// Check for only items
$api = $this->client->getCatalogApi();
try {
$response = $api->listCatalog(null, 'ITEM');
print_r($response->getResult());
} catch (\Exception $e) {
echo '<div style="color: #f00">';
print_r($e);
echo '</div>';
}
// Searching for categories only
$api = $this->client->getCatalogApi();
$categories = [];
try {
$body = new \Square\Models\SearchCatalogObjectsRequest;
$body->setObjectTypes([\Square\Models\CatalogObjectType::CATEGORY]);
$body->setLimit(100);
$response = $api->searchCatalogObjects($body);
print_r($response);
} catch (\Exception $e) { }
Is there something that I am doing wrong?
I am really confused as to what is happening