I'm trying to retrieve a list of UGC posts by calling the following API
https://api.linkedin.com/v2/ugcPosts?q=authors&authors=List%28urn%3Ali%3Aorganization%3A[ORG_ID]%29
[ORG_ID] is id of my organization. Then I got this error
{
"serviceErrorCode": 0,
"message": "java.lang.ClassCastException: java.lang.String cannot be cast to com.linkedin.data.DataComplex",
"status": 500
}
I've already authorized to use API V2 and include X-Restli-Protocol-Version:2.0.0
in the header.
I was having issues with this too, the parens on the authors
query param shouldn't be encoded.
I.e., try: https://api.linkedin.com/v2/ugcPosts?q=authors&authors=List(urn%3Ali%3Aorganization%3A[ORG_ID])
I tested it with the URL mentioned https://api.linkedin.com/v2/ugcPosts?q=authors&authors=List(urn%3Ali%3Aorganization%3A[ORGANISATION ID]) and it works but make sure you set the header.
X-Restli-Protocol-Version: 2.0.0
I had to do this manually however since postman apparently doesn't work and perhaps other http tools are having similar issues. https://github.com/postmanlabs/postman-app-support/issues/5752
The error returned by postman is the following or if you forget to include the header above: {"serviceErrorCode":0,"message":"java.lang.ClassCastException","status":500}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With