GhostMarket
  • Welcome
    • Quick Navigation
  • User Guides
    • Getting Started
      • NFTs Explained
      • Supported Blockchains
      • Supported Wallets
      • Connecting Wallets
      • Editing User Profiles
      • Editing Collection Profiles
      • Viewing Owned NFTs
      • Profile Verification
      • Collection Verification
      • Enabling Email Notifications
      • Platform Fees
    • Creating & Managing NFTs
      • Creating NFTs
      • Burning NFTs
      • Transferring NFTs
    • Buying & Selling NFTs
      • Browsing NFTs
      • Buying NFTs
      • Selling NFTs
      • Viewing Site Activity
      • Listing Types
    • Platform Features & Tools
      • Bulk Buying
      • Full DEX Swap Support
      • EVM Swap + Buy
      • Favorites
      • Gas Tracker
      • Instant Sell
      • NFT Explorer
      • Self-Minting Platform
      • Sweep Mode
    • GhostMarket Incentives
      • GFUND
      • Staking Incentives
      • Trading Incentives
  • Developer Guides
    • Accessing NFT Data
    • API
    • Blockchain Short Names
    • Configuring Royalties
    • Metadata Specification
    • Minting Tokens
      • EVM NFT Creation
      • Neo N3 NFT Creation
      • Phantasma NFT Creation
    • Neo N3 NFT Contract Template
    • Refreshing Metadata
    • SDK
    • Storing Metadata - IPFS
  • Smart Contracts
    • Trading contracts
    • NFT contracts
    • Fungible Token contracts
    • Royalties contracts
    • Incentives contracts
    • Staking contracts
    • Vesting contract
    • Liquidity Provider Staking contracts
    • Proxy Contracts
    • Wrapper Contracts
    • Audits
  • GhostMarket Token (GM)
  • Roadmap
  • Media Kit
  • Social Media Links
    • 💬 Discord
    • 💬 Telegram
    • 📣 X (Twitter)
    • 📷 Instagram
    • 📖 Medium
    • 🪙CoinMarketCap
    • 🪙CoinGecko
Powered by GitBook
On this page
  • 1. Retrieve the NFT & metadata
  • 2. Retrieve the Image/media
  1. Developer Guides

Accessing NFT Data

Guide to retrieving NFT content and metadata.

PreviousDeveloper GuidesNextAPI

Last updated 1 year ago

  1. Retrieve the NFT & metadata from the blockchain

  2. Retrieve the Image/media from IPFS

1. Retrieve the NFT & metadata

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.

see our for all supported APIs

Use the API endpoint:

Use the API endpoint, populating the {chain}, {contract} and {token_id} params.

https://api.ghostmarket.io/api/v2/metadata?chain={chain}&contract={contract}&tokenId={tokenId}

  • See the table for the list of supported chain names.

  • See the table for current NFT contracts.

  • The token_id is an integer specifying the NFT within the collection (NFT contract)

Example:

curl -X 'GET' \
'https://api.ghostmarket.io/api/v2/metadata?chain=bsc&contract=0xF41db445D7eaF45536985cE185ce131FA4b42E68&tokenId=1 | jq .json'

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

e.g. Using a browser to render above image URI, browse to:

https://ipfs.io/ipfs/QmefnzTwshjRhZgMpRfRhp5Xg1hdWnWo7cnuZH8QhDmnjQ

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.

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 - URL.

To programmatically retrieve IPFS data, other possible alternatives for accessing IPFS is to or use the IPFS Gateway.

https://ipfs.io/ipfs/{hash}
set up your own IPFS node
Infura
API reference
metadata
NFT Contract
Blockchain Short Name