Instagram API returns only 4 likes data - instagram-api

I'm using the Instagram API to fetch images with a certain hashtag that have been liked by my organization. But when the API makes the get call, the response comes back with data like this, where the like count is 83 (!) and the actual like data returned only shows 4 (!). I've seen postings here that indicate that Instagram returns about 120 data for likes. How come I'm only getting four?
The api call I'm using is:
https://api.instagram.com/v1/tags/mytag/media/recent/?client_id=myclientID
"likes": {
"count": 83,
"data": [
{
"username": "something",
"profile_picture": "picture",
"id": "idhere",
"full_name": "namehere"
},
{
"username": "",
"profile_picture": "",
"id": "",
"full_name": ""
},
{
"username": "",
"profile_picture": "",
"id": "",
"full_name": ""
},
{
"username": "",
"profile_picture": "",
"id": "",
"full_name": ""
}
]
},

When you fetch medias from Instagram using these endpoints:
/users/<user-id>/media/recent
/tags/<tag-name>/media/recent
You wouldn't have all likes in the response; same for comments. It's just limit set by Instagram. I think it might be really expensive to return all (or a lot) likes/comments in each media users fetch.
But don't worry, If you get medias you want, you will have their id and you could use this endpoint:
/media/<media-id>/likes
And then you will have all likes (use pagination to fetch them all) and do a great stuff with them.
Hope it helps you.

This could be three things:
1) A bug, but that's unlikely (ha a pun!)
2) Pagination. You need to ask for more data in another call with MIN_TAG_ID and/or MAX_TAG_ID set.
3) Privacy. Instagram users have privacy settings on their profiles. Described here. This would definitely lower the count even with pagination.

Related

Expecting two different responses, accepting one?

I have a similar problem to this one: Two Different Response in Retrofit
However, both things that I've tried have not worked. I'm new to this and can't seem to find any other sources that are of use. I'm so so sorry if this is a dumb question, but I've been struggling with this for a week now.
Important information: I am coding in Jetpack Compose and using Retrofit2. To test data calls, I am using postman.
Success Response: [ Info changed for identification purposes, it responds with actual user data ]
{
"data": {
"id": 0,
"name": "First Last",
"first_name": "First",
"last_name": "Last",
"email": "name#yup",
"is_verified": true,
"created_at": 1666202587,
"meta": {
"image": "avatarImage",
"username": "",
"rng": " ",
"date_of_birth": null,
"city": null
}
},
"token": "correct token"
}
Error Response:
Error response
Data class:
Data class
In my first attempt, I made two data classes and split up the different responses. However, that just led to them both being null regardless of what I input. Once I moved them to once data class, it allows the user to sign in just fine, but the error is never caught and instead just crashes my app.

How to get the user information using the user lookup ID from fields property when accessing items from a share-point list using Ms Graph API

I am accessing a Share-point list using the MS graph API endpoint:
https://graph.microsoft.com/v1.0/sites/{site-id}/lists/{list-id}/items?expand=fields
I am getting the list items just fine, but I also want to get the user information attached in each field. The data item returned looks like this:
{
...other properties,
"fields": {
"#odata.etag": "\"eTag,1\"",
"id": "1",
"ContentType": "Item",
"Title": "<Some Title>",
"Modified": "<modified dateTime>",
"Created": "<created dateTime>",
"AuthorLookupId": "12",
"EditorLookupId": "12",
"_UIVersionString": "1.0",
"Attachments": false,
"Edit": "",
"LinkTitleNoMenu": "<num>",
"LinkTitle": "<num>",
"ItemChildCount": "0",
"FolderChildCount": "0",
"_ComplianceFlags": "",
"_ComplianceTag": "",
"_ComplianceTagWrittenTime": "",
"_ComplianceTagUserId": "",
"Status_Name": "<status_name>",
"Title0": "<some_title>",
"Dept": "Dept A",
"Emp_LeadLookupId": "200", //This is the user whose details I need(email-id)
"Quality_Approver": "<some_user>"
}
}
How do I get the user's details as well and not just a LookupId, OR how can I use the look up ID to get the said user's information?
I searched above and beyond but didn't find anything relevant. Any help is greatly appreciated!
Currently Microsoft Graph is not support the function of finding users through the lookup column.

Issue on Docusign Admin Api getUserProfile

Hi I am facing an issue while loading the endpoint point /v2/organizations/{organizationId}/users/profile
I am getting a 404 error
Attached below screenshots for the postman response and getting organisationId
The correct baseUrl for demo Admin API is https://api-d.docusign.net/management/v2/
Try to change that and see if that works.
In order for that endpoint to work you're going to need to provide some additional parameters in the URL. For retrieving a user's profile directly, you should be able to use:
https://api-d.docusign.net/management/v2/organizations/{OrgID}/users/profile?email=useremail#example.com
The result looks like this:
{
"users": [
{
"id": "28fbe7e4-xxxx-xxxx-xxxx-c26569aa827c",
"site_id": 1,
"site_name": "Demo",
"user_name": "Matt_SATest_1",
"first_name": "MattSAT_1",
"last_name": "K",
"user_status": "active",
"default_account_id": "70da9c0c-xxxx-xxxx-xxxx-7b3d6733328e",
"default_account_name": "Matt K",
"is_organization_admin": false,
"created_on": "2020-08-25T20:38:57.533",
"memberships": "",
"identities": "",
"is_device_verification_enabled": true
}
]
}
To retrieve a list of users for an org, you should be able to use:
https://api-d.docusign.net/management/v2/organizations/{OrgID}/users?URLParameters.
The URL parameters for this particular call require one of the following: account_id, organization_reserved_domain_id, or email. You're required to use at least one, but you should also be able to use more than one parameter at a time.
The result looks something like this:
{
"users": [
{
"id": "28fbe7e4-xxxx-xxxx-xxxx-c26569aa827c",
"user_name": "Matt_SATest_1",
"first_name": "Matt",
"last_name": "K",
"user_status": "active",
"email": "email#example.com",
"created_on": "2020-08-25T20:38:57.533"
}
],
"paging": {
"result_set_size": 1,
"result_set_start_position": 0,
"result_set_end_position": 0,
"total_set_size": 1
}
}

How to delete specific object under document in DocumentDB?

I am using documentDB as backend for my project.
I have created a collection named ResellerCollection.
Under it I added document as Reseller with Id's assign to it.
Now under Reseller document I have added a list of Customer and now I wanted to delete customer of reseller document by specific Id.
My JSON generated in documentDB is as follow.
{
"id": "73386791-5895-4a56-9108-df4a773331fe",
"Name": "Nadeem",
"PrimaryContact": "1234",
"Address": "bhusari clny",
"City": "pune",
"State": "maharashtra",
"Country": "india",
"ZipCode": "222",
"Telephone": "45234343",
"Email": "abc#xyz.com",
"Website": "asdfsd.com",
"Customer": [
{
"id": "4acf3ca9-f9e4-4117-a471-7ce8f905baec",
"FullName": "Test Cust1",
"Company": "safds",
"JobTitle": "sadf",
"Email": "abcd#xyz.com",
"Address": "asdfsaf",
"City": "sdf",
"State": "sdf",
"Country": "sadf",
"ZipCode": "2343",
"Telephone": "45234343",
"MerchantID": "232",
"IdentificationNo": "2342343",
"IsActive": true,
"CustomerGroupID": "34",
"ResellerID": "73386791-5895-4a56-9108-df4a773331fe"
},
{
"id": "e0d6d099-3d5d-4776-9b84-14b7ae0b9911",
"FullName": "Test Cust2",
"Company": "safds",
"JobTitle": "sadf",
"Email": "abcd#xyz.com",
"Address": "asdfsaf",
"City": "sdf",
"State": "sdf",
"Country": "sadf",
"ZipCode": "2343",
"Telephone": "sadf",
"MerchantID": "232",
"IdentificationNo": "2342343",
"IsActive": true,
"CustomerGroupID": "34",
"ResellerID": "73386791-5895-4a56-9108-df4a773331fe"
}
],
"UserId": "f807f027-2e21-45b1-b786-e4d2b3d677cb",
"_rid": "+JBQAOQWHQENAAAAAAAAAA==",
"_self": "dbs/+JBQAA==/colls/+JBQAOQWHQE=/docs/+JBQAOQWHQENAAAAAAAAAA==/",
"_etag": "\"0a004764-0000-0000-0000-583bd8b50000\"",
"_attachments": "attachments/",
"_ts": 1480317104
}
Please suggest me how to write delete function for customer in MVC. Whether I should write delete for it to delete specific customer or whether I have to update the whole customer list?
Two ways of doing this.
Implement "AddCustomer" and "RemoveCustomer" stored procedures in DocumentDB. These stored procedures will read the reseller document, then append or remove the new customer passed in as argument. Then just call ExecuteStoredProcedureAsync within your controller.
Instead of the stored procedure approach, perform three steps within the controller. Read the document, make changes, and replace the document.
In both implementations, you'll probably want to use the ETag to perform a conditional write to avoid any clobbering across multiple clients/writers.
As Larry and David pointed out, you should also consider different JSON modeling options such as storing the customers data as separate documents, or by storing only the IDs within the array vs. all relevant customer data.
The only way to delete an element of an array (or any other change to the document) is to fetch the entire document, modify it, then create/upsert the entire document. You can do this client-side or in a stored procedure.
Try not to think of collections as tables in traditional databases or collections in MongoDB. I used to say, think of them as "partitions" but with partitioned collections, even that distinction is not useful. I use a single partitioned collection for everything now. I distinguish document types by having an element in each document: isReseller = true or isCustomer = true for your example. Alternatively, you can do type = 'Reseller' or type = 'Customer'. However, if the customer of one reseller is ever a reseller themselves, the former will allow you to add both is___ = true and the latter will not.
What David Makogon says is definitely a worry. Unless Resellers are restricted to a small number of Customers, you are better off storing them separately and having a foreign key link them. That way, deleting or adding one is a single step. However, getting the Reseller and all its Customers will be two round trips.

How many bytes are in a Location ID from the Instagram API?

I cannot find any decent documentation on the Instagram API about this. I know it returns a number through the API which is usually a 2^32 bit int, but once in a while I will get a number that is 2^64. I want to store these numbers in my Cassandra database, but I am not sure if I should store them as Int(2^32) or BigInt(2^64) or even text.
What are your thoughts?
Based on the Instagram API, id's (whether for a User, Media, Location, etc) are returned as strings (as opposed to the float values for "latitude" and "longitude" or the int values returned for fields like count):
{
"data": [{
"id": "788029",
"latitude": 48.858844300000001,
"longitude": 2.2943506,
"name": "Eiffel Tower, Paris"
},
{
"id": "545331",
"latitude": 48.858334059662262,
"longitude": 2.2943401336669909,
"name": "Restaurant 58 Tour Eiffel"
},
{
"id": "421930",
"latitude": 48.858325999999998,
"longitude": 2.294505,
"name": "American Library in Paris"
}]
}
It may be best to store them as text in Cassandra.

Resources