FQL returning empty response when querying privacy table, probably permissions error - facebook-javascript-sdk

I am doing this query:
SELECT value FROM privacy WHERE id=10203382033336176
Unfortunately Facebook is giving me an empty array as a response. Which permission setting should I request so I can see a current logged user's privacy setting on a specific post?
Edit:
Ok, I tried the FQL Tool on Facebook's developers page and I got this reponse using the same query, same access token:
{
"data": [
]
}
There may be a problem if the post has it's privacy setting set as "Only me"? The FQL shouldn't at least return that ? :D
Scopes requested from the Access Token Debugger:
basic_info, export_stream, public_profile, read_stream, user_friends

Seems like privacy table in FQL is a little bugged. I ended up using GraphAPI, requesting the /"UID_PID" response.privacy['value'] .

Related

Http delete request to Google Directory API returning 412 Precondition is not met: location If-Match

I have been using Postman to send http requests to Google's Directory API. The GET request works fine (which shows that the admin token as well works fine) to get info for a user.
But, what I need to do is delete the user, and when I try this, I get the following back:
{
"error": {
"code": 412,
"message": "Precondition is not met.",
"errors": [
{
"message": "Precondition is not met.",
"domain": "global",
"reason": "conditionNotMet",
"location": "If-Match",
"locationType": "header"
}
]
}
}
I was presupposing that I was missing the etag, which is what I added from the user, but it did not work. I also tried adding "*" to the If-Match tag, and that did not work either. Maybe there is a way with a put or patch request?
The API reference is this: https://developers.google.com/admin-sdk/directory/reference/rest/v1/users/delete
The API does not work on Google's reference page either. I have also tried this in multiple domains where I am the super-admin so the error is not related to a specific super-user or domain.
I have also made sure, in multiple tests, that the user I am trying to delete is not an admin of any type.
I am adding images below to show that the GET api works fine. So I just need to know how to format the API request to be able to delete the user.
Ok, after talking directly to Google and even seeing that Jay Lee (author of GAM) ran into the same problem, we found out that you can't delete a user if:
It has a license of some sort
It's an admin
It has a Google Vault retention rule applied
To be able to delete a user from now on, you must remove all these things (licenses, admin privileges, Vault retention rules) or you must transfer the information of that user to another user (along with whatever else Google asks you to remove beforehand).
The "Precondition is not met" is vague and Google should change this, but it means that one of the three things above have not been removed yet.
Below I am adding multiple links to confirm what I mentioned above as well as the APIs you need to use on users before being able to delete them.
https://groups.google.com/g/google-apps-manager/c/83kR-4MoPk0?pli=1
https://github.com/GAM-team/GAM/releases?gam-releases
https://developers.google.com/admin-sdk/data-transfer/reference/rest/v1/transfers#DataTransfer
https://developers.google.com/vault/guides/holds#python
https://developers.google.com/vault/reference/rest/v1/matters.holds.accounts/list

how to fetch events data from LinkedIn APIs?

I am trying to fetch events data through LinkedIn API, but its throwing this error even I passed access token in my header. One more thing I am using postman to create API calls.
I am using this url to call API:-
https://api.linkedin.com/v2/events
{
"serviceErrorCode": 0,
"message": "Resource events does not exist",
"status": 404
}
I am rather new to working with these complex APIs, please help me
I read some more about it and it's written there that one need some special permissions to use event data ."r_events_leadgen_automation" permission is required. But how to get this permission, there is nothing on the docs about this.
You need to create an app and then request access to the Marketing Developer Platform under the Permissions tab. However, getting this access is not easy. You need to fill out and submit a detailed form asking questions about your business and what you intend to do with the access. And you may need to ask for more access after all. I have never gone that far.
You can find more information here.

Insufficient Privileges when trying to display user photos on external sites

I have this situation. Im trying to display user photos from an external site, all the configurations about remote sites are already set. I created a connected app in org A and from org B i'm retrieving the users from org A.
All of this works however i cannot show the photos from those users because for that to happen i have to be able to use the ConnectApi.UserProfiles.GetPhoto method which i'm doing right now but i keep getting the "insufficient privileges" error. I tried getting the AccessToken through postman like this
This redirects me to the login site so i can log into my org with my credentials. After that i get an AccessToken.
Next up, i want to be able to get the photos from users from the external site with the AccessToken, However i'm still getting the same error message "Insufficient Priviledges". Am i missing something? thanks in advance
According to: https://sforcenotes.blogspot.com/2015/10/solution-to-display-salesforce-user.html?showComment=1596211057195#c5848226245946017759
The solution is fairly easy but this does not work
I'm bit lost. You have some app that wants to log in to Salesforce and pull images from it? Or do you want to call out from Salesforce and pull images from external app? For first one you likely need "connected app". But you need "remote site settings" or "named credentials" only for calling out.
I'm assuming it's option 1.
There are lots of ways to log in to SF, SOAP API (just username + password), REST API (lots of OAuth2 options, with username+pass or username + JWT or just OAuth2 client id and user logs in to SF interactively, you don't see the password)... Sounds like you're past this stage?
A successful login response will look bit like that (depends on method used):
{"id":"https://login.salesforce.com/id/00Dx0000000BV7z/005x00000012Q9P",
"issued_at":"1278448832702",
"instance_url":"https://yourInstance.salesforce.com/",
"signature":"0CmxinZir53Yex7nE0TD+zMpvIWYGb/bdJh6XfOH6EQ=",
"access_token":"00Dx0000000BV7z!AR8AQAxo9UfVkh8AlV0Gomt9Czx9LjHnSSpwBMmbRcgKFmxOtvxjTrKW19ye6PE3Ds1eQz3z8jr3W7_VbWmEu4Q8TVGSTHxs",
"token_type":"Bearer"}
You're supposed to take from it the access_token (that's your session id. It'll always start with org's id, compare with Setup -> Company information) and instance_url (that's where you're supposed to send any subsequent requests. No more calling the login gateways: login.salesforce.com, test.salesforce.com or mydomain.my.salesforce.com). If you're getting "Insufficient Privileges" I think you didn't change the endpoint.
You can test you logged in OK by sending a GET to the id endpoint you received. It'll give you OpenId info about your user.
Here's my GET to fetch OpenId data with the "Authorization: Bearer " request
So another GET with same header and I have my ugly mug:
If you want somebody else's picture - query similar to /services/data/v48.0/query?q=SELECT SmallPhotoUrl, FullPhotoUrl FROM User WHERE Id = '005...' should work. Check User fields.
{
"totalSize" : 1,
"done" : true,
"records" : [ {
"attributes" : {
"type" : "User",
"url" : "/services/data/v48.0/sobjects/User/(redacted)"
},
"SmallPhotoUrl" : "https://(redacted)/profilephoto/7293L0000008Tfq/T",
"FullPhotoUrl" : "https://(redacted)/profilephoto/7293L0000008Tfq/F"
} ]
}
The key thing is to use the new endpoint and pass the session id in the header. You might even find it easier to use Chatter API to pull photos (also REST-based)

Weibo error 20112 when attempting to access a user's post

I'm attempting to get a user's Weibo post with 2/statuses/show. I'm able to get posts made by my own account fine, but when I try to get another user's post I get the error:
{"error":"Permission Denied!","error_code":20112,"request":"/2/statuses/show.json"}
The Weibo docs say (via google translate):
20112: As the author privacy settings, you do not have permission to view this microblogging
Does this mean the author of the post needs to update their permissions to allow the developer account access?
I also encounter this issue. However, you can still access the post using its user_id and mid (in base62). For instance, you cannot get this post from the API (its id is 10031139424) but you can still see it from your webbrowser.
An alternative is to get the post from its mobile url. Then, you can get its json which is contained in the variable render_data from the body of the html.
Any posts can be setted to be unvisible but for microblogger himself or trusted groups.
So privacy settings lead to your problem.

LinkedIn API - get information about my ALL Connections

I have used Facebook API but I am new to Linkedin api.
I need some help on how to get information (name, birthday, etc) about my ALL Connections, and I need help with both the token and the info-related API calls.
As for the token -- in Facebook there is the Facebook Console to generate tokens at runtime and test our API calls... Does LinkedIn have something similar?
Update: I'm able to get list of connections using:
http://api.linkedin.com/v1/people/~/connections?modified=new
... but how can I also get birthdates (if shared publicly)? I've attempted:
http://api.linkedin.com/v1/people/~/connections:(headline,first-name,last-name,date-of-birth)
...however, that shows me the first and last name but NOT the date of birth.
You can use the rest console here: http://developer.linkedin.com/rest-console
There is a template method you can use called "Get My Connections".
I hope this helps.
Update: LinkedIn has restricted their open API access, and this no longer works.
https://apigee.com/console/linkedin
Select OAuth2, click connect, then allow LinkedIn to privede apigee to your LI profile. Then in the left collumn, select Get My Connections. apigee prepares most of params, except format (xml/json), which you can add yourself.
Looks like now no such API available(Looks like depricated by Linkedin). Please let me know if i am wrong and suggest other ways to achieve user's connections.
I am getting this in response
{
"errorCode": 0,
"message": "Access to connections denied",
"requestId": "6Sxxxxxxx",
"status": 403,
"timestamp": 14xxxxxxxxx
}
Please see : https://developer.linkedin.com/support/developer-program-transition
I think what you are looking for, is the Linkedin Connections API. You can look at the documentation provided here -> http://developer.linkedin.com/documents/connections-api
There are also various other APIs for accessing profile, groups, companies, and jobs.
It returns an XML document so, you should be able to generate tokens and test your API calls without any problem.
These APIs are no longer available
2019 still works but with a different approach.
Do this:
You may follow the steps from here:
https://learn.microsoft.com/en-us/linkedin/shared/authentication/authorization-code-flow?context=linkedin/consumer/context
1 - Create an APP with r_1st_connections permission
2 - Authorization (STEP 2 from link)
GET https://www.linkedin.com/oauth/v2/authorization
scope should be r_1st_connections (your app must have this permission)
3 - Log in with your username and password
4 - Linkedin will return you code
something like: ?code=QWERTY
5 - Get your Access Token (STEP 3 from link)
POST https://www.linkedin.com/oauth/v2/accessToken
6 - Get your connections
GET https://api.linkedin.com/v2/connections?q=viewer&start=0&count=50
Link: https://learn.microsoft.com/en-us/linkedin/shared/integrations/people/connections-api?context=linkedin/compliance/context