UGC Post Image media order not respected - linkedin

I'm creating an UGC post with mediaCategory IMAGE and multiple images attached uploaded with the recommended Assets Api.
I've noticed that LinkedIn does not respect the original order we are sending through.
Has anyone experienced this as well or has any idea what I'm missing?
{
"author": "urn:li:organization:5590506",
"lifecycleState": "PUBLISHED",
"specificContent": {
"com.linkedin.ugc.ShareContent": {
"media": [
{
"media": "urn:li:digitalmediaAsset:ID1",
"status": "READY",
"title": {
"attributes": [],
"text": "Asset 1"
}
},
{
"media": "urn:li:digitalmediaAsset:ID2",
"status": "READY",
"title": {
"attributes": [],
"text": "Asset 2"
}
},
{
"media": "urn:li:digitalmediaAsset:ID3",
"status": "READY",
"title": {
"attributes": [],
"text": "Asset 3"
}
},
{
"media": "urn:li:digitalmediaAsset:ID4",
"status": "READY",
"title": {
"attributes": [],
"text": "Asset 4"
}
},
{
"media": "urn:li:digitalmediaAsset:ID5",
"status": "READY",
"title": {
"attributes": [],
"text": "Asset 5"
}
}
],
"shareCommentary": {
"attributes": [],
"text": "Some share text"
},
"shareMediaCategory": "IMAGE"
}
},
"visibility": {
"com.linkedin.ugc.MemberNetworkVisibility": "PUBLIC"
}
}

POST https://api.linkedin.com/v2/ugcPosts
I think you want to maintain the order of media in single post.
But I see same media ID "media": "urn:li:digitalmediaAsset:C5500AQG7r2u00ByWjw",
5 times. May be it is just a dummy message.
I think you should try get on it
GET https://api.linkedin.com/v2/ugcPosts/{encoded ugcPostUrn|shareUrn}?viewContext=AUTHOR
and you can see media order. I think media order stays same. It is just how LinkedIn is displaying it.
{
"author": "urn:li:organization:5590506",
"lifecycleState": "PUBLISHED",
"specificContent": {
"com.linkedin.ugc.ShareContent": {
"media": [
{
"media": "urn:li:digitalmediaAsset:C5500AQG7r2u00ByWjw",
"status": "READY",
"title": {
"attributes": [],
"text": "Sample Video Create"
}
}
],
"shareCommentary": {
"attributes": [],
"text": "Some share text"
},
"shareMediaCategory": "VIDEO"
}
},
"targetAudience": {
"targetedEntities": [
{
"locations": [
"urn:li:country:us",
"urn:li:country:gb"
],
"seniorities": [
"urn:li:seniority:3"
]
}
]
},
"visibility": {
"com.linkedin.ugc.MemberNetworkVisibility": "PUBLIC"
}
}

Related

Wordpress ACF fields not showing or letting me update them on POST request

I am trying to create an application. I created a custom post type and added custom fields using ACF. When I try to post to save the data, it doesn't save it and when I create one inside wordpress and request it using it's ID, it doesn't show the data in the response.
Below is the JSON (I tried with acf, fields and with leaving everything outside of an object), response and URL.
{
"title": "title 7",
"acf": {
"feeling": "ok",
"feeling_at_the_moment": "relieved",
"what_have_you_been_doing": "chores",
"cognitive_distortions": "",
"challenge": "",
"interpretation": "",
"feeling_now": "",
"email": "gmail.com"
}
}
{
"id": 4392,
"date": "2022-12-03T19:49:14",
"date_gmt": "2022-12-03T19:49:14",
"guid": {
"rendered": "/?post_type=mood_tracker&p=4392",
"raw": "/?post_type=mood_tracker&p=4392"
},
"modified": "2022-12-03T19:49:14",
"modified_gmt": "2022-12-03T19:49:14",
"password": "",
"slug": "",
"status": "draft",
"type": "mood_tracker",
"link": "/?post_type=mood_tracker&p=4392",
"title": {
"raw": "title 7",
"rendered": "title 7"
},
"content": {
"raw": "",
"rendered": "",
"protected": false,
"block_version": 0
},
"featured_media": 0,
"template": "",
"meta": {
"_mi_skip_tracking": false
},
"permalink_template": "/mood_tracker/%pagename%/",
"generated_slug": "title-7",
"_links": {
"self": [
{
"href": "/wp-json/wp/v2/mood_tracker/4392"
}
],
"collection": [
{
"href": "/wp-json/wp/v2/mood_tracker"
}
],
"about": [
{
"href": "/wp-json/wp/v2/types/mood_tracker"
}
],
"wp:attachment": [
{
"href": "/wp-json/wp/v2/media?parent=4392"
}
],
"wp:action-publish": [
{
"href": "/wp-json/wp/v2/mood_tracker/4392"
}
],
"wp:action-unfiltered-html": [
{
"href": "/wp-json/wp/v2/mood_tracker/4392"
}
],
"curies": [
{
"name": "wp",
"href": "https://api.w.org/{rel}",
"templated": true
}
]
}
}
https://link.com/wp-json/wp/v2/mood_tracker
As per the ACF document. Make sure this is turned on
Make sure you do the same while you are creating the custom field group in case it overwrites the general settings
Sometimes I need to republish the already created posts so they get affected

UgcPosts -> Posts

I've written code which work under unversioned version and it uses ugcPosts api to gets Share/UgcPosts. In response I have thumbnails like below:
UgcPosts - https://api.linkedin.com/v2/ugcPosts/{encoded ugcPostUrn|shareUrn}?viewContext=AUTHOR
{
"author": "urn:li:person:123ABC",
"contentCertificationRecord": "{\"originCountryCode\":\"us\",\"modifiedAt\":1500590592795,\"spamRestriction\":{\"classifications\":[],\"contentQualityClassifications\":[],\"systemName\":\"MACHINE_SYNC\",\"lowQuality\":false,\"contentClassificationTrackingId\":\"B6A8B437D1D5E59D123455F6DCE5B\",\"contentRelevanceClassifications\":[],\"spam\":false}}",
"created": {
"actor": "urn:li:person:123ABC",
"time": 1500590543962
},
"firstPublishedAt": 1500590592702,
"id": "urn:li:ugcPost:123456",
"lastModified": {
"actor": "urn:li:person:123ABC",
"time": 1500590592806
},
"lifecycleState": "PUBLISHED",
"**specificContent**": {
"**com.linkedin.ugc.ShareContent**": {
"**media**": [
{
"media": "urn:li:digitalmediaAsset:123ABDEFHAG",
"status": "READY",
"**thumbnails**": [/**here i can have some thumbnail **]
}
],
"shareCommentary": {
"attributes": [
{
"length": 35,
"start": 66,
"value": {
"com.linkedin.common.CompanyAttributedEntity": {
"company": "urn:li:organization:12345"
}
}
}
],
"text": "Testing a UGC Post!"
},
"shareMediaCategory": "VIDEO"
}
},
"versionTag": "2",
"visibility": {
"com.linkedin.ugc.MemberNetworkVisibility": "PUBLIC"
}
}
But now after "migration" I dont see any option to get thumbnails for retriving posts ...
https://api.linkedin.com/rest/posts/{encoded ugcPostUrn|shareUrn}
and example of respone:
{
"lifecycleState": "PUBLISHED",
"lastModifiedAt": 1634790968774,
"visibility": "PUBLIC",
"publishedAt": 1634790968774,
"author": "urn:li:organization:5515715",
"distribution": {
"feedDistribution": "NONE",
"thirdPartyDistributionChannels": []
},
"content": {
"media": {
"id": "**urn:li:video:C5F10AQGKQg_6y2a4sQ**" - I can see only this, so probably I need to use VideoApi, but if there will be URN:LI:IMAGE ? Then what? How to get thumbnail for URN:LI:Image ?
}
},
"lifecycleStateInfo": {
"isEditedByAuthor": false
},
"isReshareDisabledByAuthor": false,
"createdAt": 1634790968743,
"id": "urn:li:ugcPost:6856810298419044352",
"commentary": "comment on Oct 20",
"adContext": {
"dscStatus": "ACTIVE",
"dscAdType": "VIDEO",
"isDsc": true,
"dscAdAccount": "urn:li:sponsoredAccount:520866471"
}
}
TL:DR :)
How to get thumbnail for urn:li:image ? If I get this in response content from posts, how to get this thumbnail for this type of content. For urn:li:video I guess that I can use VideoApi but for Image ?
I was looking for answer in documentation but without success.

Rest request api linkedin

I'm making a request in the api following this documentation and I'm getting the following error
https://learn.microsoft.com/en-us/linkedin/compliance/integrations/groups/group-posts-and-actions?context=linkedin%2Fcompliance%2Fcontext
Request
{
"author": "urn:li:person:123ABC",
"containerEntity": "urn:li:group:123",
"lifecycleState": "PUBLISHED",
"specificContent": {
"com.linkedin.ugc.ShareContent": {
"media": [
{
"description": {
"attributes": [],
"text": "Check out our awesome group!"
},
"status": "READY",
"thumbnails": [],
"title": {
"attributes": [],
"text": "Group Post!"
}
}
],
"shareCommentary": {
"attributes": [],
"text": "Some group text"
}
}
},
"visibility": {
"com.linkedin.ugc.MemberNetworkVisibility": "CONTAINER"
}
}
response
Unpermitted fields present in REQUEST_BODY: Data Processing Exception while processing fields [/containerEntity]

Markdown not interpreted in Slack message block button confirm text

In Slack message blocks, when adding a button, the confirmation dialog text is supposed to support markdown.
https://api.slack.com/reference/block-kit/composition-objects#text
But it just displays plain text:
{
"blocks": [
{
"type": "section",
"accessory": {
"type": "button",
"text": {
"type": "plain_text",
"text": "Validate"
},
"confirm":{
"title": {
"type": "plain_text",
"text": "Details"
},
"text": {
"type": "mrkdwn",
"text": "*bold* ?"
},
"confirm": {
"type": "plain_text",
"text": "Ok"
}
}
},
"text": {
"type": "mrkdwn",
"text": "Hello World!"
}
}
]
}
this seems to work
{
"type": "modal",
"title": {
"type": "plain_text",
"text": "My App",
"emoji": true
},
"submit": {
"type": "plain_text",
"text": "Submit",
"emoji": true
},
"close": {
"type": "plain_text",
"text": "Cancel",
"emoji": true
},
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "This is a mrkdwn section block :ghost: *this is bold*, and ~this is crossed out~, and <https://google.com|this is a link>"
}
}
]
}
I faced the same issue so I reached out to Slack's support, and they confirmed it is a known bug. They have no ETA for the fix yet.

How to get rid of "API must not have local definitions (i.e. only $refs are allowed)" Swaggerhub standardization error with Springfox

I have swagger api-docs.json definition generated by SpringFox.
Below minimal-reproducible-example:
{
"swagger": "2.0",
"info": {
"description": "Example REST API.",
"version": "15.11.02",
"title": "Example REST API",
"contact": {
"name": "ExampleTeam",
"url": "https://example.com/",
"email": "support#example.com"
},
"license": {
"name": "Apache License 2.0",
"url": "https://www.apache.org/licenses/LICENSE-2.0.txt"
}
},
"host": "d01088db.ngrok.io",
"basePath": "/cloud",
"tags": [
{
"name": "All Endpoints",
"description": " "
}
],
"paths": {
"/api/v2/users/{userId}/jobs/{jobId}": {
"get": {
"tags": [
"Builds",
"All Endpoints"
],
"summary": "Get job.",
"operationId": "getJobUsingGET",
"produces": [
"*/*"
],
"parameters": [
{
"name": "jobId",
"in": "path",
"description": "jobId",
"required": true,
"type": "integer",
"format": "int64"
},
{
"name": "userId",
"in": "path",
"description": "userId",
"required": true,
"type": "integer",
"format": "int64"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/APIPipelineJob"
}
},
"401": {
"description": "Unauthorized"
},
"403": {
"description": "Forbidden"
},
"404": {
"description": "Not Found"
}
},
"deprecated": false
}
}
},
"definitions": {
"APIPipelineJob": {
"type": "object",
"properties": {
"archiveTime": {
"type": "string",
"format": "date-time",
"example": "example"
},
"content": {
"type": "string",
"example": "example"
},
"createTime": {
"type": "string",
"format": "date-time",
"example": "example"
},
"id": {
"type": "integer",
"format": "int64",
"example": "example"
},
"name": {
"type": "string",
"example": "example"
},
"selfURI": {
"type": "string",
"example": "example"
},
"type": {
"type": "string",
"example": "example",
"enum": [
"BUILD",
"DEPLOY"
]
},
"userId": {
"type": "integer",
"format": "int64",
"example": "example"
}
},
"title": "APIPipelineJob",
"xml": {
"name": "APIPipelineJob",
"attribute": false,
"wrapped": false
}
}
}
}
When I import it to SwaggerHub I got standardization error:
'definitions.*' not allowed -> API must not have local definitions (i.e. only $refs are allowed)
I have found the recommended solution in SwaggerHub documentation
But here is my question how to achieve:
split into domains(then using a reference), or
inline schemas
with Springfox
Or maybe there is another way to get rid of the above standardization error?
If you go to your home page, then hover over your organization on the left hand side and go to settings > Standardization, you should see some options. Unselect "API must not have local definitions (i.e. only $refs are allowed)" at the bottom.
And don't forget to save at the top right!

Resources