LinkedIn UGC Post Method

494 Views Asked by At

I am trying to post a text on LinkedIn using UGC through Postman.

Here is my request body:

{
    "author": "urn:li:person:{uid of my account}",
    "lifecycleState": "PUBLISHED",
    "specificContent": {
        "com.linkedin.ugc.ShareContent": {
            "shareCommentary": {
                "text": "Hello World! This is my first Share on LinkedIn!"
            },
            "shareMediaCategory": "NONE"
        }
    },
    "visibility": {
        "com.linkedin.ugc.MemberNetworkVisibility": "PUBLIC"
    }
}

Note: uid of my account is fetched through - https://api.linkedin.com/v2/me

The response I am getting is:

{
    "message": "ERROR :: /author :: \"urn:li:person:oQRNppEnm\" does not match urn:li:company:\\d+|urn:li:member:\\d+\n",
    "status": 422
}

Can anyone please help out here?

1

There are 1 best solutions below

0
On

I had such a mistake. I used wrong value from https://api.linkedin.com/v2/me request answer. You need to add id in your request query if you haven't already, for example

https://api.linkedin.com/v2/me?projection=(id,localizedFirstName,localizedLastName)

also you need to use value from id field of JSON answer:

{"id\":\"XyyyyXXXXX\"}

It will be some kind of value with numbers and letters, not just numbers.