I am using the Linkedin API OAuth 2.0 API and trying to like post/comments using the new OAuth 2.0 API.
The following example below shows an POST request to following endpoint:
POST https://api.linkedin.com/v2/socialActions/{commentUrn}/likes
https://api.linkedin.com/v2/socialActions/urn:li:share:543222277889832/likes
with the following POST JSON body
{
"actor": "urn:li:person:0XV6h162Ub",
"object": "urn:li:share:543222277889832"
}
and I get the following result
{
"message": "Unable to obtain activity for urn: 'urn:li:share:543222277889832'",
"status": 404
}
https://learn.microsoft.com/en-us/linkedin/marketing/integrations/community-management/shares/network-update-social-actions#create-a-like-on-a-comment
I am unsure how the urn's work - how do I find the relevant urn for a particular person (as illustrated in the 'actor' below) and the object the Linkedin API documentation seems rather confusing.
Thanks in advance
Maybe the post is not processed by LinkedIn when you make a comment request. You should ask the post status before. If it's ok, launch the comment request.
Related
I'm trying to fetch LinkedIn company page posts using the LinkedIn API. I created my app with permissions set up, and I verified the company. Then I used this URL for which I created an authorization token:
https://www.linkedin.com/oauth/v2/authorization?response_type=code&client_id=xxxxxxxxxxxxxxxx&redirect_uri=https//linkedindata.cresol.in&state=foobar&scope=r_liteprofile%20r_emailaddress%20w_member_social
and using this API:
https://www.linkedin.com/oauth/v2/accessToken
I got the accessToken and then used this in the Header like this:
Authorized :
Bearer AQUau_EPV1RVuoclp2BXRGBXjvDDCS2fsULTeNDBD5xmRohRW3q7nbVu9FFfeeucPUYCnGub1erfCu1IUF66QJhW5JxpiTx160vZwWHjwdeykm33vOmGFr1avSRCBPDYlZS ....
It's working fine for this API:
https://api.linkedin.com/v2/me
I get the proper response.
But once I used the same thing in another API, like
https://api.linkedin.com/v2/shares?q=ownersowners=urn:li:organization:82091933&sortBy=1&sharesPerOwner=100
I get this error response:
{
"serviceErrorCode": 100,
"message": "Not enough permissions to access: GET-owners /shares",
"status": 403
}
How to find the Listing of all posts of my company page?
What are the right endpoints and API for this?
First did you grant all permission before getting the Bearer token?
Second to get posts of an organization try this endpoint
POST https://api.linkedin.com/v2/posts?author={author}&isDsc=false&q=author&count=10
{author} = You need the organization id, and the max count is 100
Don't forget to add 'X-Restli-Protocol-Version: 2.0.0' at the header
Please check this link for more details LINKEDIN DOCS.
I am trying to send a request to travelpayouts hotel search API, Two days ago I have been trying to get a result using the postMan program but a message appears that there is an error in the signature, although I followed the same instructions mentioned in the documentation for the API, if someone used this API before that please ask me to help me
Api link that I have used
Error message:
{
"message": "Invalid signature",
"status": "error",
"errorCode": 3
}
You could send your signature string to support#travelpayouts.com and mention a link to this question on SO, and we'll take a look at it and suggest how to make it work. As the signature string has your API token, it's better not to post it here.
I am looking to write a simple "Hello world" application using Google OAuth 2.0, however I have tried all 10 of the first 10 Google hits for "Google OAuth 2.0 tutorial", and for each of them, I followed all of the steps exactly as they were written, but none of them worked. In all of the tutorials, I get as far as submitting a POST request to https://www.googleapis.com/oauth2/v4/token using the values for "code", "client_id", "client_secret", "grant_type" and "redirect_uri" as specified exactly in the tutorials, which is supposed to obtain an access_token and a refresh_token if the directions are correct. But then when I submit the request I get the response:
error "invalid_grant"
error_description "Bad Request"
Some of the tutorials have screen captures from Google's UI which are out of date, so it may be that Google made a subtle change which invalidated the old directions.
Rather than copying and pasting the directions from each of the tutorials, so we can go over each one with a fine-toothed comb to figure out what went wrong, it seems more straightforward to just ask: Does anyone have complete and correct directions for an OAuth 2.0 "Hello world" app, to get up to the point where an access_token and a refresh_token are returned by Google?
Here is the google oauth2 discovery url.
https://accounts.google.com/.well-known/openid-configuration
And in the response, it looks like this
{
"issuer": "https://accounts.google.com",
"authorization_endpoint":"https://accounts.google.com/o/oauth2/v2/auth",
"token_endpoint": "https://oauth2.googleapis.com/token",
"userinfo_endpoint": "https://www.googleapis.com/oauth2/v3/userinfo",
"revocation_endpoint": "https://oauth2.googleapis.com/revoke",
"jwks_uri": "https://www.googleapis.com/oauth2/v3/certs",
...
The token_endpoint in the google document here https://developers.google.com/identity/protocols/OAuth2WebServer#exchange-authorization-code said it should be https://www.googleapis.com/oauth2/v4/token.
Maybe recently the token_endpoint is updated, but when I use https://oauth2.googleapis.com/token this one to exchange token with code., I will get an error response.
{ "error": { "code": 400, "message": "Request contains an invalid argument.", "status": "INVALID_ARGUMENT" } }
And if I use https://www.googleapis.com/oauth2/v4/token to do the same thing, everything is fine.
Is there anything changed in google identify platform? Thanks!
The OAuth endpoint has been updated a number of times over the last five years. I normally follow the one i the discovery doc but your example shows that that is not always the best course of action all of the time.
I have never heard of google shutting down old endpoints i suggest you use the one that works. As a side note i will contact Google to see if i can get some feed back as to why one call worked and the other didnt.
How can I use the google plus api to check if a personalized url is taken? Do I need to use OAuth to check this?
I've successfully connected to the G+ api using OAuth but can't find this simple functionality anywhere after checking the documentation.
Google+ does not provide an API for specifically checking the availability of a custom URL; however, you could use the People.get endpoint to specifically query for to check for results for a specific ID, such as "+LarryPage" (response fields limited to id,name):
GET https://www.googleapis.com/plus/v1/people/%2BLarryPage?fields=id%2Cname&key={YOUR_API_KEY}
Which returns:
{
"id": "106189723444098348646",
"name": {
"familyName": "Page",
"givenName": "Larry"
}
}
Or if you try an invalid custom ID, like "+SergeyBatmanBrin", you'd get an HTTP 404 as the response because that ID doesn't exist.
You will need to register a project in the Google APIs Console to register your client and get an API key or OAuth client ID to allow your app to perform these queries.