I'm using the LinkedIn api and would like to access companies but I'm running into a vague error that I haven't been able to figure out.
I'm using php and the php libracy 'Happyr\LinkedIn\LinkedIn' to access the API. My current application also has the 'rw_company_admin' permission attached to it.
When I make a call to the api endpoint '/v1/people/~:(id,first-name,last-name)', I get the correct response.
But when I make a call to the '/v1/companies?format=json&is-company-admin=true' endpoint I get the following error:
"Invalid company query request"
When I perform the exact same query in the LinkedIn Rest Console, I get the response I'm looking for. Any ideas?
Figured it out after hours of debugging.
The issue will probably be specific to the php package mentioned in the question. The LinkedIn library in use was automatically appending 'format=json' to the query call which sparked an error.
By removing the default output setting in the library, the call worked fine.
In my case, it was related to permissions of the application.
If you want to retrieve company list of the user, you should check rw_company_admin permission in the settings page of the application or give it to scope parameter. Then, you should get a new access token and make requests with it.
Related
I'm building a Facebook application that uses a webhook to read Facebook leads. The application is now working fine: every new lead in my campaigns are sent via the webhook to my script, with the needed information about the lead: ad_id, form_id, leadgen_id and so.
Now, I am trying to get some additional information with the Facebook Graph API based on the ad_id, form_id and leadgen_id and I'm having issues with this. I tried the Facebook Graph API in both PHP curl, and a direct HTTP GET call, and I'm having the same issue in both ways.
When I try to fetch the lead object using leadgen_id, it works fine, and I can get the name, email and phone that I need.
When I try to fetch the form object using form_id, it also works fine, and I manage to get the form name.
But when I try to fetch the ad object using the ad_id (since I need the name of the ad) it gives me the following error: "Unsupported get request. Object with ID '23848043174300142' does not exist, cannot be loaded due to missing permissions".
Currently I have the following permissions (advanced access): pages_read_engagement, pages_manage_ads, pages_manage_metadata, pages_show_list, leads_retrieval, public_profile, ads_management.
Is it an issue with the permissions or with my call?
I tried both PHP curl, and a direct HTTP GET call, and I'm having the same issue in both.
My HTTP GET call to retrieve the ad's name (based on ads_id) is the following:
https://graph.facebook.com/v11.0/ADS_ID?access_token=MY_LONG_TIME_APP_ACCESS_TOKEN
(when I'm replacing ads_id with leadgen_id or with form_id, it gives me the relevant object without any problem).
Thanks,
David
I am sorry if this comes up late, I just had a very similar issue and the solution was to go to the Business Manager then Business Settings > Integrations > Leads access and assign the user that we are using the token for to the corresponding brand.
Facebook explains it here under Note: https://developers.facebook.com/docs/marketing-api/guides/lead-ads/retrieving/
Hope this helps some people.
It seems Facebook is preventing search of a specific term.
As part of a site we are launching, had planned to query Facebook for the term #bestsummerever.
So the request to Graph API using an app access token for public data is the form:
/search/?q=%23bestsummerever
This now gives me the following error:
OAuthException
An unexpected error has occurred. Please retry your request later.
The error is new sometime between last week and this week.
I can query other "hashtags" with no issue, all of the following work:
/search/?q=%23bestsummereve
/search/?q=%23bestsummereverr
/search/?q=%23bestsummer
So it seems like I am strictly being prevented from querying #bestsummerever. This seems to be consistent regardless of what app I make the request with.
There does not seem to be any documented reason for this issue.
Can be reproduced using any app access token on the Facebook Graph Explorer. Really hoping this is some kind of small oversight on my part, but seems more like Facebook has some kind of restriction on that specific term.
First of all, Facebook requires that you provide an User Access Token if you search for obejcts other than places and pages (see https://developers.facebook.com/docs/graph-api/using-graph-api#search).
Apparently there IS some strange behaviour with your desired hashtag:
GET /search?q=%23selfie&type=post
works fine, whereas
GET /search?q=%23bestsummerever&type=post
produces an error. But
GET /search?q=bestsummerever&type=post
works for me. Strange, but maybe you can go on without the hashtag for now.
I've been visiting this forum for years, but this is my first ever question. Any help would be appreciated!
I am writing a web service to pass groups from one application into Facebook and invite the authorised people into them and set a nice pretty cover photo that is generated and stored within the application.
The group creation works splendidly after a fair old bit of head scratching, however, when I try to set the cover image, I am getting a rather useful error message back as below.
OAuth "Facebook Platform" "unknown_error" "An unknown error has occurred."
It's a PHP application on Code Igniter. According to Facebook's delightfully accurate API documentation, this is a simple matter of a cUrl post to 'graph.facebook.com/$groupId' passing the same auth token I just used to create the group and perform the invites and a single JSON encoded parameter of 'cover_url' => $urlOfImage .
A simple task in theory, however, I have spent all day today and a significant chunk of yesterday trying to get this to work without much success.
I have tried posting the image as a Curl object as is necessary in other areas of the Facebook API, and it appears to be trying giving me an error that the image is generating a 404 error (it isn't, when I checked the access logs, it was never requested).
Please be someone out there who has had some success with this.
This has now been fixed by Facebook
Today, after we migrated to the new members permissions api, everything goes wrong.
Im using the cosumer key and secret that i've got from the linkedin api dashboard itself with the oauth token and secret as well.
There is 3 kind of problems that keeps on coming:
first one:
{"errorCode": 0,"message": "Could not find person based on: ~","requestId": "7GPT96SW3C","status": 404,"timestamp": 1369827647671}
second:
<error><status>401</status><timestamp>1369826490661</timestamp><request-id>ZYWPUD43G3</request-id><error-code>0</error-code><message>[unauthorized]. The token used in the OAuth request is not valid. ******</message></error>
third:
com.linkedin.anet.auth.pub.ANetAuthException: other: anetID=*****
has anyone got some of these too? if yes, so how did you solved them?
thanks!
Once you have authenticated the user, you no longer need to make the access token calls - simply store the access token and reuse that for the subsequent requests.
Check are you sending a request once or twice for authentication, there may be the case your token getting replaced by another request.
I've gotten the "401<" and fixed it by correcting the URL which I was formatting incorrectly and consequently requesting a resource that did not exists (reported as unauthorized). You probably have the same issue with your 404 error. Can you please post the specific URLs you are using. That would give a little more insight. Also, make sure that you are not passing params via GET when you should be passing them via POST and that all your POST requests are via HTTPS
I'm using Facebook's PHP SDK, and it's been great so far. However, I have a weird issue on one page. On this page, I make a call to the graph API, then later a call using FQL. On the second call, however, I get an "Invalid OAuth 2.0 Access Token" exception. Why would the token become invalid while the first call worked? I also use FQL (same exact query/code) elsewhere in my site, and it works just fine. Does anyone know what would cause this?
Update: First call is a graph call (/me?fields=email).. second is querying for current user's affiliation, if that helps.
Could be one of several things, but if I had to hazard a guess, I'd say that you're trying to access something out-of-session, and your oauth token doesn't include the offline_access permission for the resource being accessed.
Perhaps some more detail about the nature of your API calls/FQL queries would help us narrow it down.