How to fetch badges
You can get access to Badges connecting to TheBadge’s subgraph:
In the subgraph, you can request data about badges. You can search for them by using the badge's id.
For example:
Take into account that a badge’s id has the format: “ {ownerAddress} - {badgeTypeId} ”
Using the field: “evidenceMetadataUrl” (IPFS hash) you can obtain further information about the Badge. If you get the IPFS data from it, the JSON file that you receive has a structure like this:
On the Image field, you will get the hash of the PNG file stored in IPFS for this particular Badge. If you want to show visually a Badge, you can use the image from there. On the other hand, Values and Columns contain the evidence provided by the user to obtain it.
“Columns” represents the form fields with label, type and description, and “Values” is an object (key-value) with the form label as key and the evidence on the other side.
If you want to obtain all the badges for a particular address, you can use this:
If you have any questions or need further assistance, feel free to contact our team on our Discord!
Last updated