Search for a product based on item parameters
https://api.upcdatabase.org/search/?query=your_query&page=1
query is a text string to search for.
page is optional and defaults to 1
<?php $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => 'https://api.upcdatabase.org/search/?query=The%20Dog&page=1', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'GET', CURLOPT_HTTPHEADER => array( 'Authorization: Bearer THISISALIVEDEMOAPIKEY19651D54X47', 'Cookie: upcdatabaseorg=k1ojqnark963pr3ae2jt4rb4sk' ), )); $response = curl_exec($curl); curl_close($curl); echo $response;
var settings = { "url": "https://api.upcdatabase.org/search/?query=The Dog&page=1", "method": "GET", "timeout": 0, "headers": { "Authorization": "Bearer THISISALIVEDEMOAPIKEY19651D54X47" }, }; $.ajax(settings).done(function (response) { console.log(response); });
curl --location --request GET 'https://api.upcdatabase.org/search/?query=The Dog&page=1' \ --header 'Authorization: Bearer THISISALIVEDEMOAPIKEY19651D54X47'
The response contains an array of up to 20 items.
{ "success": true, "timestamp": 1661013920, "results": 20, "items": [ { "barcode": "079784913400", "title": "\"The Dog\" Notepad", "alias": "", "description": "\"The Dog\" 4x4 inch notepad." }, { "barcode": "794043465826", "title": "Wag The Dog", "alias": "", "description": "" }, { "barcode": "0735836369853", "title": "Clover the Dog, stuffed animal", "alias": "", "description": "Clover the Dog, stuffed animal" }, { "barcode": "083361481077", "title": "Zero the Dog with light", "alias": "", "description": "Zero the Dog with light" }, { "barcode": "0646560600023", "title": "The Dog House "How Many People Must get Dissed?"", "alias": "", "description": "The Dog House "How Many People Must get Dissed?"" }, { "barcode": "699675105228", "title": "Baha Men - Who Let the Dogs Out", "alias": "", "description": "" }, { "barcode": "0724101904424", "title": "Kicked By The Dog: Another Great Day", "alias": "", "description": "" }, { "barcode": "0008421401512", "title": "Ty Original Beanie Babies - Crinkles The Dog", "alias": "", "description": "" }, { "barcode": "0008421407439", "title": "Ty Original Beanie Babies - Tyger The Dog", "alias": "", "description": "" }, { "barcode": "0008421403622", "title": "Ty Original Beanie Babies - Doogie The Dog", "alias": "", "description": "" }, ... ] }
{ "message" => "Not Found. No products could be found with that search query.", "status": 400, "error": true } { "message" => "Search string too short. Search for 3 characters or more.", "status": 400, "error": true }
{ "message": "Forbidden. Are you using the right authentication method and API token?", "status": 403, "error": true }
{ "success": false, "timestamp": 1661004161, "query": "An invalid string", "error": { "message": "No Results found." } }