Tutorial: Retrieve Icons from the API


One of the main goals of introducing /trips v3 was to architect a flexible infrastructure that allows sherpa° to continue to add information that goes beyond COVID-19, making the information more relatable and engaging to your travellers.
When implementing any application that leverages sherpa° API, it is essential to use generic logic to avoid issues when inevitably information is added, removed or modified.


The approach outlined here will replace the previous static iconography guide.

Icon Attribute

Information groupings, groups, restrictions and procedures may include an Icon attribute that currently carries a name. The icon name is contextualized to the information object containing it, so you should use this name to locate the appropriate icons from your application resources.
Keep in mind that alt attribute can be inferred from the IconName directly.

Fetching Icons from sherpa°

Step 1

In the v3 response, you will notice icon names are returned in the included array. For example the key object.included[x]attributes.icon.name will have a value that contains the name of the icon.

Step 2

You can fetch then an icon from sherpa°'s CDN directly by referencing https://cdn.joinsherpa.io/icons/{**ICON_NAME**}.svg


Backup Only

Icons assets provided by sherpa° are best served as a backup alternative. We highly recommend using icons that are custom creations of your team, and match the design/theme/palette of your application.