GET api/Products/{id}?format={format}
Look up an item in the database by barcode, and return relevant information. If the barcode is not found, it will attempt to locate the company, based on the manufacturer id, and return information for that. If neither the product nor company are found, returns 404 (not found).
Request Information
URI Parameters
Name | Description | Type | Additional information |
---|---|---|---|
id |
Numerical value of barcode to look up |
string |
Required |
format |
The string format of the barcode, eg UPC-A |
string |
None. |
Body Parameters
None.
Response Information
Resource Description
JSON object containing the product information
RetrievedProductDataName | Description | Type | Additional information |
---|---|---|---|
ProductName |
The name of the product. If the explicit barcode is not found in the database, this can be null |
string |
None. |
CompanySid |
A unique identifier for the company. |
integer |
None. |
CompanyName |
The name of the Company manufacturing the product |
string |
None. |
PercentCommitment |
The numerical grade (0-100) for the commitment this company has made to using only sustainable palm oil. If unknown, this can be null |
decimal number |
None. |
ContainsPalmOil |
Whether or not this product contains palm oil, or a palm oil derivative. If unknown, can be null |
boolean |
None. |
ContainsVegetableOil |
Whether or not this product contains a product that is commonly (although not exclusively) made from palm oil. If unknown, this can be null. |
boolean |
None. |
CompanyNoPalmOil |
Indicates whether or not this company has a "no palm oil" policy in place. Used in case the product is not known, but the company can be inferred. |
boolean |
None. |
ContactAddress |
Typically an email address or URL that a company can be reached at. |
string |
None. |
TwitterHandle |
The twitter handle for the company, if known |
string |
None. |
Response Formats
application/json, text/json
{ "ProductName": "sample string 1", "CompanySid": 2, "CompanyName": "sample string 3", "PercentCommitment": 1.1, "ContainsPalmOil": true, "ContainsVegetableOil": true, "CompanyNoPalmOil": true, "ContactAddress": "sample string 5", "TwitterHandle": "sample string 6" }
application/xml, text/xml
<RetrievedProductData xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/PalmSmart.Models"> <CompanyName>sample string 3</CompanyName> <CompanyNoPalmOil>true</CompanyNoPalmOil> <CompanySid>2</CompanySid> <ContactAddress>sample string 5</ContactAddress> <ContainsPalmOil>true</ContainsPalmOil> <ContainsVegetableOil>true</ContainsVegetableOil> <PercentCommitment>1.1</PercentCommitment> <ProductName>sample string 1</ProductName> <TwitterHandle>sample string 6</TwitterHandle> </RetrievedProductData>