0

enter image description here

hello ! I have a question while using the alchemy api. As shown in the picture above, it says tha can put "Airdrop" in the parameter "includeFilters[]" of the api. I'm running an Airdrop event, so I'm very interested in this feature. Can anyone tell me how to use it?

What data should I put in the NFT for the alchemy api filter to work?

1 Answer 1

0

According to the example (for Node language) on the doc:

const sdk = require('api')('@alchemy-docs/v1.0#z93mjsc2xlb2w41kg');

sdk.server('https://eth-mainnet.g.alchemy.com/nft/v2');
sdk.getNFTs({
    owner: 'vitalik.eth',
    withMetadata: 'false',
   'includeFilters[]': 'AIRDROPS', // this is how you use it
   apiKey: 'demo'
})
.then(({ data }) => console.log(data))
.catch(err => console.error(err));

Inside the getNFTs method, you pass in the metadata that contains includeFilters[] as the key and AIRDROPS as the value.

2
  • As in the example below, if AIRDROP is added to the NFT's metadata, will the filter be applied? Or is there another way? Example : { "name":"name", "description":"description", "image":"img url", "ARIDROP":"this si aridrop nft" }
    – imelon2
    Dec 1, 2022 at 0:08
  • No, "AIRDROPS" is the value of the key "includeFilters[]". The word "AIRDROPS" cannot be used as the key because the filter is not built that way. By using "includeFilters[]" and setting the value to "AIRDROPS", you will only get the NFTs that were air-dropped. It's like setting a bool value to true or false. You cannot set the key as "true", or "false", but only as a value of the key "bool". That is how the "includeFilters[]" work. Dec 1, 2022 at 0:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.