[SOLVED] Collect NFTs from collection including IPFS images

Hi Moralis Fam,

Working on an NFT overview where I fetch 20 / all NFTs from an collection, thus far I only find the by owner address API or getContractNFTs but the last one does not have the ipfs uri string in the results. Also tried to call a second api which is https://docs.moralis.io/reference/getnftmetadata-1 with the token id from the contract, but this one also resulted in no IPFS string.

Did I missed something? And does that API also support the IPFS uri?

https://docs.moralis.io/reference/getcontractnfts-2

Additional info:

Contract: 0x44357CB1fC60FD5c6E3E673F6b71B38baf83D386
Limit: 20
Range: 1000
Chain: ETH

Thanks in advance,

Boris

What is the API call youโ€™re making (endpoint and parameters like chain, contract address)?

Yes the Moralis API supports IPFS token URIs.

@alex just updated my question :).

But am trying to fetch the NFTs from: 0x44357CB1fC60FD5c6E3E673F6b71B38baf83D386.

Used this API: https://docs.moralis.io/reference/getcontractnfts-2 and tried merging data with https://docs.moralis.io/reference/getnftmetadata-1 once I fetched the token ID from API 1.

Both APIs do not cover NFT IPFS uris. Any idea? Try to fetch the NFTs from the contract, not from the holder of the NFT

You can use reSyncMetadata for each tokenId in cases like this to force an update. I have resynced that collection.

@alex that is awesome, am now able to fetch individual NFTs with token_uri. The only thing that Iโ€™ve mentioned is that fetching the image takes forever, its pinned to Pinata, and loading an actual image takes like 10 seconds minimum. Anyway, thank you for your help!

Just got it to work and it works faster now, might be from my end. Thanks again @alex for your help.

loading an actual image takes like 10 seconds minimum

This is a general IPFS issue - what you can try is using a different IPFS gateway e.g. https://gateway.moralisipfs.com/ipfs/hashhere.

Using a dedicated gateway (if youโ€™re willing to pay, you can get one from Pinata or Infura) can be quite fast for most IPFS content.

1 Like