Ah, the generic API. I’ll take a look and see if there’s something we can do here.
Disclaimer: The Generic APIs are there as a catch-all for our domain classes. They were meant to satisfy some basic requirements (search, retrieve, save) as we flesh out the APIs needed for the application.
You can also use the main Products API. There are two endpoints (list, search) that support basic search on products. See below for examples of how to use them.
The documentation for the APIs is admittedly pretty weak, so you’ll need to look at the code to get a better understanding of what is supported.
But, for what it’s worth, that’s why I created this discussion forum. Since we’re an open-source project with limited funding, we don’t have unlimited resources for writing documentation. Therefore, I deployed this Discourse instance because I wanted to make sure users and developers had the ability to get answers to their questions.
So don’t feel like you’re imposing by asking tons of questions. It’ll help us grow.
From my perspective, posting specific questions about what you are trying to implement does at least three things for the community:
- Allows us to help you (and others) to answer specific questions and move your projects forward
- Allows us to figure out what documentation we need to write
- Allows us to better understand what features we need to support
Here are a few examples. We could/should do a better job of standardizing these endpoints but again don’t hesitate to tell us what you’re looking to do and we’ll provide some ideas on how to achieve your goals.
Lookup by name, product code, etc
$ curl -b cookies.txt -X GET -H "Content-Type: application/json"
https://demo.openboxes.com/openboxes/api/products?q=KS08
{
"data": [
{
"id": "c1e344344072bbd501407a6d5fcd0003",
"productCode": "KS08",
"name": "Kojin?s",
"description": "Juodos spalvos kojin?s",
"category": "Apparel",
"unitOfMeasure": "35",
"pricePerUnit": 50,
"dateCreated": "2013-08-14T01:25:23Z",
"lastUpdated": "Sep 01, 2021",
"updatedBy": "Anahy R",
"color": null,
"handlingIcons": [],
"lotAndExpiryControl": null,
"active": true
}
],
"totalCount": 1
}
Search by name, product code, etc
$ curl -b cookies.txt -X GET -H "Content-Type: application/json"
https://demo.openboxes.com/openboxes/api/products/search?name=Ibuprofen
{
"data": [
{
"id": "c1e344344072bbd50140ba2c40f4010a",
"productCode": "BU45",
"name": "Ibuprofen 200mg",
"color": null,
"handlingIcons": [],
"lotAndExpiryControl": null
},
{
"id": "c1e34434413773c60141bcacee1000f1",
"productCode": "PC26",
"name": "Ibuprofen or Placebo",
"color": null,
"handlingIcons": [
{
"icon": "fa-snowflake",
"color": "#3bafda",
"label": "Cold chain"
}
],
"lotAndExpiryControl": null
},
{
"id": "c1e344344200f2cb014253b54fcd009d",
"productCode": "NK001",
"name": "Ibuprofen, 200mg",
"color": null,
"handlingIcons": [],
"lotAndExpiryControl": null
},
{
"id": "c1e3443443b6764c0143bfee85960019",
"productCode": "JX55",
"name": "Ibuprofen",
"color": null,
"handlingIcons": [],
"lotAndExpiryControl": null
},
{
"id": "c1e34434445c2b5301448c50ba990038",
"productCode": "KY96",
"name": "Ibuprofen",
"color": null,
"handlingIcons": [],
"lotAndExpiryControl": null
},
{
"id": "c1e344344fccfaf0014ffb173ed21214",
"productCode": "GK86",
"name": "Ibuprofen 200mg tablet",
"color": null,
"handlingIcons": [],
"lotAndExpiryControl": null
},
{
"id": "c1e34434665700290166896b13fc3100",
"productCode": "EE87",
"name": "Ibuprofen, 200mg",
"color": null,
"handlingIcons": [],
"lotAndExpiryControl": null
},
{
"id": "c1e34434665700290166b8a4464367f9",
"productCode": "i001",
"name": "Ibuprofen ",
"color": null,
"handlingIcons": [
{
"icon": "fa-exclamation-circle",
"color": "#db1919",
"label": "Controlled substance"
}
],
"lotAndExpiryControl": null
},
{
"id": "c1e344346fecc3df01706fa5146801d9",
"productCode": "ibuprofen 200",
"name": "Ibuprofen 200mg tablet",
"color": null,
"handlingIcons": [],
"lotAndExpiryControl": null
},
{
"id": "c1e34434727d92fb01749f93018a090c",
"productCode": "ib002343153112",
"name": "Ibuprofen 200mg",
"color": null,
"handlingIcons": [
{
"icon": "fa-snowflake",
"color": "#3bafda",
"label": "Cold chain"
},
{
"icon": "fa-exclamation-triangle",
"color": "#ffa500",
"label": "Hazardous material"
}
],
"lotAndExpiryControl": null
},
{
"id": "c1e34434766833b101773234427b02ad",
"productCode": "GX24",
"name": "Ibuprofen 200mg",
"color": null,
"handlingIcons": [
{
"icon": "fa-exclamation-circle",
"color": "#db1919",
"label": "Controlled substance"
}
],
"lotAndExpiryControl": null
},
{
"id": "ff8081817f4160ad0180447b9ecf02de",
"productCode": "7861194608327",
"name": "Ibuprofen 200mg",
"color": null,
"handlingIcons": [
{
"icon": "fa-snowflake",
"color": "#3bafda",
"label": "Cold chain"
}
],
"lotAndExpiryControl": null
},
{
"id": "ff8081818125768501829d16213503bf",
"productCode": "0265748646",
"name": "Ibuprofen 200mg",
"color": null,
"handlingIcons": [],
"lotAndExpiryControl": true
}
]
}