Hello I cannot manage to upload videos on linkedIn member account using V2 API
I followed the instructions described at the official page
the steps to upload a video (under 200 MB) are
Register an upload for Video
Upload the video
Check status of upload
they all worked , and the last step gives back a successful respose
{
"serviceRelationships": [
{
"identifier": "urn:li:userGeneratedContent",
"relationshipType": "OWNER"
}
],
"recipes": [
{
"recipe": "urn:li:digitalmediaRecipe:feedshare-image",
"status": "AVAILABLE"
}
],
"mediaTypeFamily": "STILLIMAGE",
"created": 1583915898789,
"lastModified": 1583916648095,
"id": "C4D22AQELBNtjd0NB2Q",
"status": "ALLOWED"
}
but the video is not displayed in the linked in account page..
I thought it needs to be shared as for the image, but the ugcPosts API does not work..
is this still a closed feature by LinkedIn?
if so how can it be granted?
Any suggestion is higly appreciated!
Hey as stated in the documentation you can use uploaded assets with their corresponding asset urn in ugcPosts (videos) or shares (images).
What got my attention in your question you register a video upload and get back
"recipes": [
{
"recipe": "urn:li:digitalmediaRecipe:feedshare-image",
"status": "AVAILABLE"
}
],
"mediaTypeFamily": "STILLIMAGE",
This indicates to me that you used the wrong recipe in the registerUpload request. It should be urn:li:digitalmediaRecipe:feedshare-video
Related
Sending any attachments via https://api.linkedin.com/v2/messages results in an empty message on the receiver end. It was working fine during the development and until a few months ago.
I followed the steps as mentioned in the doc here: Messages API.
1. Register upload
POST 'https://api.linkedin.com/v2/assets?action=registerUpload'
Headers: { 'x-li-format: json' ,'X-Restli-Protocol-Version: 2.0.0', 'Authorization': <AUTH TOKEN'>, 'Content-Type: application/json'}
Body:
{
"registerUploadRequest": {
"recipes": [
"urn:li:digitalmediaRecipe:messaging-attachment"
],
"owner": "urn:li:person:tVBKuamGQA",
"serviceRelationships": [
{
"identifier": "urn:li:userGeneratedContent",
"relationshipType": "OWNER"
}
],
"supportedUploadMechanism": [
"SYNCHRONOUS_UPLOAD"
]
}
}
2. Media upload
PUT 'https://api.linkedin.com/mediaUpload/D5606AQEyWs_FuSOhpQ/messaging-attachmentFile/0?ca=vector_messaging&cn=uploads_encrypted&m=AQLwVYaN1VD0FAAAAYZWQ5iaB1P3EvIEqybGym69KocRancNKS12YAhD2A&app=109663&sync=1&v=beta&ut=39P3TAA2AwmGE1'
Headers: Same as above
Body: Image in bytes format
3. Send message with the Attachment URN
POST 'https://api.linkedin.com/v2/messages'
Additionally, I was also able to verify that the status of the upload was successful.
Body:
{
"recipients": [
"urn:li:person:eDPvPwsUVS"
],
"subject": null,
"body": "Body3",
"messageType": "MEMBER_TO_MEMBER",
"attachments": [
"urn:li:digitalmediaAsset:D5606AQEyWs_FuSOhpQ"
]
}
4. Check status of the upload:
Additionally, I was also able to verify that the upload was successful with the status "AVAILABLE"
GET 'https://api.linkedin.com/v2/assets/D5606AQEyWs_FuSOhpQ'
All API calls shared here were successful, making it even more challenging to figure out why the attachments fail. Sending only texts works fine. Any insights/guidance on this issue will be greatly appreciated. It's currently blocking our major release.
I have gone through the assets api, images api documentations from LI, but that doesn't seem to be relevant for sending attachments via private message.
Assets API
Images API
I'm trying to migrate existing code that fetches organization posts from ugcPosts API to new versioned call of the Posts API(version 202210) and I'm facing issues with getting thumbnails for articles. Response that I get from Posts API doesn't contain thumbnail URL but instead it contains thumbnail URN(old ugcPost API returned thumbnail URL as a part of the post). Here is an example of an article post that I get from API
{
"isReshareDisabledByAuthor": false,
"createdAt": 1666603988797,
"lifecycleState": "PUBLISHED",
"lastModifiedAt": 1666603988797,
"visibility": "PUBLIC",
"publishedAt": 1666603988797,
"author": "urn:li:organization:1111",
"id": "urn:li:share:2222",
"distribution": {
"feedDistribution": "MAIN_FEED",
"thirdPartyDistributionChannels": []
},
"content": {
"article": {
"description": "some description",
"thumbnail": "urn:li:image:3333",
"source": "https://example.com",
"title": "some title"
}
},
"commentary": "some comment",
"lifecycleStateInfo": {
"isEditedByAuthor": false
}
}
I tried to use Images API to fetch thumbnail URL using a call
GET https://api.linkedin.com/rest/images/urn:li:image:3333
Unfortunately Linked In API responds with code 400 and message Invalid asset owner urn type provided: urn:li:article:4444
I don't get why it happens. Token that I'm using has enough permissions to fetch organization posts(token's scope contains permissions w_member_social, r_liteprofile, r_1st_connections_size, w_organization_social, r_member_social, r_organization_social, rw_organization_admin). Article id that presents in error message isn't anyhow connected to post id. It's also not clear why that asset is referenced as urn:li:article while the post itself is described as urn:li:share. To me it looks like Linked In API bug or am I doing something wrong?
Turns out there was a bug in Linked In API which was confirmed by their support. At this moment same calls work fine with version 202210
I am trying to fetch the posts of the company from the api, I have already applied to the marketing development platform and it was approved. I already got the token with the scope: r_organization_social and I'm calling the /shares api:
https://api.linkedin.com/v2/shares?q=owners&owners=urn:li:organization:{company_ID}&sharesPerOwner=100&count=25&sharesPerOwner=10
But I'm getting the following response:
{
"paging": {
"start": 0,
"count": 25,
"links": [
{
"type": "application/json",
"rel": "next",
"href": "/v2/shares?count=25&owners=urn%3Ali%3Aorganization%3A{company_ID}&q=owners&sharesPerOwner=10&sharesPerOwner=100&start=0"
}
],
"total": 242
},
"elements": []
}
I tried to change the query params and it's still the same
This end-point worked for me:
https://api.linkedin.com/v2/ugcPosts?q=authors&authors=List(urn%3Ali%3Aorganization%3A<ID_ORGANIZATION>)
See documentation: https://learn.microsoft.com/en-us/linkedin/marketing/integrations/community-management/shares/ugc-post-api?tabs=http#sample-request-6
Disclaimer: I've no access to the linkedin API and couldn't test. But these are some things I noticed:
Your url contains two times the paramater sharesPerOwner, try removing one.
In the docs it's recommended to set the sharesPerOwner to 1000 and the count to 50. I'd also include the start paramater, just to make sure:
Maybe try something like this:
GET https://api.linkedin.com/v2/shares?q=owners&owners=urn:li:organization:{id}&sharesPerOwner=1000&count=50&start=0
From the api-docs(https://learn.microsoft.com/en-us/linkedin/marketing/integrations/community-management/shares/share-api?tabs=http#find-shares-by-owner): "Note that the pagination excludes UGC and Direct Sponsored Content (DSC) posts". Make sure that the owner you are testing contains posts.
If this doesn't work. Could you provide some information on how you are sending the request? Have you tried accessing other parts of the api?
I am using following endpoint to fetch posts
https://api.linkedin.com/v2/ugcPosts?q=authors&authors[0]=urn:li:organization:XXXX&count=100&start=0
"media": [{
"recipes": [
"urn:li:digitalmediaProcessedAsset:(urn:li:digitalmediaAsset:XXXXXXXXXX,urn:li:digitalmediaRecipe:feedshare-video-captions-thumbnails)"
],
"media": "urn:li:digitalmediaAsset:XXXXXXXXXX",
"thumbnails": [],
"status": "READY"
}]
I could see only digitalmedia Asset, But couldn't find original Url like sharable url like
https://dms.licdn.com/playback/C5105AQGCJKQiUe3pmw/8f26be64328644c090703fdc3afd05a8/feedshare-mp4_3300-captions-thumbnails/1507940147251-drlcss?e=1571133600&v=beta&t=RgRX9RM_Z50wt4cwqEHQ79vY6NU-KNcKVPFbEIftqAc
Note : For image, we are getting original Url
https://media.licdn.com/dms/image/C5122AQHvWYVXpP2Few/feedshare-shrink_1280/0?e=1573689600&v=beta&t=gLeLjTO5OlyF-F0RESk9YdSyqMggXLNmkWSUOqldFXw
Using projection helped to solve this issue
https://api.linkedin.com/v2/ugcPosts?q=authors&authors[0]=urn:li:organization:XXXXX&count=100&projection=(paging,elements*(name,localizedName,vanityName,created(actor~(localizedFirstName, localizedLastName)),lastModified(actor~(localizedFirstName, localizedLastName)),specificContent(com.linkedin.ugc.ShareContent(shareMediaCategory,shareCommentary,media(*(media~:playableStreams,originalUrl,description,title))))))
Projection parameter working as of Feb 2020
(paging,elements*(id,created,lastModified,author,specificContent(com.linkedin.ugc.ShareContent(shareMediaCategory,shareCommentary,media(*(media~:playableStreams,originalUrl,description,title))))))
could you please give me a hint on how to share a single event via google calendar api?
That is I'd like to invite other users to see the event programmatically without sharing the whole calendar. To mimic the "Add guests" UI action
As Claudio mentioned, you need to use the Google Calendar Advanced API for this.
You'll want to use a patch because you don't want to replace all the other data on the calendar invite. However, even in the case of patch, since the attendees lives in an array, if you attempt to pass a patch such as this:
{
attendees: [ { email: "new#example.com"} ]
}
... it'll replace all old invitees (i.e. it'll remove anyone that was on the invite before you called patch). To fix this, you must first get the current invitees, add a new person to the array, and then send a patch.
You can see a detailed example of this in this answer which also explains how to use Google Apps Scripting to ensure an email is sent to the user when adding them to a calendar event (see the addGuestAndSendEmail() method in that post).
You can use the API to add people to the attendees collection:
https://developers.google.com/google-apps/calendar/v3/reference/events/update
refer the following request.
method: POST
endpoint: https://www.googleapis.com/calendar/v3/calendars/primary/events?sendUpdates=all
here, sendUpdates means when you add any guest so he would get an invitation mail used based on scenario.
Input Json:
{
"kind": "calendar#event",
"etag": "etag",
"status": "confirmed",
"summary": "JayKara",
"description": "eqwbdjhwhhwhhwrhjehrhejhfj",
"location": "America",
"creator": {
"email": "#mail.com",
"self": true
},
"organizer": {
"email": "#mail.com",
"self": true
},
"start": {
"date": "2019-12-23"
},
"end": {
"date": "2019-12-24"
},
"originalStartTime": {
"date": "2019-12-24"
},
"visibility": "public",
"attendees": [
{
"email": "****#mail.com" //this guys are the guest
}
]
}.
After that there is no patch method required your guest guys will receive an invitation whenever update event
Cheers!