A significant portion of our responses may have icons available to represent the item. Whenever present, they will be returned as a short name in the iconId field of a record. To save response time on searches, the images themselves are not returned with each item; instead you can use this iconId to be formatted into our Icon CDN Path. The CDN provides fast delivery in most regions.
Note that icon's are not guaranteed; some icons are exact representations, while others may use inheritance and be representative but not explicit. An example of this might be that you could receive an icon of a bunch of bananas for an item called "Banana slices".
Icon CDN Path
You can format the IconID into our Icon CDN Path to serve your icon files.
In the case below, the iconId in the path is BEV0257
Note that all icons are available in 3 sizes based on the suffix used:
-90.jpg // 90 x 90(px) icon
-180.jpg // 180 x 180(px) icon
-360.jpg // 360 x 360(px) icon
These sizes should allow you to support speed on smaller list items such as search results, as well as having large variations for page views.
Example Icon Setup Code
Important Notes:
All examples assume you have previously executed a search or result api call, and have parsed the information into some model responseObject
Examples show only how to retrieve the correct URL for each icon
What you do with the icon URL varies per language/framework. Examples do not include requests to download the icon from the URL, or steps to place the URL into an <img> tag, etc.
React/JS
constBASE_URL="https://storage.googleapis.com/passio-prod-env-public-cdn-data/label-icons/%s-%d.jpg";constIconSmall=90;constIconMed=180;constIconLarge=360;// Your model for the response of the item in question// (a search or result route response)// Only iconId is shown for brevityconstresponseObject= { iconId:"BEV0257" };functiongetIconUrl(obj, size) {returnBASE_URL.replace("%s",obj.iconId).replace("%d", size);}// Example usageconsole.log(getIconUrl(responseObject, IconSmall));
Python
BASE_URL ="https://storage.googleapis.com/passio-prod-env-public-cdn-data/label-icons/%s-%d.jpg"IconSmall =90IconMed =180IconLarge =360# Your model for the response of the item in question# (a search or result route response)# Only iconId is shown for brevityresponseObject ={"iconId":"BEV0257"}defget_icon_url(responseObject,size):return BASE_URL % (responseObject["iconId"], size)# Example usageprint(get_icon_url(responseObject, IconSmall))
Go
packagemainimport ("fmt")const ( BaseURL ="https://storage.googleapis.com/passio-prod-env-public-cdn-data/label-icons/%s-%d.jpg" IconSmall =90 IconMed =180 IconLarge =360)// Your model for the response of the item in question// (a search or result route response)// Only iconId is shown for brevitytypeResponseObjectstruct { IconId string}funcGetIconURL(obj ResponseObject, size int) string {return fmt.Sprintf(BaseURL, obj.IconId, size)}funcmain() { responseObject :=ResponseObject{IconId: "BEV0257"} fmt.Println(GetIconURL(responseObject, IconSmall))}
Swift
let baseUrl ="https://storage.googleapis.com/passio-prod-env-public-cdn-data/label-icons/%@-%d.jpg"let iconSmall: Int=90let iconMed: Int=180let iconLarge: Int=360// Your model for the response of the item in question// (a search or result route response)// Only iconId is shown for brevitylet responseObject = ["iconId":"BEV0257"]funcgetIconUrl(responseObject: [String:String], size: Int) ->String {iflet iconId = responseObject["iconId"] {returnString(format: baseUrl, iconId, size) }return""}// Example usageprint(getIconUrl(responseObject: responseObject, size: iconSmall))
Java
publicclassIconUrlFormatter {privatestaticfinalString BASE_URL ="https://storage.googleapis.com/passio-prod-env-public-cdn-data/label-icons/%s-%d.jpg";privatestaticfinalint IconSmall =90;privatestaticfinalint IconMed =180;privatestaticfinalint IconLarge =360;publicstaticStringgetIconUrl(ResponseObject responseObject,int size) {returnString.format(BASE_URL,responseObject.getIconId(), size); }publicstaticvoidmain(String[] args) {// init dummy response from API routeResponseObject responseObject =newResponseObject("BEV0257");System.out.println(getIconUrl(responseObject, IconSmall)); }}// Your model for the response of the item in question// (a search or result route response)// Only iconId is shown for brevityclassResponseObject {privateString iconId;publicResponseObject(String iconId) {this.iconId= iconId; }publicStringgetIconId() {return iconId; }}
Feel free to serve these directly to users from our CDN - thats what its there for!