GhostMarket REST API provides the simplest method of retrieving the NFT Metadata in simple to digest JSON format. We monitor all supported chains and index NFT events, simplifying and standardizing the retrieval of Metadata from the disparate blockchains which we support.
The returned json object is escaped, so, should be unescaped before use.
Following is an example of the unescaped object ( "\" removed for clarity ).
{json: {"name":"GHOST Genesis NFT #1","image":"ipfs://QmefnzTwshjRhZgMpRfRhp5Xg1hdWnWo7cnuZH8QhDmnjQ","attributes": [ {"trait_type":"Genesis","value":true,"display_type":"" } ],"properties": {"type":2,"has_locked":false },"description":"The owner of this exclusive NFT is granted 100% discount on GhostMarket trading fees, for life." }}
2. Retrieve the Image/media
IPFS Media
If the image field contains one of the prefixes "ipfs://" the content must be retrieved from IPFS:
Extract the IPFS hash from the image field of the metadata (The Hash is the text following the "//" in the URL), and append this to the IPFS HTTP gateway - https://ipfs.io/ipfs/{hash} URL.
e.g. Using a browser to render above image URI, browse to:
To programmatically retrieve IPFS data, other possible alternatives for accessing IPFS is to set up your own IPFS node or use the Infura IPFS Gateway.
Non IPFS Media
If the image field points to a non IPFS URL, e.g. AWS or a generic HTTP(S) address, then directly access the image using the supplied URL.