Unable to post inc.com links via LinkedIn's API - linkedin-api

At the moment when trying to post any link from inc.com website via the Linkedin API (OAuth 2.0) it comes back with this error, which looks like LinkedIn are marking it as spam, however I can still post directly within Linkedin.com
Error:
{"message":"com.linkedin.restli.client.RestLiResponseException: Response status 403, serviceErrorMessage: Entity blocked by UCF: {lifecycleState=PUBLISHED, visibility={com.linkedin.ugc.MemberNetworkVisibility=PUBLIC}, specificContent={com.linkedin.ugc.ShareContent={shareMediaCategory=ARTICLE, shareFeatures={hashtags=[]}, shareCommentary={text=Mike Selden and Brian Wyrwas's Biotech Startup Finless Foods Is Making Edible Fish Without the Fish https://www.inc.com/jeff-bercovici/30-under-30-2018-finless-foods.html?cid=hmhero}, media=[{description={text=Cellular agriculture is poised to change the way we eat for the better, and Finless Foods is helping make it happen. }, originalUrl=https://www.inc.com/jeff-bercovici/30-under-30-2018-finless-foods.html?cid=hmhero, thumbnails=[{url=https://www.incimages.com/uploaded_files/image/970x450/finless-founders-panonew_350593.jpg}], title={text=Mike Selden and Brian Wyrwas's Biotech Startup Finless Foods Is Making Edible Fish Without the Fish}, status=READY}]}}, author=urn:li:company:11067858, created={actor=urn:li:member:233207359, time=1524741889593}, origin=API, clientApplication=urn:li:developerApplication:111336, versionTag=1, id=urn:li:share:6395231006479118336, firstPublishedAt=1524741889593, lastModified={actor=urn:li:csUser:2, time=1524741889656}, contentCertificationRecord={\"originCountryCode\":\"us\",\"modifiedAt\":1524741889649,\"spamRestriction\":{\"classifications\":[{\"systemName\":\"MACHINE_SYNC_BAM\",\"modifiedAt\":1524741889649,\"confidence\":\"HIGH\",\"spamType\":\"BADURL_SPAM\"}],\"contentQualityClassifications\":[],\"systemName\":\"MACHINE_SYNC\",\"lowQuality\":false,\"contentClassificationTrackingId\":\"FEF7FB2B21D5009642EF3F20C80ED626\",\"contentRelevanceClassifications\":[],\"spam\":true}}}. exception is: com.linkedin.ucf.integration.BlockedEntityException","status":403}
Any ideas what could be happening here?

This is the linkedin response to this:
this error means this post was marked by users as spam.
You need to open a linkedin zendesk ticket and provide your service request/responses with all the Share URNs involved to them. They will come back with the procedure to continue.

Related

Getting Error while creating audience of CUSTOM type through Marketing API - Facebook

I am using Facebook PHP SDK, and trying to create Audience of Custom TYPE from Marketing API, and I am getting following Error:
You'll need to agree to the Custom Audience terms before you can
create or edit an audience of CUSTOM type. To accept, go to
https://business.facebook.com/ads/manage/customaudiences/tos/?act=129260934125705.
Even though I have already accepted the term, I am still getting the error for accepting the terms.
Please find attached screenshot for Terms Acceptance.. Terms & Condition Accepted Screenshot
I would recommend checking the status of tos_accepted via Graph API explorer. You can also use it to debug your Audience Creation calls.
You can check if a Business has signed their Custom Audience terms of service, by making a GET call to an ad account owned by that Business. The ad account can’t be acting on behalf of another business, or be shared. The GET call is:
GET act_<AD_ACCOUNT_ID>?fields=tos_accepted
A sample response looks like this:
{
"tos_accepted": {
"custom_audience_tos": 1 // this means the terms were signed
},
"id": "act_<AD_ACCOUNT>"
}
Check full docs about TOS here
A bit more info on Custom Audiences
Thanks Artyom Kovalyov.. I have checked the graph API explorer, and this is what I get.
{
"tos_accepted": {
"web_custom_audience_tos": 1,
"custom_audience_tos": 1,
"value_based_custom_audience_tos": 1
},
"id": "act_129260934125705"
}
Please check and let me know if I can do something else to fix the error that I am getting..
It seems ok Vishal. Have you tried to create this same Audience via graph explorer? The ways to go from here are either filing an FB direct support case for your app, they are not usually fast to reply and not every customer is whitelisted for that.
Another assumption is if you try to do it on behalf of your customer with their account, it might be that they have to accept TOS, not you.
FB has a huge amount of setting and from the info, you provide it's pretty hard to tell what exactly fails.

LinkedIn API: fetching our company's posts & profile info

So, I'm making this application, and it's required that it has an embed thingy containing the recent LinkedIn posts as well as basic profile info of the company...
Since I like the Law of Minimum effort, the first thing I saw that made my eyes sparkle was the RSS feed... But it seems like it's been phased out. It just redirects to the company page, period.
Then I realized that we have 2 APIs, v1 being superdead since May.
So, I succesfully generated a v2 access token, keeping in mind that it will have to be renewed every 2 months, but hey, nothing's perfect.
Anyway, I know there's a v1 endpoint that would seem to put me on the right track:
https://api.linkedin.com/v1/companies/{id}:
(id,name,ticker,description)?format=json
However, when I go to the v2 docs (https://learn.microsoft.com/en-us/linkedin/shared/authentication/authorization-code-flow?context=linkedin/context), there's this entire, very detailed section about Authentication, and a section titled "API guide" which talks about "API Concepts" as well as "Best Practices"... but no section detailing just where the endpoints are and how to use them?????
Please, help me, SO, how do I get a company's recent posts as well as basic info like name and pfp?
Thank you in advance.
UPDATE: I have made progress, I think.
I found this: https://learn.microsoft.com/en-us/linkedin/marketing/integrations/community-management/shares/company-pages-migration
And this: https://learn.microsoft.com/en-us/linkedin/marketing/integrations/community-management/organizations/organization-lookup-api
I am making the call and after basically having to guess how to input my token (it must be included as the oauth2_access_token parameter) I get a 403 error DESPITE me being an administrator for the organization I'm looking up.
Call: https://api.linkedin.com/v2/organizations/XXXXXXXX?oauth2_access_token=my-token
Response:
{"serviceErrorCode":100,"message":"Not enough permissions to access: GET /organizations/00000000","status":403}
This makes me think maybe I need to request extra permissions on authentication... but THAT I do not find anywhere (i.e. what the permissions are. I only find really vague stuff with NO details. eg: https://learn.microsoft.com/en-us/linkedin/shared/authentication/permissions?context=linkedin/context)
UPDATE 2: As suggested by #ManvinderSingh I removed the oauth2_access_token param and instead included my token in the Authorization header. This works awesome for the /v2/me endpoint, for instance, BUT still 403's me on the v2/organizations/XXXXXXXX endpoint for an organization that I am an admin of.
As per the documentation https://learn.microsoft.com/en-us/linkedin/shared/authentication/authorization-code-flow?context=linkedin/context#step-4-make-authenticated-requests.
You have to send the token in the Authorization header like this.
Authorization: Bearer {access_token}

How do I get the campaigns list through the ads API on Facebook?

I am trying to get the campaigns list from the Graph API Explorer. I'm using the request found at https://developers.facebook.com/docs/marketing-api/reference/ad-account/campaigns/.
GET /v2.8/{ad-account-id}/campaigns HTTP/1.1
Host: graph.facebook.com
I'm' business manager and admin of the page used for ads. I found the AD_ACCOUNT_IDs using the following request on the Graph API Explorer.
GET /v2.8/me/businesses HTTP/1.1
Host: graph.facebook.com
I choosed the one which had the higher privileges.
The error reported when submitting the first request for campaigns is:
{
"error": {
"message": "Unsupported get request. Object with ID '1015359838XXXXXX' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api",
"type": "GraphMethodException",
"code": 100,
"fbtrace_id": "DLyfwGbM8fi"
}
}
What's wrong?
Thanks in advance,
Mattia
#Ryan's answer saved my day. It may sound stupid/silly but I was doing this mistake and I was just stuck at it.
Going through the FB docs for using the Marketing Apis.
I was trying to build the custom audience, this is how the curl request looks like -
One of the basic things to keep in mind while using the Marketing API is, almost all the APIs ask for these two things -
1) ACCESS_TOKEN
2) AD_ACCOUNT_ID
For people who are just starting with the FB Marketing API or somehow stuck in finding these values, I will just tell you how to get these values, so that you don't have to waste your time as I did.
So for getting the ACCESS_TOKEN, go to your app dashboard then click Add Product and then select Marketing API. Once you added the product, this is how the screen should look like -
Now just check the permissions and click on the Get Token button, a token would be generated. Just copy the token in some file and save it.
Now for getting the AD_ACCOUNT_ID value, just go to the Adverts Manager page -
The number that is written inside the red box in you Adverts Manager page is your AD_ACCOUNT_ID.
The final step would be to go back to you app dashboard again, Settings > Advanced
Click on Ads API and then enter the AD_ACCOUNT_ID here. Thats it, you have finished the Access and Authentication process for using the marketing API via your App.
Now comes the part where I was doing the silly mistake. The curls request looks like this -
curl \
-F 'name=My new CA' \
-F 'subtype=CUSTOM' \
-F 'description=People who bought from my website' \
-F 'access_token=<ACCESS_TOKEN>' \
https://graph.facebook.com/v2.8/act_<AD_ACCOUNT_ID>/customaudiences
First I replaced ACCESS_TOKEN with its value.
Then instead of replacing only the <AD_ACCOUNT_ID> I replaced the whole string act_<AD_ACCOUNT_ID>, with the AD_ACCOUNT_ID value.
So I was getting this error while making request to the API which was -
{"error":{"message":"Unsupported post request. Object with ID '120574219' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at https:\/\/developers.facebook.com\/docs\/graph-api","type":"GraphMethodException","code":100,"fbtrace_id":"YsSvKKwgLMQ"}}
I don't know why I made this mistake but I am sure this is one of the common mistake others are doing too. Since the response from FB was misleading, I wasted a lot of my time in understanding and reading on the API permissions and authentications.
Hope this article was helpful and save your time.
I similarly was having problems trying to retrieve a list of all campaign IDs within an ad account.
I already am able to retrieve campaign data by ID, so I obviously have permissions already.
But the Facebook error message is misleading.
When retrieving an ad account (in order to then display its campaigns or whatever you want within it), you need to retrieve by its ID prepended with 'act_'.
E.g you could request /act_123456789000001234/campaigns instead of /123456789000001234/campaigns.
Thanks so much to #Jan Sommer at https://stackoverflow.com/a/39974857/470749.

Facebook graph api - Unsupported get request

I'm creating a custom module in Drupal, that for part of its functionality must fetch posts from a business page. So for simplicity, I'm using fbapp module as a dependency (drupal.org/project/fbapp), so that I can use it's authentication and request functions (fbapp_app_authenticate() and fbapp_graph_request()) without having to worry about the constant facebook graph updates making my own code obsolete.
I've created a facebook app, so authentication should be app token, using appid and app secret. This seems fine and I'm getting back access_token. However, when I try to read posts from a publicly available page (the clients), I get the response:
"Unsupported get request. Please read the Graph API documentation at https:\/\/developers.facebook.com\/docs\/graph-api"
Here's the queries and responses my code produces:
graph.facebook.com/oauth/access_token?client_id=<redacted>&client_secret=<redacted>&grant_type=client_credentials
array(1) {
["access_token"]=>
string(43) "<redacted>|<redacted>"
}
graph.facebook.com/<page_id>/posts?access_token=<redacted>|<redacted>"
string(183) "{"error":{"message":"Unsupported get request. Please read the Graph API documentation at https:\/\/developers.facebook.com\/docs\/graph-api","type":"GraphMethodException","code":100}}"
Can anyone verify a correct way to query a Facebook page programmatically, perhaps there's a setting in the page I'm querying that I need to set (although I can't find anything)?
If page restrictions apply, the page's feed can only be retrieved with an user access token as far as I know (because FB needs to evaluate the visibility criteria, and setting your app to the same restrictions doesn't help here):
See
https://developers.facebook.com/docs/graph-api/reference/v2.4/page/feed#readperms
It looks like everything you have done is correct. The response you got can be (i am not sure) because you got your clients pageid wrong.

Why am I getting the "The user hasn't authorized the application to perform this action" error when I try to post a video (but not a photo)

I've been successfully posting from my app to user's walls for a couple of years now using the methodology defined here:
https://developers.facebook.com/docs/reference/api/post/
and now I'm switching to posting video (instead of photos) to their walls and suddenly am getting this error:
{"error":{"message":"(#200) The user hasn't authorized the application to perform this action","type":"OAuthException","code":200}}
Presumably the permissions for posting photos and videos are the same (as far as I can tell) so this is almost certainly a red herring error (not unusual for facebook). So, I'm curious if anyone else uses the /post/ method to publish content to the walls of users who have authorized your apps and I'm wondering what I'm doing wrong... After I pull the user's access token (which I have xxxed out below) the rest of my call looks like this:
post/access_token=xxxxxxxxx
&from=MyCompany
&to=user_facebook_id
&title=SomeString
&link=URL_TO_FOLLOW_BACK_FROM_FB
&source=URL_OF_VIDEO_FILE
&name=SOME_STRING
&type=video
&picture=URL_OF_THUMBNAIL
My guess is that I'm missing something in the call, but I can't figure out what it might be.
I guess this is what is different:
Video POST requests should use graph-video.facebook.com
Source: Graph API > Video