Using LinkedIn APIs I'm trying to create a Creative Ad with an image and a call-to-action button like the following example from campaignmanager:
I tried many possibilities using Asset and Share APIs to create a dark Share but i'm unable to create a Creative with an image and a call-to-action button. The example in the documentation doesn't say if I should use ARTICLE or RICH shareMediaCategory. Setting landingPageUrl like in this example seems to have no effect when using from a Creative Ad.
I successfully created a video Creative Ad with a call-to-action but the new UgcPost API is only supporting AdDirectSponsoredContent for video.
Does somebody know how to do it?
Thank you
I found a workaround by creating first a RICH dark share that accepts an uploaded asset urn in the entity field:
POST https://api.linkedin.com/v2/shares
{
"owner": "urn:li:organization:1234",
"agent": "urn:li:sponsoredAccount:5678",
"subject": "An ad title",
"text": {
"text": "An ad title"
},
"content": {
"contentEntities": [
{
"entity": "urn:li:digitalmediaAsset:ABCD",
"entityLocation": "https://stackoverflow.com"
}
],
"shareMediaCategory": "RICH"
},
"distribution": {
"linkedInDistributionTarget": {}
}
}
Then I create a 2nd ARTICLE dark share with the thumbnails info recovered from the 1st dark share plus the "call to action" button:
POST https://api.linkedin.com/v2/shares
{
"owner": "urn:li:organization:1234",
"agent": "urn:li:sponsoredAccount:5678",
"subject": "An ad title",
"text": {
"text": "An ad title"
},
"content": {
"contentEntities": [
{
"entityLocation": "https://stackoverflow.com",
"thumbnails": [
{
"resolvedUrl": "https://media-exp1.licdn.com/dms/image/ABCD/feedshare-shrink_1280/..."
}
],
"title": "Click here to learn more!",
"landingPageUrl": "https://stackoverflow.com",
"landingPageTitle": "LEARN_MORE"
}
],
"shareMediaCategory": "ARTICLE"
},
"distribution": {
"linkedInDistributionTarget": {}
}
}
Related
I am working on a project to take a Google Form and transpile it into Lua for usage within Roblox experiences.
Take this form:
https://docs.google.com/forms/d/e/1FAIpQLSeKIzg67ZWJAr9VXfgODj0xFE73yA40lidbMcEAytP5EhwfZA/viewform
Form with a simple title and radio button
Looking at the example response objects from the onboarding guides
https://developers.google.com/forms/api/guides
I can infer that the response would look something like this
{
"formId": "FORM_ID",
"info": {
"title": "Example Form",
"description": "Example Form Description",
"documentTitle": "Example Form"
},
"settings": {
"quizSettings": {
"isQuiz": false
}
},
"revisionId": "00000021",
"responderUri": "https://docs.google.com/forms/d/e/1FAIpQLSeKIzg67ZWJAr9VXfgODj0xFE73yA40lidbMcEAytP5EhwfZA/viewform",
"items": [
{
"itemId": "5d9f9786",
"imageItem": {
"image": {
"contentUri": "DIRECT_URL",
"properties": {
"alignment": "LEFT"
}
}
}
},
{
"itemId": "0a4859c8",
"title": "Question 1",
"questionItem": {
"question": {
"questionId": "37fff47a",
"choiceQuestion": {
"type": "RADIO",
"options": [
{
"value": "Radio Button Label 1"
},
{
"value": "Radio Button Label 2"
}
]
}
}
}
}
]
}
Ideally I would like to be able to fetch form responses with API keys only, but it doesn't seem like thats allowed with the new Forms api. In that case - automatic fetching of the form information is out of the question (OAuth is far too much overhead / impractical to set up), so what I would like is the ability to easily fetch the json object for a form i'm the owner of.
I checked the network traffic for the forms page and it just returns all the HTML required to display, nothing like a the nice Form object you would get from the developer APIs. The "Try it out" feature in the API documentation still requires OAuth.
linkedin
Hi,
When we replace preview of a URL with a custom image, recently we have seen that they have stopped getting posted with the custom image on LinkedIn profiles through API. It works on LinkedIn companies.
Is it a temporary bug or some change of which we were not informed?
An example given below.
Thanks.
{
"author": "urn:li:person:9DeFJQSxT0",
"lifecycleState": "PUBLISHED",
"specificContent": {
"com.linkedin.ugc.ShareContent": {
"shareCommentary": {
"text": "hello amit recurpost.com test"
},
"shareMediaCategory": "ARTICLE",
"media": [
{
"status": "READY",
"description": {
"text": "Kickstart your social media marketing and manage multiple social accounts from a single dashboard with one powerful and affordable social media scheduling tool."
},
"originalUrl": "https://recurpost.page.link/awqx",
"thumbnails": [
{
"url": "https://rpdevelopers.blob.core.windows.net/imagesdev/1589179465_5eb8f44941d96.jpeg"
}
],
"title": {
"text": "Social Media Scheduler with Repeating Schedules | RecurPost"
}
}
]
}
},
"visibility": {
"com.linkedin.ugc.MemberNetworkVisibility": "PUBLIC"
}
}
So I'm trying to publish a post on a company page using the ugcPosts API.
When I'm doing in to a personal account it works great but when I'm doing it for a company page I get status "201 Created" but it doesnt appear on the company page.
I'm using the test company page https://www.linkedin.com/company/devtestco/
The user I'm authenticated with has permissions:
- r_liteprofile
- r_emailaddress
- w_member_social
- w_organization_social
- r_organization_social
I make the call to:
https://api.linkedin.com/v2/ugcPosts
with the body
{
"author": "urn:li:organization:2414183",
"lifecycleState": "PUBLISHED",
"specificContent": {
"com.linkedin.ugc.ShareContent": {
"shareCommentary": {
"text": "A share comment"
},
"shareMediaCategory": "ARTICLE",
"media": [
{
"status": "READY",
"description": {
"text": "A description"
},
"originalUrl": "https://linkedin.com/",
"title": {
"text": "A title"
}
}
]
}
},
"visibility": {
"com.linkedin.ugc.MemberNetworkVisibility": "PUBLIC"
}
}
Am I doing something wrong? Is there any problems with https://www.linkedin.com/company/devtestco/ test company page? Is there another company page used for testing?
Like I said, I recieve "Created" response but where is it then? The devtestco page doesnt have any posts at all which I find weird since I cant be the only one using it.
So I tested with a "real" company page instead and it worked, so there seems to be something weird with the page https://www.linkedin.com/company/devtestco/
I'm trying to migrate my app from LinkedIn API v1 to v2. I'm currently looking at sharing images (natively) to my personal LinkedIn profile.
I'm following the official docs here: https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/share-on-linkedin#create-an-image-share
To register the image I made the following POST request: to https://api.linkedin.com/v2/assets?action=registerUpload
{
"registerUploadRequest": {
"recipes": [
"urn:li:digitalmediaRecipe:feedshare-image"
],
"owner": "urn:li:person:9PyfTxBTFY",
"serviceRelationships": [
{
"relationshipType": "OWNER",
"identifier": "urn:li:userGeneratedContent"
}
]
}
}
I got the success response:
{
"value": {
"uploadMechanism": {
"com.linkedin.digitalmedia.uploading.MediaUploadHttpRequest": {
"headers": {},
"uploadUrl": "https://api.linkedin.com/mediaUpload/C4D22AQEGOHxBzKUXvw/feedshare-uploadedImage/0?ca=vector_feedshare&cn=uploads&m=AQLhYJm0KOaTCgAAAWhSDplI-Lzlfh7lOsd8D5qBcz0aJ2bf1fwIfnh8ow&app=5212106&sync=0&v=beta&ut=0rKn179ebIA8A1"
}
},
"mediaArtifact": "urn:li:digitalmediaMediaArtifact:(urn:li:digitalmediaAsset:C4D22AQEGOHxBzKUXvw,urn:li:digitalmediaMediaArtifactClass:feedshare-uploadedImage)",
"asset": "urn:li:digitalmediaAsset:C4D22AQEGOHxBzKUXvw"
}
}
I successfully uploaded an image as binary using the returned uploadUrl:
curl -i --upload-file PATH_TO_FILE --header "Authorization: Bearer TOKEN" 'https://api.linkedin.com/mediaUpload/C4D22AQEGOHxBzKUXvw/feedshare-uploadedImage/0?ca=vector_feedshare&cn=uploads&m=AQLhYJm0KOaTCgAAAWhSDplI-Lzlfh7lOsd8D5qBcz0aJ2bf1fwIfnh8ow&app=5212106&sync=0&v=beta&ut=0rKn179ebIA8A1'
To confirm that the image is ready for use, I checked the status of the asset with the GET https://api.linkedin.com/v2/assets/C4D22AQEGOHxBzKUXvw which returned
{
"serviceRelationships": [
{
"identifier": "urn:li:userGeneratedContent",
"relationshipType": "OWNER"
}
],
"recipes": [
{
"recipe": "urn:li:digitalmediaRecipe:feedshare-image",
"status": "AVAILABLE"
}
],
"mediaTypeFamily": "STILLIMAGE",
"created": 1547564914979,
"lastModified": 1547564994321,
"id": "C4D22AQEGOHxBzKUXvw",
"status": "ALLOWED"
}
Based on the docs, I can now simply reference the asset URN in the UGC post.
This is the test image post I'm trying to share using the https://api.linkedin.com/v2/ugcPosts endpoint
{
"author": "urn:li:person:9PyfTxBTFY",
"lifecycleState": "PUBLISHED",
"specificContent": {
"com.linkedin.ugc.ShareContent": {
"shareCommentary": {
"text": "Testing LinkedIn image shares"
},
"shareMediaCategory": "IMAGE",
"media": [
{
"status": "READY",
"description": {
"text": "Some text"
},
"media": "urn:li:digitalmediaAsset:C4D22AQEGOHxBzKUXvw",
"title": {
"text": "Some title"
}
}
]
}
},
"visibility": {
"com.linkedin.ugc.MemberNetworkVisibility": "PUBLIC"
}
}
But I keep getting the error:
{
"message": "Attempting to associate a ugc with an asset that's not owned by the author",
"status": 400
}
The above request works perfectly when trying to share a status update or a link attachment.
I haven't tried it with videos yet (similar approach) since I assume I will face the same problem. I haven't tried sharing as an organization either since I need to be accepted to the LinkedIn Marketing Developer Program first.
I can confirm that this has been fixed by the LinkedIn Developer Team. Follow the same steps as above and it should work perfectly, as long as the authenticated user has granted the w_member_social permission.
On the last request I now get 201 Created response with the header X-RestLi-Id containing the link to the new post urn:li:share:6494126499975700480.
https://www.linkedin.com/feed/update/urn:li:share:6494126499975700480
P.S. If you're re-trying an old request / registered upload, it won't work, so make sure you try it with a new asset. I believe the bug was when registering uploads.
I am trying to create video post on linkedin with new ugc endpoint
there are two steps to create this type of post
1). Upload video asset on linkedin server (done)
2). make post request to ugc endpoint with request body
I have successfully uploaded the video but getting authentication error for ugc post request. error is
{
"message": "urn:li:developerApplication:<id1> does not have permission to create ugc posts with author: li:member:<id2>",
"status": 401
}
I am passing the request body as suggested in the linkedin api docs.
{
"author": "urn:li:person:<id>",
"lifecycleState": "PUBLISHED",
"specificContent": {
"com.linkedin.ugc.ShareContent": {
"media": [
{
"title": {
"attributes": [],
"text": "Sample Video Create"
},
"description": {
"attributes": [],
"text": "Sample Description"
},
"media": "urn:li:digitalmediaAsset:<asset_id>",
"thumbnails": [],
"status": "READY"
}
],
"shareCommentary": {
"attributes": [],
"text": "Some share text"
},
"shareMediaCategory": "VIDEO"
}
},
"visibility": {
"com.linkedin.ugc.MemberNetworkVisibility": "PUBLIC"
},
"targetAudience": {
"targetedEntities": [
{
"locations": [
"urn:li:country:us"
]
}
]
}
}
Please suggest how I can solve this problem. From error message it seems like I am not providing some permission. But I am not sure where I am making mistake.
This is the response I got from the LinkedIn Developer Support:
"Hi Ervin,
Creating video UGC posts is currently a whitelisted feature. There is currently hold on whitelisting new apps for video.
You may continue to create UGC posts that are not video though.
I'll put this on hold until I have more information on when we can whitelist apps again.
Best,
Alex"