Sage / sageone_api_php_sample

Sage One API PHP Sample
MIT License
43 stars 32 forks source link

Search product with item_code? #33

Closed greensunrise closed 6 years ago

greensunrise commented 6 years ago

Hi,

Using https://developer.columbus.sage.com/docs#/uki/sageone/accounts/v3/products , is it possible to search a product by item code?

timlapluie commented 6 years ago

Hi @banstola,

if you click on Query Parameters in the documentation page you posted, you can find the search parameter which can be used to search the INDEX collection for a specific item code of a product.

greensunrise commented 6 years ago

Can you please put an example? Is it like this ? Is it like below? search={product_code}&attributes=item_code?

timlapluie commented 6 years ago

Exactly! I just tested it with this example:

GET /products?attributes=item_code&search=ABC123

and it works as expected.

Response for this example was:

{
  "$total": 1,
  "$page": 1,
  "$next": null,
  "$back": null,
  "$itemsPerPage": 20,
  "$items": [
    {
      "id": "67c86c740a5011e896cf5d3c18c18248",
      "displayed_as": "My product",
      "$path": "/products/67c86c740a5011e896cf5d3c18c18248",
      "item_code": "ABC123"
    }
  ]
}