how can I get mutual followers between two accounts? - instagram

I'm trying to see how many mutual followers instagram influencers have.
I was trying to achieve this goal by getting last 10000 followers and compare it with their Grahpl API but there's a rate limit so I'm stuck on this. would there any way to do it or any other paid service for this?
await axios({
method: 'get',
url: 'https://www.instagram.com/graphql/query',
headers: {
cookie: cookie
},
params: {
query_hash: 'c76146de99bb02f6415203be841dd25a',
variables: `{"id": "${id}","include_reel":true,"fetch_mutual":false,"first":100, "after": "${after}"}`
}
})

Related

Spotify API POST Request - Add Tracks to Playlist: Items Not Added In Order

This is my fetch request code: (which works fine BUT the songs are not added in the order that they are in in the trackIdArr state).
// Add tracks to playlist
await fetch(
`https://api.spotify.com/v1/playlists/${playlistId}/tracks`,
{
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${token}`,
},
body: JSON.stringify({ uris: trackIdArr }),
}
);
Spotify API doc reads:
If [position query is] omitted, the items will be appended to the playlist. Items are added in the order they are listed in the query string or request body.
How can I fix this? I have tried using for of loop, axios, adding a position parameter but it seems as though since it is an async await request, the items would not be added in order. So, why does spotify claim that it would? Am I doing something wrong? Thank you!

Not receiving Microsoft Graph change notification

I'd like to subscribe to user deletions, so that whenever a user is deleted in Azure AD, our app can react accordingly.
Here's my subscription request:
const now = new Date();
const threeDaysLater = new Date(now.getTime() + 3 * 24 * 58 * 60 * 1000);
request.post({
auth: {
bearer: {...},
},
headers: {
Accept: 'application/json',
},
json: {
changeType: 'updated,deleted',
clientState: {...},
expirationDateTime: threeDaysLater.toISOString(),
notificationUrl: 'https://{...}.ngrok.io/api/azure/webhook',
resource: 'users',
latestSupportedTlsVersion: 'v1_2',
},
url: 'https://graph.microsoft.com/v1.0/subscriptions',
});
After sending this request, I receive a request to my notificationUrl, which I respond back to with the validation token.
I then receive the following response from the initial request:
{
'#odata.context':
'https://graph.microsoft.com/v1.0/$metadata#subscriptions/$entity',
id: {...},
resource: 'users',
applicationId: {...},
changeType: 'updated,deleted',
clientState: {...},
notificationUrl: 'https://{...}.ngrok.io/api/azure/webhook',
expirationDateTime: '2020-03-22T11:52:36.328Z',
creatorId: {...},
latestSupportedTlsVersion: 'v1_2'
}
However, when I actually go into Azure AD and delete users, I never receive any requests to my endpoint... Any ideas what I'm doing wrong here?
I've seen Not receiving a request on our MS Graph Webhook for deleting a User in AAD, but I've both waited 30 minutes, and tried soft + hard deletes. Neither seems to trigger any sort of request to my endpoint.
Okay, so apparently I was just not being patient enough. It can take hours for MS to send these notification requests.
If you're developing your webhook endpoint, and looking to test/debug it, do the action in Azure AD, then do something else for a few hours until you finally get the request. 🙄

How to send FCM push notification to multiple devices using google apis?

I want to send push notification to multiple devices at once. Can i pass array of tokens?
Is it possible to do using google api? Please help me with this.
request(
{
method: 'POST',
uri:
'https://fcm.googleapis.com/v1/projects/projectId/messages:send',
headers: {
'content-type': 'application/json',
Authorization: `Bearer ${token}`,
'apns-priority': 'high',
content_available: true
},
body: {
message: {
token: token,
notification: {
body: 'This is an FCM notification message!',
title: 'FCM Title'
},
android: {
notification: {
sound: 'default'
}
}
}
},
json: true
},
async function(error, response, body) {
if (error) {
console.log(error);
}
console.log(body);
}
);
If you want to make the POST requests by yourself, you can prefer to:
1) Use the legacy HTTP server protocol. With that you will be able to use the "registration_ids" field which expects an array of token strings in POST body. Docs here.
2) Stick to HTTP v1 API that you're using right now, but since "token" field is expecting only string, you can first subscribe your users to a specific topic and use that topic in "topic" field in POST body.
Additionally, you may prefer to use Admin SDK to send batch notifications. You can check for further here.

How to authenticate at MongoDB Atlas API using digest authentication?

I want to get a list of projects in MongoDB using its API "https://cloud.mongodb.com/api/atlas/v1.0/groups" but every time I get error as "401 You are not authorized for this resource".
According to the docs digest authentication is used.
Seems like I am passing the Private_key and Public_key in the wrong way.
Below is my request object
{
url: 'https://cloud.mongodb.com/api/atlas/v1.0/groups',
method: 'GET',
headers: {
'Accept': 'application/json',
},
auth: {
user: 'Public_Key',
pass: 'Private_key'
}
}
Can anyone please help me with this.
What you are missing is the key "sendImmediately". You need to send it in your auth object as follows :
request({
method: 'GET',
auth: {
"user": Public_Key,
"pass": Private_key,
"sendImmediately": false
},
url: 'https://cloud.mongodb.com/api/atlas/v1.0?pretty=true'
})

Foursquare API - can't get User (my own) check in history

I have been referencing this https://developer.foursquare.com/docs/api/users/checkins
to try and download my own check in history.
I was able to get their own example from the "getting started" page to work:
const request = require('request');
request({
url: 'https://api.foursquare.com/v2/venues/explore',
method: 'GET',
qs: {
client_id: 'CLIENT_ID',
client_secret: 'CLIENT_SECRET',
ll: '40.7243,-74.0018',
query: 'coffee',
v: '20180323',
limit: 1
}
}, function(err, res, body) {
if (err) {
console.error(err);
} else {
console.log(body);
}
});
When I tried to change this to get my own checkins by replacing the url above this endpoint, https://api.foursquare.com/v2/users/USER_ID/checkins, it gives me an error requiring a version (even though it's not in the parameters docs).
I've left in the v param from the example and get this error: "A user is required to call this endpoint." I have also tried changing the URL because some examples online had this/the docs say regarding the userid: "For now, only self is supported" I tried replacing the USER_ID with my userid and also tried this: https://api.foursquare.com/v2/users/self/checkins, but it gives me the same error.
qs: {
client_id: 'CLIENT_ID',
client_secret: 'CLIENT_SECRET',
v: '20180323',
user_id: 'userid' //tried with self, tried without it
}
I don't care about getting this to work as much as I do being able to download my own foursquare data. The link that I was able to use about 5 years ago is no longer supported.
You can not use client_id and client_secret parameters in this API (User Auth API). Try the following parameters:
qs: {
oauth_token: 'OAUTH_TOKEN',
v: '20180323',
user_id: 'self'
}
How to get oauth_token
https://developer.foursquare.com/docs/api/configuration/authentication

Resources