How to get post reactions using linkedin marketing 2022 API - linkedin

I am trying to get the list of reactions for linkedin post (called share in linkedin namespace)
the reference documentation is https://learn.microsoft.com/en-us/linkedin/marketing/integrations/community-management/shares/reactions-api?view=li-lms-2022-12&tabs=http
NOTE: I am using marketing API December 2022
I am trying to get the post on my own test page where i am an admin.
List of permissions my token has are: SCOPE = "r_organization_social,w_member_social,r_1st_connections_size,r_organization_admin,r_ads_reporting,r_emailaddress,r_basicprofile,r_ads"
as it says in above mentioned documentation, the first one r_organization_social should be enough.
in documentation it says:
GET https://api.linkedin.com/rest/reactions/(actor:{personUrn|organizationUrn},entity:{shareUrn|ugcPostUrn|commentUrn})
for example organization_urn = urn:li:organization:12345678
and post urn = urn:li:share:7028701695735914497
how does the correct query looks like?
api.linkedin.com/rest/reactions/urn:li:share:7028701695735914497
api.linkedin.com/rest/reactions/(entity:urn:li:share:7028701695735914497)
api.linkedin.com/rest/reactions/entity:urn:li:share:7028701695735914497
api.linkedin.com/rest/reactions/urn:li:organization:12345678,urn:li:share:7028701695735914497
api.linkedin.com/rest/reactions/(urn:li:organization:12345678,urn:li:share:7028701695735914497)
api.linkedin.com/rest/reactions/(actor:urn:li:organization:12345678,entity:urn:li:share:7028701695735914497)
api.linkedin.com/rest/reactions/actor:urn:li:organization:12345678,entity:urn:li:share:7028701695735914497
api.linkedin.com/rest/reactions?q=entity&entity=urn:li:share:7028701695735914497
etc...
most of those queries return error:
{'status': 403, 'serviceErrorCode': 100, 'code': 'ACCESS_DENIED', 'message': 'Unpermitted fields present in RESOURCE_KEY: Data Processing Exception while processing fields [/reactionsId]'}
or maybe I am missing something?
i can retrieve a summary or even list of likes and comments using socialActions endpoint, but that list does not contain the reaction type.
by the way the socialactions endpoint is pretty straightforward:
curl -X GET 'https://api.linkedin.com/rest/socialActions/urn:li:share:7028701695735914497' \
-H 'Authorization: Bearer {INSERT_TOKEN}'
-H 'LinkedIn-Version: 202212' \
returns a summary of likes and comments
https://api.linkedin.com/rest/socialActions/urn:li:share:7028701695735914497/likes returns list of likes objects with authorids
https://api.linkedin.com/rest/socialActions/urn:li:share:7028701695735914497/comments returns list of comments objects

Related

HERE LinkId from route not found in PDE (Platform Data Extension)

UPDATE: It's happening again, also with Fleet API. Please see additional examples at end of the post.
I'm using HERE's REST API to calculate a route, then ask for additional data for each link / route segment by querying HERE's Platform Data Extension (PDE). This usually works fine, but now I've run into a link id that is not recognised by PDE.
Are these services not in sync, or am I doing something wrong?
I didn't have any issue in the past weeks, and it still works fine for most link ids, so this could either be a new problem or a very singular issue. I searched in the HERE API documentation and on Stackoverflow, but couldn't find anything related.
Route request (A24 Berlin towards Hamburg): https://route.api.here.com/routing/7.2/calculateroute.json?waypoint0=geo!52.7091,13.0356&waypoint1=geo!52.7193,12.9608&mode=fastest;car;traffic:disabled&representation=navigation&app_id=xxx&app_code=yyy
The json response (below) contains a link with permanent id 1199057935 at Anschlussstelle Kremmen.
The PDE request gives an empty response: https://pde.api.here.com/1/index.json?layer=ROAD_GEOM_FCn&attributes=LINK_ID&values=1199057935&app_id=xxx&app_code=yyy
{"Layers":[]}
Instead, I would expect the data of the containing tile, e.g. what I get for 1199057936
{"Layers":[{"layer":"ROAD_GEOM_FC1","level":9,"tileXYs":[{"x":548,"y":405}]}]}
I also tried the PDE request with ROAD_GEOM_FC1 and prefixing the id with + (values=+1199057935). Other link ids of the route return the expected tile information.
For completeness, here's the link's json from the routing response:
{
"linkId":"+1199057935",
"shape":["52.7175629,12.976613","52.7177131,12.9749393"],
"firstPoint":28,
"lastPoint":29,
"length":114,
"remainDistance":1095,
"remainTime":39,
"nextLink":"+1199057936",
"maneuver":"M2",
"speedLimit":33.3333359,
"dynamicSpeedInfo":{"trafficSpeed":16.3888893,"trafficTime":7,"baseSpeed":27.5,"baseTime":4,"jamFactor":5.7118645},
"flags":["motorway"],
"functionalClass":1,
"roadNumber":"A24",
"timezone":"+0100",
"roadName":"",
"consumption":0,
"_type":"PrivateTransportLinkType"
}
UPDATE 2019-05-27:
I get a route that contains link id 1239826684 from https://route.api.here.com/routing/7.2/calculateroute.json?waypoint0=geo!52.5066,13.4299&waypoint1=geo!52.5282,13.4265&mode=fastest;car;traffic:disabled&representation=navigation&app_id=xxx&app_code=yyy
Using fleet endpoint redirects to same call as above, including link id 1239826684: https://fleet.api.here.com/2/calculateroute.json?waypoint0=geo!52.5066,13.4299&waypoint1=geo!52.5282,13.4265&mode=fastest;car;traffic:disabled&representation=navigation&app_id=xxx&app_code=yyy
PDE returns [] for that link id: https://pde.api.here.com/1/index.json?layer=ROAD_GEOM_FCn&attributes=LINK_ID&values=1239826684&app_id=xxx&app_code=yyy
Fleet API returns [] for that link id: http://fleet.cit.api.here.com/1/index.json?layer=ROAD_GEOM_FCn&attributes=LINK_ID&values=1239826684&app_id=xxx&app_code=yyy
Seems the underlying geo-data is not in sync, and using different APIs does not help. Any other solution?
You can try Fleet telematics group of API's over basic routing and PDE as Fleet Telematics provides whole routing solution .
Please find the below API request which is giving expected response for the id-1199057935
http://fleet.cit.api.here.com/1/index.json?layer=ROAD_GEOM_FCn&attributes=LINK_ID&values=1199057935&app_id=xxxx&app_code=yyyy
Response :
{
Layers: [
{
layer: "ROAD_GEOM_FC1",
level: 9,
tileXYs: [
{
x: 548,
y: 405
}
]
}
]
}
for more information kindly go through the below documentation
https://developer.here.com/documentation/fleet-telematics/api-reference.html#operation%2FindexJSONUsingGET
Hope this will help.

Fleet Telematics Route Matching, query more attributes for each route link

I'm evaluating the Fleet Telematics Route Matching service and i'm trying to retrieve more link attributes directly in the response. How can this be achieved?
I created a Freemium account on HERE.com and tried the basic example from the documentation: https://developer.here.com/documentation/route-match/topics/quick-start-gps-trace-route.html.
In the documentation of the service i found that it should be possible to get more attributes regarding the route links returned in the response: https://developer.here.com/documentation/route-match/topics/attributes-along-route.html
The following works (of course 123 is not my real app id, nor my real app code):
curl -v --request GET "https://rme.cit.api.here.com/2/matchroute.json?app_id=123&app_code=123&routemode=car&file=UEsDBBQAAAAIANmztEQSwaeZzwAAAM8BAAAQAAAAc2FtcGxlLXRyYWNlLmdweIXPTQuCMBwG8HufQnZv%2F605S0k9djEIungdZjpSJ27kPn6%2BRBgYXcYYv2cPzzG2deU8805L1YSIYoLiaHMsWvv9uBlYowOrZYhKY9oAoO973DOsugJ2hFBIz8k1K%2FNabGWjjWiy%2FJ36ShjVqqITd2lxpmo4XVKgMP6vZaCneKIyYabivzHnr4BhCbb6hoZRpnvMp86L%2BdIapxImRJxiSuh%2Bj5xq7CWY%2Bcz1EaypA10qxlfVjvOl8rxVxfzDQrk%2FFCfLRs7YpOCzA%2BZd49LoBVBLAQIUABQAAAAIANmztEQSwaeZzwAAAM8BAAAQAAAAAAAAAAEAIAAAAAAAAABzYW1wbGUtdHJhY2UuZ3B4UEsFBgAAAAABAAEAPgAAAP0AAAAAAA%3D%3D"
and returns:
{"RouteLinks":[{"linkId":25664478,"functionalClass":5,"confidence":1.0,"shape":"51.10168 0.39385 51.10184 0.39329","offset":0.62907,"mSecToReachLinkFromStart":2614,"linkLength":43.08},{"linkId":1022687683,"functionalClass":4,"confidence":1.0,"shape":"51.10184 0.39329 51.10214 0.39345","mSecToReachLinkFromStart":8376,"linkLength":35.21},{"linkId":1022687684,"functionalClass":4,"confidence":1.0,"shape":"51.10214 0.39345 51.10224 0.3935","mSecToReachLinkFromStart":10284,"linkLength":11.66},{"linkId":25664459,"functionalClass":4,"confidence":1.0,"shape":"51.10224 0.3935 51.10232 0.39354","mSecToReachLinkFromStart":11811,"linkLength":9.33},{"linkId":781742854,"functionalClass":4,"confidence":1.0,"shape":"51.10232 0.39354 51.10245 0.39361 51.10255 0.39367","mSecToReachLinkFromStart":16214,"linkLength":27.16},{"linkId":781742855,"functionalClass":4,"confidence":1.0,"shape":"51.10255 0.39367 51.10269 0.39376","mSecToReachLinkFromStart":16255,"linkLength":16.8},{"linkId":25664450,"functionalClass":4,"confidence":1.0,"shape":"51.10269 0.39376 51.10292 0.39391 51.10306 0.39401","mSecToReachLinkFromStart":19004,"linkLength":44.74},{"linkId":25664444,"functionalClass":4,"confidence":1.0,"shape":"51.10306 0.39401 51.10324 0.39413","mSecToReachLinkFromStart":29879,"linkLength":21.72},{"linkId":25664440,"functionalClass":4,"confidence":1.0,"shape":"51.10324 0.39413 51.10335 0.3942 51.1035 0.39431 51.1036 0.39439","mSecToReachLinkFromStart":37082,"linkLength":44.02},{"linkId":25664427,"functionalClass":4,"confidence":1.0,"shape":"51.1036 0.39439 51.10369 0.39446 51.10378 0.39453","mSecToReachLinkFromStart":40731,"linkLength":22.3},{"linkId":860272608,"functionalClass":4,"confidence":1.0,"shape":"51.10378 0.39453 51.10394 0.39465","mSecToReachLinkFromStart":43951,"linkLength":19.68},{"linkId":860272609,"functionalClass":4,"confidence":1.0,"shape":"51.10394 0.39465 51.10417 0.39482","mSecToReachLinkFromStart":44659,"linkLength":28.22},{"linkId":781742870,"functionalClass":4,"confidence":1.0,"shape":"51.10417 0.39482 51.10427 0.39489 51.10439 0.39497 51.10452 0.39505 51.10463 0.39512","mSecToReachLinkFromStart":48568,"linkLength":55.33},{"linkId":1022687692,"functionalClass":4,"confidence":1.0,"shape":"51.10463 0.39512 51.10483 0.39523","mSecToReachLinkFromStart":57622,"linkLength":23.55},{"linkId":1022687693,"functionalClass":4,"confidence":1.0,"shape":"51.10483 0.39523 51.10547 0.39554","offset":0.28475,"mSecToReachLinkFromStart":64944,"linkLength":74.44}],"TracePoints":[{"confidenceValue":1.0,"elevation":0.0,"headingDegreeNorthClockwise":10000.0,"headingMatched":-66.0,"lat":51.10177,"latMatched":51.10178,"linkIdMatched":25664478,"lon":0.39349,"lonMatched":0.3935,"matchDistance":1.46,"matchOffsetOnLink":0.6290743846692971,"minError":1.0,"routeLinkSeqNrMatched":0,"speedMps":0.0,"timestamp":0},{"confidenceValue":1.0,"elevation":0.0,"headingDegreeNorthClockwise":10000.0,"headingMatched":-66.0,"lat":51.10181,"latMatched":51.10182,"linkIdMatched":25664478,"lon":0.39335,"lonMatched":0.39336,"matchDistance":1.46,"matchOffsetOnLink":0.8790743846674338,"minError":1.0,"routeLinkSeqNrMatched":0,"speedMps":0.0,"timestamp":0},{"confidenceValue":1.0,"elevation":0.0,"headingDegreeNorthClockwise":10000.0,"headingMatched":22.0,"lat":51.10255,"latMatched":51.10255,"linkIdMatched":781742855,"lon":0.39366,"lonMatched":0.39367,"matchDistance":1.11,"matchOffsetOnLink":0.0,"minError":1.0,"routeLinkSeqNrMatched":5,"speedMps":0.0,"timestamp":0},{"confidenceValue":1.0,"elevation":0.0,"headingDegreeNorthClockwise":10000.0,"headingMatched":25.0,"lat":51.10398,"latMatched":51.10398,"linkIdMatched":860272609,"lon":0.39466,"lonMatched":0.39468,"matchDistance":1.87,"matchOffsetOnLink":0.1535150210712758,"minError":1.0,"routeLinkSeqNrMatched":11,"speedMps":0.0,"timestamp":0},{"confidenceValue":1.0,"elevation":0.0,"headingDegreeNorthClockwise":10000.0,"headingMatched":17.0,"lat":51.10501,"latMatched":51.10501,"linkIdMatched":1022687693,"lon":0.39533,"lonMatched":0.39532,"matchDistance":1.33,"matchOffsetOnLink":0.2847498087963734,"minError":1.0,"routeLinkSeqNrMatched":14,"* Connection #0 to host rme.cit.api.here.com left intact speedMps":0.0,"timestamp":0}],"Warnings":[],"MapVersion":"LATEST"}
However, my tries to get more attributes regarding the road links have not been successful so far. No matter which attributes i select, the following query does not work:
curl -v --request GET "https://rme.cit.api.here.com/2/matchroute.json?app_id=123&app_code=123&routemode=car&file=UEsDBBQAAAAIANmztEQSwaeZzwAAAM8BAAAQAAAAc2FtcGxlLXRyYWNlLmdweIXPTQuCMBwG8HufQnZv%2F605S0k9djEIungdZjpSJ27kPn6%2BRBgYXcYYv2cPzzG2deU8805L1YSIYoLiaHMsWvv9uBlYowOrZYhKY9oAoO973DOsugJ2hFBIz8k1K%2FNabGWjjWiy%2FJ36ShjVqqITd2lxpmo4XVKgMP6vZaCneKIyYabivzHnr4BhCbb6hoZRpnvMp86L%2BdIapxImRJxiSuh%2Bj5xq7CWY%2Bcz1EaypA10qxlfVjvOl8rxVxfzDQrk%2FFCfLRs7YpOCzA%2BZd49LoBVBLAQIUABQAAAAIANmztEQSwaeZzwAAAM8BAAAQAAAAAAAAAAEAIAAAAAAAAABzYW1wbGUtdHJhY2UuZ3B4UEsFBgAAAAABAAEAPgAAAP0AAAAAAA%3D%3D&attributes=LINK_ID"
and instead of a proper response, i just get
{"faultCode":"6a8a9966-b2eb-4a54-8f58-2f36e501bb94","responseCode":"400 Bad Request","message":"Invalid layer attribute parameter."}
Using a layer instead of an attributes does not work either:
curl -v --request GET "https://rme.cit.api.here.com/2/matchroute.json?app_id=123&app_code=123&routemode=car&file=UEsDBBQAAAAIANmztEQSwaeZzwAAAM8BAAAQAAAAc2FtcGxlLXRyYWNlLmdweIXPTQuCMBwG8HufQnZv%2F605S0k9djEIungdZjpSJ27kPn6%2BRBgYXcYYv2cPzzG2deU8805L1YSIYoLiaHMsWvv9uBlYowOrZYhKY9oAoO973DOsugJ2hFBIz8k1K%2FNabGWjjWiy%2FJ36ShjVqqITd2lxpmo4XVKgMP6vZaCneKIyYabivzHnr4BhCbb6hoZRpnvMp86L%2BdIapxImRJxiSuh%2Bj5xq7CWY%2Bcz1EaypA10qxlfVjvOl8rxVxfzDQrk%2FFCfLRs7YpOCzA%2BZd49LoBVBLAQIUABQAAAAIANmztEQSwaeZzwAAAM8BAAAQAAAAAAAAAAEAIAAAAAAAAABzYW1wbGUtdHJhY2UuZ3B4UEsFBgAAAAABAAEAPgAAAP0AAAAAAA%3D%3D&attributes=LINK_ATTRIBUTE_FC5"
This returns the same error as above.
Based on the documentation i would expect that there is some way to retrieve more link attributes directly in the response, but i cannot figure out how to do that. Obviously, i must be doing something wrong.
Please refer the following link
https://developer.here.com/documentation/route-match/topics/resource-matchroute-request.html
you can easily retrieve the attributes for the particular layers with the following command where the attributes parameter should be LINK_ATTRIBUTE_FCn(*). It is also possible to retrieve the particular information from these attributes with LINK_ATTRIBUTE_FCn(ISO_COUNTRY_CODE,RAMP,URBAN).
https://rme.cit.api.here.com/2/matchroute.json?app_id=123&app_code=123&routemode=car&file=UEsDBBQAAAAIANmztEQSwaeZzwAAAM8BAAAQAAAAc2FtcGxlLXRyYWNlLmdweIXPTQuCMBwG8HufQnZv%2F605S0k9djEIungdZjpSJ27kPn6%2BRBgYXcYYv2cPzzG2deU8805L1YSIYoLiaHMsWvv9uBlYowOrZYhKY9oAoO973DOsugJ2hFBIz8k1K%2FNabGWjjWiy%2FJ36ShjVqqITd2lxpmo4XVKgMP6vZaCneKIyYabivzHnr4BhCbb6hoZRpnvMp86L%2BdIapxImRJxiSuh%2Bj5xq7CWY%2Bcz1EaypA10qxlfVjvOl8rxVxfzDQrk%2FFCfLRs7YpOCzA%2BZd49LoBVBLAQIUABQAAAAIANmztEQSwaeZzwAAAM8BAAAQAAAAAAAAAAEAIAAAAAAAAABzYW1wbGUtdHJhY2UuZ3B4UEsFBgAAAAABAAEAPgAAAP0AAAAAAA%3D%3D&attributes=LINK_ATTRIBUTE_FCn(*)
Similarly, you can get the attributes for the other layers (i.e. ROAD_GEOM_FCn(*))
Hope this helps you.
Best Regards,
Jeyaprakash Rajagopal

AWS API/Lambda POST capabilities

I am trying to create a API/Lambda process which takes a comment and posts in into my RDS Aurora database.
The comment field in the database is set as TEXT type
The lambda function posts the comment to the database
The API method is POST
A mapping template has been set u to map the request body into the lambda function
All work perfectly until I start to try and post large comments. (A large paragraph, maybe 500 characters)
The body looks as follows:
{
"comment":"long comment"
}
When I run it in Lambda, I can post massive comments, however when I try and do it through the API Gateway I get an error
Endpoint response body before transformations: {"stackTrace": [["/var/task/app.py", 38, "handler", "raise Exception('Internal Error: Unable to post the comment.')"]], "errorType": "Exception", "errorMessage": "Internal Error: Unable to post the comment."}
I would suggest to use the test invoke feature on API Gateway console. From there, you can see the payload before transformed and after transformed. That might be a bit on debugging.

How to get a LinkedIn Group Post "content" through API, not just the title

When starting a Group Discussion through the LinkedIn website you can enter a postTitle and (optional) postText
However when querying this post through the LinkedIn API only the "title" is returned.
https://api.linkedin.com/v1/posts/{post-id}
Tested from https://apigee.com/console/linkedin to confirm it wasn't just my script with issues.
Is there an extra parameter I can pass to the API to get this "text" field on a Group Discussion post?
Thanks
You need to use the field selectors to specify the particular fields that you want returned from your call.
For example:
https://api.linkedin.com/v1/groups/12345:(id,name,site-group-url,posts:(id,summary,creator))
Please also note that as of May 12th, 2015, the API endpoint for Groups will no longer be publicly available. See the following blog post for more details: https://developer.linkedin.com/blog/posts/2015/developer-program-changes

Linkedin Group API call get profile URL of the commented member

I am using Linkedin REST API with PHP.
I am trying to get posts of a particular discussion group.
The API call is
http://api.linkedin.com/v1/groups/2417328/posts:(creation-timestamp,summary,title,type,comments,id,creator:(picture-url,last-name,headline,id,first-name,site-standard-profile-request))?count=100&start=0&modified-since=1312441200000
I would like to fetch the profile URL of the members who commented on each post also. Is it possible to do this with the above mentioned call?
Yes, it is possible - in the API call, specify the comment creator fields you would like to return from the list of available Profile Fields. To return the comment creator's profile URL, replace the comments Group Field with comments:(creator:(site-standard-profile-request)). You can specify other profile fields in there as needed.

Resources