How to get all the NFTs of particular smart contract - node.js

I tried https://docs.opensea.io/reference opensea.io docs to fetch data. However, I think there are 2 APIs.
curl --request GET \
--url https://api.opensea.io/api/v1/asset/0xb47e3cd837ddf8e4c57f05d70ab865de6e193bbb/1/
This is for a single asset and it requires a token id as well. But I want data of all the NFTs of a particular smart contract address just by giving the smart contract address.
And this is for a single contract.
curl --request GET \
--url https://api.opensea.io/api/v1/asset_contract/0x06012c8cf97bead5deae237070f9587f8e7a266d

The assets endpoint (docs) has the asset_contract_address filter that allows you to filter by a contract address. Which will effectively allow you to paginate through all NFTs of the contract (that Opensea knows of).
Example:
curl 'https://api.opensea.io/api/v1/assets?offset=0&limit=20&asset_contract_address=0xb47e3cd837ddf8e4c57f05d70ab865de6e193bbb'

Related

Can slack webhooks mention multiple users in a single webhook request?

As title says, I'm looking to send a single request to a web-hook to mention multiple users. At the moment, from testing I can only seem to get it to mention one and any more results in it either converting the entire body to a string or simply mentioning one.
curl --header "Content-Type: application/json" \
--request POST \
--data '{"incoming":"user#email.com"}' \
https://hooks.slack.com/workflows/ID
This is the call I'm making to the workflow Webhook URL & I was trying to use the user's email as an indetifier. It works for the first but not for any others.
Any info is greatly appreciated, I know I'm doing something dumb here!
I managed to resolve this myself the bad way.
I simply added additional values that I can fill in as needed. It's messy, but however I believe the best way to do this based on the limited permissions and the available functionality of Workflows.

How do I authenticate when testing a GET to Webhooks

I am using Zapier Webhooks with Airtable with the intention that when there is a new record in my Airtable, I can take action with the webhook!
However, I am having trouble setting up the API on Zapier.
Here is where I am getting the error: And I think it's because I am not authorizing properly, because afterwards it says:
I know my values are correct because when I make a CURL request, I use the following:
curl "https://api.airtable.com/v0/appyRAw7MAgenvkqu/RTS" \
-H "Authorization: Bearer MY_KEY_HERE | json_pp
And I am returned with proper JSON... but through Zapier, I cannot get past this step.
David here, from the Zapier Platform team.
I did a little digging here and it turns out there's a bug on Airtable's end (which has now been reported) where the User-Agent: Zapier header (which we send by default) causes API calls to 404. There are two solutions:
Overwrite the User-Agent header with anything else
Use the table id instead of the table name in the url
I've tested each and found that it works as expected. Here's a picture of my successful setup:
Sorry about that confusion. ​Let me know if you've got any other questions!

How to get same track/song from Spotify on Apple Music and vice versa?

I'm building a simple app, where users can share the song they're listening with friends. If the user is a Spotify subscriber and his/her friend is an Apple Music subscriber, and the Spotify user is sharing the song,
how can I search for the same song in apple catalog? Is there any common ID, like ISRC on Apple Music? Or any other comparison method?
I know how to use search already for songs/albums etc. The question is how to make sure that the result is the same song from spotify. Any ideas?
Thank you!
The ISRC code is certainly the trick here. Here's how to search in either direction:
Spotify to Apple Music
curl -g -X "GET" "https://api.music.apple.com/v1/catalog/us/songs?filter[isrc]=ISRC" -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: Bearer DEVELOPER_TOKEN"
Apple Music to Spotify
curl -X "GET" "https://api.spotify.com/v1/search?q=isrc:ISRC&type=track" -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: Bearer OAUTH_TOKEN"
I wrote more about this on my Medium. Good luck!
Song model for MusicKit does not have ISRC according to the documentation. iTunes EPF has ISRC info, but this is not a part of MusicKit API.
I did something similar with one of my projects, so hopefully it can get you on the right track. In short, you can use the iTunes API alongside the Spotify API to search for the same results.
An example in Python.
Get the current playing song/artist with the Spotify API. Search through the response for the information you want, in my case, it was the artist name and album name.
results = sp.currently_playing()
artist = results["item"]["album"]["artists"][0]["name"]
album = results["item"]["album"]["name"]
Look it up with the iTunes API.
i_artist = itunes.search_album(album, artist)[0]
You'll have to learn how the API's work. With iTunes, a search results in a list of results. I'm taking my chances and just grabbing the first one (the most popular). But you can certainly filter through them to make sure it matches what you want. You'll obviously run into things like artists having the same album titles, or even sharing the same name.
It looks like your target platform is iOS, but my code should be a starting point. It's just a matter of saving the information from one platform into variables, and the searching then next one with them.
Hopefully I understood your question correctly, I can expand or provide more code if needed.

grandstream UCM6104 VOIP PBX phone

I am using grandstream UCM6104.
The system displays list of call start time, call duration, end time.
I want to display the list of number of incoming call and display on
the website which is accessed using the IP address..
How can I do this??
Which api should I use?
You need to work with device's web services which you can access with the local IP address of the grandstream.
Reference:
http://www.grandstream.com/sites/default/files/Resources/GXV_GMI_Web_Service_Guide.pdf
Example.
You can use the following command to do curl from the terminal
To login and get cookies saved of HTTP response
curl -H "Content-Type: text/xml" -D "cookies.txt" "http://192.168.123.127/manager?action=login&username=admin&secret=admin&format=json&jsoncallback=?"
Here, I am using default username(admin) and password(admin) in above command; change accordingly
Here, 192.168.123.127 is the IP address of the grandstream phone
To see phone SIP's information
curl -H "Content-Type: text/xml" --cookie "cookies.txt" "http://192.168.123.127/manager?action=status&format=json&jsoncallback=?"

How Instagram Real Time Subscription works

I am following this link Instagram Real time updates tag - getting empty data, why? to implement Instagram Real Time Subscription.
I am thinking do I need to hit the url every time in order to check the new update, how is gonna work?. Some are using nodejs, socketio,etc, which I dont want to get into this.
What I am trying to achieve through this that every time is a new update, It starts getting analytic automatically without letting my system know which image to mointor.(I already implemented this part), but stuck on the real time.
Any suggestion to that.
You don't need socketio.
https://instagram.com/developer/realtime/?hl=en
You subscribe to something passing an url that will be used for answers
Everytime there is an update instagram will send you a payload to the url you passed during your subscription.
The point of subscription: You create a subscription (you'll give some parameters, client_id, client_secret and the url you want instagram to call when there is an update, check the documentation for details).
curl -F 'client_id=CLIENT-ID' \
-F 'client_secret=CLIENT-SECRET' \
-F 'object=user' \
-F 'aspect=media' \
-F 'verify_token=myVerifyToken' \
-F 'callback_url=http://YOUR-CALLBACK/URL' \
https://api.instagram.com/v1/subscriptions/
Each time the media you subscribed to is updated instagram will send you new data to the urlcallback you provided in the subscription.
I hope it helps you to understand how it works. Read the documentation throghroughly.
you NEED to read the documentation =D From the documentation:
"When someone posts a new photo and it triggers an update of one of your subscriptions, we make a POST request to the callback URL that you defined in the subscription".

Resources