Asset upload fails on LinkedIn API - linkedin-api

I am currently trying to upload an asset to LinkedIn as per the instructions here: https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/share-on-linkedin?context=linkedin/consumer/context#create-an-image-share.
I am requesting and granted the following permissions during signup:
w_share%20rw_company_admin%20r_liteprofile%20r_emailaddress
But for some reason I am getting:
Not enough permissions to access: POST-registerUpload /assets
I'm pretty sure I do have permissions!! Its v2 of the LI API. Does anyone know what would be causing this?

For anyone else struggling with this - there is a NEW LI permission w_member_social which must be included even though it isnt listed within the APP permissions area.

Related

Facebook - Custom audience deleting users issues

I could successfully able to push users into custom audience in facebook in this endpoint - https://graph.facebook.com/v5.0/audienceid_goes_here/users
Now I need to delete the user from the custom audience. I tried with the same endpoint but am getting OAuth "Facebook Platform" "invalid_request" "Permissions error"
Have provided all admin permissions under business settings to systems users and granted all access. Still not sure how to make this work. Am I missing anything?
Any help would be greatly appreciated
Below is the code that I tried
Endpoint - https://graph.facebook.com/v5.0/audience_id_goes_here/users
Method - DELETE
payload={
"schema": [
"EMAIL_SHA256"
],
"data": [
[
"hashed_email_goes_here"
]
]
}
Incase anyone is facing the same issue, below is some of the workaround I did.
Tried the delete users from audience using facebook explorer - https://developers.facebook.com/tools/explorer
This gives clear error of why it failed. In my case it was due to this message You cannot remove users from this audience because it will result in a low audience size. but the error from API in my code was still giving me Permissions error.
After checking from fb explorer i got the clear error message.
So there is no resolution for this and its a valid error message as mentioned here - https://developers.facebook.com/support/bugs/2093728693993530
Custom Audiences must maintain a certain minimum size, though the
specific number is not actually documented. I believe the required
minimum is approximately 100 unique users. If you need to remove so
many users that you're going under this limit, I'd recommend deleting
the custom audience entirely.
Hope it helps someone

Empty response to API call to Facebook Graph

I have been hammering away at this problem for the last day. I really hope someone can help me out. I would be very grateful.
What I am trying to do is fetch event data from a Facebook Page. I looked over the documentation, which says this about reading Pages data:
Reading
A Facebook page
Permissions
For pages that are published, you need:
An app or user access token to view fields from fully public pages.
So what I did was I obtained an app access token via:
GET https://graph.facebook.com/oauth/access_token?
client_id=YOUR_APP_ID
&client_secret=YOUR_APP_SECRET
&grant_type=client_credentials
which then returned
access_token=MY_APP_ID|MY_APP_ACCESS_TOKEN
After this I followed the documentation and made the following call
https://graph.facebook.com/v2.4/129511477069092/events?fields=id,cover,name,venue,description&access_token=MY_APP_ID|MY_APP_ACCESS_TOKEN
This returned:
{
"data": [
]
}
So after some fiddling around I was able to make the call by switching to version V2.2 and by creating an access key with Facebook API Graph explorer tool(no permissions granted).
GET https://graph.facebook.com/v2.2/129511477069092/events?
fields=id,cover,name,venue,description&
access_token=ACCESS_TOKEN_FROM_FACEBOOK_API_EXPLORER_TOOL
The page I am trying to retrieve data from is public and so are the events, so I can't figure out what is going on. I know I am super close since I am able to retrieve the data with the token provided by the Facebook API Graph Explorer Tool. The thing with using this token is that it only last a few hours and I need something that is going to last longer such as an app access token. I have done some research on Stackoverflow and found similar questions, but none of them solve my problem. Any help will be appreciated to the max! Thanks.
Looks like a bug of v2.4 to me. It works with v2.3 if you remove the deprecated venue field:
https://developers.facebook.com/tools/explorer/145634995501895/?method=GET&path=129511477069092%2Fevents%3Ffields%3Did%2Ccover%2Cname%2Cdescription&version=v2.3
If the version is changed to v2.4, it returns an empty result.
https://developers.facebook.com/tools/explorer/145634995501895/?method=GET&path=129511477069092%2Fevents%3Ffields%3Did%2Ccover%2Cname%2Cdescription&version=v2.4
There's no documentation about this in the changelog at
https://developers.facebook.com/docs/apps/changelog#v2_4
so I guess it's a bug. There's already a bug report at
https://developers.facebook.com/bugs/443054055873667/
with status assigned. If you have an app that supports v2.3, I'd suggest you prefix your request like this:
GET /v2.3/129511477069092/events?fields=id,cover,name,description

Can you use the Facebook API to delete old posts?

I am new to using the Facebook API and just started playing around with it.
I was wondering if it is possible, for example an app, to delete past posts (that exists on the timeline, i.e, Can an app have the functionality to delete posts that exists before the app was started?)
Thanks.
Looking at the relevant documentation, you are able to delete a post only if it was your application that created it.
An app can delete a post if it published it
You have not stated which language/SDK you are using, but the above link has examples for each supported SDK.
Here is an example using the PHP SDK:
$response = $facebook->api(
"/{post-id}",
"DELETE"
);
What you would need to do is make a DELETE request to /post_id.
Keep in mind that you will need the publish_actions permission to perform this action.
This is tricky - the answer is yes and no.
You can use the API to get a list of old posts, but then you need to delete them via the browser. This tool does just that:
https://github.com/chander/social-network-cleaner
However, it's written in Python and requires a bit of tech know-how.
This is possible now
Delete a Post
To delete a Page post, send a DELETE request to the /{page-post-id} endpoint.
Before You Start
You will need the following:
The pages_manage_posts permission
The pages_read_engagement permission
A Page access token requested by a person who is able to perform the CREATE_CONTENT task on the Page that is being queried
Sample Request
curl -i -X DELETE "https://graph.facebook.com/{page-post-id}
?access_token={page-access-token}"
On success, your app receives the following response:
{
"success": true
}

Policy file error while loading new profile pictures from Facebook

As you might know, for loading images from Facebook in our application (in my case AS3) we have to load following policy file:
Security.loadPolicyFile('https://fbcdn-profile-a.akamaihd.net/crossdomain.xml');
otherwise we get following error:
SecurityError: Error #2122: Security sandbox violation: Loader.content: http://test cannot access http://profile.ak.fbcdn.net/v22941/254/15/q652310588_2173.jpg A policy file is required, but the checkPolicyFile flag was not set when this media was loaded.
you can find related question here.
I have a Facebook application that is running for long time without problem, but what I am facing today which is bizarre, is that the application gives the same security error message while loading NEW PROFILE PICTURE, and for the profile pictures that have been uploaded about 2-3 weeks ago or earlier, there is no problem.
My question is that did Facebook change its policy? Is it a problem form my side or something is wrong from Facebook? I have googled to see if the Facebook's policy or something else has been changed, but I did not found any clue.
If you go to https://fbcdn-profile-a.akamaihd.net/crossdomain.xml you will see that it returns an error (403 Forbidden: You don't have permission to access /36477/crossdomain/pics-crossdomain.xml on this server) so Flash never gets a valid crossdomain file.
This is an issue that Facebook needs to address.
I know of no way to have Flash ignore crossdomain errors.

API Error Code: 191 (using ASP.Net)

Guys here is my configuration for my facebook app, please tell me if I'm missing anything:
Basic Info-------------
App Namespace: footygo
App Domain: footygo.com
Website----------------
Site URL: http://www.footygo.com
App on Facebook-------
Canvas URL: http://www.footygo.com/canvas/
Secure Canvas URL: https://www.footygo.com/canvas/
Canvas Page: http://apps.facebook.com/footygo
My application contains a folder named Canvas/ which contains all the facebook pages. The Canvas folder contains two files at the moment, namely: Default.aspx and Setup.aspx
Within my web.config file, I have set the following information:
PostAuthorizeRedirectURL="Setup.aspx"
I also tried varying with PostAuthorizeRedirectURL="Canvas/Setup.aspx" to no avail.
I am consistently getting the following error message:
API Error Code: 191
API Error Description: The specified URL is not owned by the application
Error Message: redirect_uri is not owned by the application.
What is the issue? Do you guys have any ideas? This is my first facebook app, and it's not working out as I thought it would :(
Thank you for your time and patience, and sorry if this question has already been posted numerous times. I went through most (but not all) of the 191 error questions but couldn't find anything of value.
Please let me know if you have any idea about what's going on. My release date is less than 24 hours away!
Humble Regards,
Rowan R.
You need to use the full URL. The redirect_uri must be within the same domain name as what is listed in the settings in Facebook.
PostAuthorizeRedirectURL="http://www.footygo.com/canvas/Setup.aspx"
Thanks for your reply Adam!
However I figured out what was wrong and got it to work! It wasn't the PostAuthorizeRedirectURL, it was actually the URL I was using to access my app!
I was accessing my app using https://apps.facebook.com/xxxxxxxxx where xxxxxxx is my app's id. That did not work (at first). I then tried accessing my app using it's app name, i.e. https://apps.facebook.com/xyz and it worked!
All I can say is... the facebook platform sucks.