I’m picking this back up again - still no joy here.
I have a method to make a request to the API like this:
public function getSquareProps( $client, $square_token ) {
try {
$apiResponse = $client->getCatalogApi()->retrieveCatalogObject( $square_token, true, null, true );
if ( $apiResponse->isSuccess() ) {
return $apiResponse->getResult();
}
else {
$errors = $apiResponse->getErrors();
log_message( 'error', json_encode( $errors ) );
return false;
}
}
catch ( ApiException $e ) {
echo "ApiException occurred: <b/>";
echo $e->getMessage() . "<p/>";
return false;
}
}
This seems to be working, but, I’m not getting any image URLs in the responses, even when the catalogue item has images in Square.
Example response:
{
"object": {
"type": "ITEM_VARIATION",
"id": "OC3RKNHZRVUT327ZQD5T27XK",
"updated_at": "2024-11-05T10:34:31.285Z",
"version": 1730802871285,
"is_deleted": false,
"present_at_all_locations": true,
"item_variation_data": {
"item_id": "RBLOQQDBTU3YDB525OKQKFCM",
"name": "",
"sku": "8260626",
"upc": "9783740814762",
"ordinal": 1,
"pricing_type": "FIXED_PRICING",
"price_money": {
"amount": 1399,
"currency": "GBP"
},
"location_overrides": [
{
"location_id": "LC045GCPXTEQY",
"track_inventory": true
}
],
"track_inventory": true,
"inventory_alert_type": "NONE",
"sellable": true,
"stockable": true
}
},
"related_objects": [
{
"type": "ITEM",
"id": "RBLOQQDBTU3YDB525OKQKFCM",
"updated_at": "2024-11-05T10:34:31.285Z",
"version": 1730802871285,
"is_deleted": false,
"custom_attribute_values": {
"sq0idp-w46nJ_NCNDMSOywaCY0mwA:ecom_gifting_enabled": {
"name": "Ecom Gifting Enabled",
"custom_attribute_definition_id": "SUVNEPWVWH523WZMJKNAXCHB",
"type": "BOOLEAN",
"boolean_value": true,
"key": "sq0idp-w46nJ_NCNDMSOywaCY0mwA:ecom_gifting_enabled"
}
},
"present_at_all_locations": true,
"item_data": {
"name": "111 Places in Edinburgh",
"description": "This book takes the discerning visitor to hidden corners and secret sights in this city of contrasts, exploring fascinating locations unknown even to most residents, and revealing unexpected aspects of some familiar local landmarks. Marvel at a unique",
"is_taxable": true,
"available_online": false,
"available_for_pickup": false,
"available_electronically": false,
"variations": [
{
"type": "ITEM_VARIATION",
"id": "OC3RKNHZRVUT327ZQD5T27XK",
"updated_at": "2024-11-05T10:34:31.285Z",
"version": 1730802871285,
"is_deleted": false,
"present_at_all_locations": true,
"item_variation_data": {
"item_id": "RBLOQQDBTU3YDB525OKQKFCM",
"name": "",
"sku": "8260626",
"upc": "9783740814762",
"ordinal": 1,
"pricing_type": "FIXED_PRICING",
"price_money": {
"amount": 1399,
"currency": "GBP"
},
"location_overrides": [
{
"location_id": "LC045GCPXTEQY",
"track_inventory": true
}
],
"track_inventory": true,
"inventory_alert_type": "NONE",
"sellable": true,
"stockable": true
}
}
],
"product_type": "REGULAR",
"skip_modifier_screen": true,
"image_ids": [
"77KD5QJNYUTHKSKYILYHCAWZ",
"5MFLTBJZEIF4PMBJSQ3DRUGT",
"7HJFHNSJ32PUECPGGWMFOU4T",
"2WYGJEXYFZSVDURFWOH5Y25C"
],
"categories": [
{
"id": "M23PYY6GTR73PGF7V25WMLKN",
"ordinal": 2954937499648
},
{
"id": "2F6THZBNTAWBGV5RXB7QA5M4",
"ordinal": 120316
},
{
"id": "HLSK5ZVI5YWZOCXX6J456QDV",
"ordinal": 2810162
}
],
"description_html": "<p>This book takes the discerning visitor to hidden corners and secret sights in this city of contrasts, exploring fascinating locations unknown even to most residents, and revealing unexpected aspects of some familiar local landmarks. Marvel at a unique <\/p>",
"description_plaintext": "This book takes the discerning visitor to hidden corners and secret sights in this city of contrasts, exploring fascinating locations unknown even to most residents, and revealing unexpected aspects of some familiar local landmarks. Marvel at a unique",
"channels": [
"CH_wYG80B8Mc4XMb3VHdzF4iPGPzVWtApTTwwvfYRlQuYC",
"CH_DbRkdm8P1PgFUo8YHzF4iPGPzVWtApTTwwvfYRlQuYC"
],
"is_archived": false,
"ecom_seo_data": {
"page_title": "111 Places in Edinburgh Book | Gift Shop Edinburgh",
"page_description": "The 111 places in Edinburgh book is a guide to some of the best places to see in Edinburgh.",
"permalink": "111-places-in-edinburgh-travel-guide-book"
},
"reporting_category": {
"id": "M23PYY6GTR73PGF7V25WMLKN",
"ordinal": 2954937499648
}
}
}
]
}
Compare the above to the same request being made using the API explorer:
{
"object": {
"type": "ITEM_VARIATION",
"id": "OC3RKNHZRVUT327ZQD5T27XK",
"updated_at": "2024-11-05T10:34:31.285Z",
"created_at": "2022-03-23T18:30:27.298Z",
"version": 1730802871285,
"is_deleted": false,
"present_at_all_locations": true,
"item_variation_data": {
"item_id": "RBLOQQDBTU3YDB525OKQKFCM",
"name": "",
"sku": "8260626",
"upc": "9783740814762",
"ordinal": 1,
"pricing_type": "FIXED_PRICING",
"price_money": {
"amount": 1399,
"currency": "GBP"
},
"location_overrides": [
{
"location_id": "LC045GCPXTEQY",
"track_inventory": true
}
],
"track_inventory": true,
"inventory_alert_type": "NONE",
"sellable": true,
"stockable": true,
"default_unit_cost": {
"amount": 839,
"currency": "GBP"
},
"channels": [
"CH_DbRkdm8P1PgFUo8YHzF4iPGPzVWtApTTwwvfYRlQuYC",
"CH_wYG80B8Mc4XMb3VHdzF4iPGPzVWtApTTwwvfYRlQuYC"
],
"item_variation_vendor_info_ids": [
"E25LRO2ZSLFCTOIPJH26XLMU"
],
"item_variation_vendor_infos": [
{
"type": "ITEM_VARIATION_VENDOR_INFO",
"id": "E25LRO2ZSLFCTOIPJH26XLMU",
"updated_at": "2024-11-05T10:34:31.285Z",
"created_at": "2022-03-23T18:32:00.71Z",
"version": 1730802871285,
"is_deleted": false,
"present_at_all_locations": true,
"item_variation_vendor_info_data": {
"ordinal": 0,
"price_money": {
"amount": 839,
"currency": "GBP"
},
"item_variation_id": "OC3RKNHZRVUT327ZQD5T27XK",
"vendor_id": "DFOH472UUZENRPZW"
}
}
]
}
},
"related_objects": [
{
"type": "ITEM",
"id": "RBLOQQDBTU3YDB525OKQKFCM",
"updated_at": "2024-11-05T10:34:31.285Z",
"created_at": "2022-03-23T18:30:27.298Z",
"version": 1730802871285,
"is_deleted": false,
"custom_attribute_values": {
"sq0idp-w46nJ_NCNDMSOywaCY0mwA:ecom_gifting_enabled": {
"name": "Ecom Gifting Enabled",
"custom_attribute_definition_id": "SUVNEPWVWH523WZMJKNAXCHB",
"type": "BOOLEAN",
"boolean_value": true,
"key": "sq0idp-w46nJ_NCNDMSOywaCY0mwA:ecom_gifting_enabled"
}
},
"present_at_all_locations": true,
"item_data": {
"name": "111 Places in Edinburgh",
"description": "This book takes the discerning visitor to hidden corners and secret sights in this city of contrasts, exploring fascinating locations unknown even to most residents, and revealing unexpected aspects of some familiar local landmarks. Marvel at a unique",
"is_taxable": true,
"visibility": "PRIVATE",
"available_online": false,
"available_for_pickup": false,
"available_electronically": false,
"variations": [
{
"type": "ITEM_VARIATION",
"id": "OC3RKNHZRVUT327ZQD5T27XK",
"updated_at": "2024-11-05T10:34:31.285Z",
"created_at": "2022-03-23T18:30:27.298Z",
"version": 1730802871285,
"is_deleted": false,
"present_at_all_locations": true,
"item_variation_data": {
"item_id": "RBLOQQDBTU3YDB525OKQKFCM",
"name": "",
"sku": "8260626",
"upc": "9783740814762",
"ordinal": 1,
"pricing_type": "FIXED_PRICING",
"price_money": {
"amount": 1399,
"currency": "GBP"
},
"location_overrides": [
{
"location_id": "LC045GCPXTEQY",
"track_inventory": true
}
],
"track_inventory": true,
"inventory_alert_type": "NONE",
"sellable": true,
"stockable": true,
"default_unit_cost": {
"amount": 839,
"currency": "GBP"
},
"channels": [
"CH_DbRkdm8P1PgFUo8YHzF4iPGPzVWtApTTwwvfYRlQuYC",
"CH_wYG80B8Mc4XMb3VHdzF4iPGPzVWtApTTwwvfYRlQuYC"
],
"item_variation_vendor_info_ids": [
"E25LRO2ZSLFCTOIPJH26XLMU"
],
"item_variation_vendor_infos": [
{
"type": "ITEM_VARIATION_VENDOR_INFO",
"id": "E25LRO2ZSLFCTOIPJH26XLMU",
"updated_at": "2024-11-05T10:34:31.285Z",
"created_at": "2022-03-23T18:32:00.71Z",
"version": 1730802871285,
"is_deleted": false,
"present_at_all_locations": true,
"item_variation_vendor_info_data": {
"ordinal": 0,
"price_money": {
"amount": 839,
"currency": "GBP"
},
"item_variation_id": "OC3RKNHZRVUT327ZQD5T27XK",
"vendor_id": "DFOH472UUZENRPZW"
}
}
]
}
}
],
"product_type": "REGULAR",
"skip_modifier_screen": true,
"ecom_uri": "https://www.example.com/product/111-places-in-edinburgh-travel-guide-book/21",
"ecom_image_uris": [
"https://www.example.com/uploads/1/4/1/2/141295149/s482407285242066437_p21_i6_w1279.jpeg",
"https://www.example.com/uploads/1/4/1/2/141295149/s482407285242066437_p21_i7_w1594.jpeg",
"https://www.example.com/uploads/1/4/1/2/141295149/s482407285242066437_p21_i8_w1594.jpeg",
"https://www.example.com/uploads/1/4/1/2/141295149/s482407285242066437_p21_i9_w1594.jpeg"
],
"ecom_available": true,
"ecom_visibility": "VISIBLE",
"image_ids": [
"77KD5QJNYUTHKSKYILYHCAWZ",
"5MFLTBJZEIF4PMBJSQ3DRUGT",
"7HJFHNSJ32PUECPGGWMFOU4T",
"2WYGJEXYFZSVDURFWOH5Y25C"
],
"categories": [
{
"id": "M23PYY6GTR73PGF7V25WMLKN",
"ordinal": 2954937499648
},
{
"id": "2F6THZBNTAWBGV5RXB7QA5M4",
"ordinal": 120316
},
{
"id": "HLSK5ZVI5YWZOCXX6J456QDV",
"ordinal": 2810162
}
],
"pickup_fulfillment_preferences_id": "fprefs_127cj2koz85ya0z0vzjkm2fhd",
"delivery_fulfillment_preferences_id": "fprefs_127k2et792iachyxqqbglolo5",
"description_html": "<p>This book takes the discerning visitor to hidden corners and secret sights in this city of contrasts, exploring fascinating locations unknown even to most residents, and revealing unexpected aspects of some familiar local landmarks. Marvel at a unique </p>",
"description_plaintext": "This book takes the discerning visitor to hidden corners and secret sights in this city of contrasts, exploring fascinating locations unknown even to most residents, and revealing unexpected aspects of some familiar local landmarks. Marvel at a unique",
"channels": [
"CH_wYG80B8Mc4XMb3VHdzF4iPGPzVWtApTTwwvfYRlQuYC",
"CH_DbRkdm8P1PgFUo8YHzF4iPGPzVWtApTTwwvfYRlQuYC"
],
"shipping_fulfillment_preferences_id": "fprefs_127kfdiun899e3m2e23i3u98j",
"dine_in_fulfillment_preferences_id": "fprefs_127tnhil7mj6bm56mbrnsowxg",
"is_archived": false,
"ecom_seo_data": {
"page_title": "111 Places in Edinburgh Book | Gift Shop Edinburgh",
"page_description": "The 111 places in Edinburgh book is a guide to some of the best places to see in Edinburgh.",
"permalink": "111-places-in-edinburgh-travel-guide-book"
},
"reporting_category": {
"id": "M23PYY6GTR73PGF7V25WMLKN",
"ordinal": 2954937499648
}
}
}
]
}
Why does the explorer return the ecom_image_uris but the API doesn’t?