# Fetch products

`GET /api/bobsync/products?id=123`

**Base URLs:**

- Sandbox: `https://api.tools.qa.bobshop.co.za`
- Production: `https://api.tools.bobshop.co.za`

**Authentication:** Bearer token required (see the Authentication page).

## Example request

```bash
curl -X GET 'https://api.tools.qa.bobshop.co.za/api/bobsync/products?id=123' \
  -H "Authorization: Bearer <API_KEY>"
```

Retrieve one or more of your products by our numeric `id`.

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `id` | integer | one of the two | A single id. |
| `ids` | array of integer | one of the two | A JSON array, for example `ids=[123,456]`. A bare `123,456` is rejected. |

**This is not a catalogue listing and has no pagination.** Store the `id`
values we return when you push products. Products on another channel cannot be
fetched.

`condition`, `delivery_type`, `discreet_listing`, `gtin`, `handling_time` and
`quantity_per_lot` always read back empty, because they are not stored on the
product.

## Failures

| Status | Body | Meaning |
| --- | --- | --- |
| `400` | `Invalid ids or id, please specify id or ids.` | Neither `id` nor `ids` was supplied. |
| `400` | `invalid ids[0]` | `ids` was not sent as a JSON array, for example `ids=123,456`. |
| `400` | `a product with a given id does not belong to the channel` | One of the ids belongs to another channel. |
| `404` | `could not find product/s` | No product matched. |

## Response

`200` with the matching products and a `count`.

```json
{
    "products": [
        {
            "id": 486875,
            "product_reference": "abc123",
            "name": "Demo Product",
            "description": "This is a product",
            "condition": "",
            "delivery_type": "",
            "discreet_listing": false,
            "gtin": null,
            "handling_time": 0,
            "quantity_per_lot": 0,
            "tags": "electronics,gadgets",
            "vendor": "ACME Inc.",
            "images": [
                { "src": "https://example.com/image1.jpg", "position": 1 }
            ],
            "variants": [
                {
                    "variant_id_text": "ab1",
                    "sku": "SKU-ABC123",
                    "barcode": "123456789012",
                    "description": "",
                    "image_src": "https://example.com/image1.jpg",
                    "name": "",
                    "position": 1,
                    "price": 199.99,
                    "price_compare": 249.99,
                    "quantity": 5,
                    "weight": 1.23,
                    "options": null
                }
            ]
        }
    ],
    "count": 1
}
```
