Andrew Carson
Andrew Carson

Reputation: 73

How to Post to LinkedIn using R?

I am trying to post (share) to LinkedIn using R and the REST API. I followed the code example here: https://github.com/hadley/httr/blob/master/demo/oauth2-linkedin.r

It does a GET call which is working for me, but I haven't managed to get the POST to work right. The error I receive is:

 Date: 2015-09-17 10:00
 Status: 403
 Content-Type: application/json;charset=UTF-8
 Size: 144 B
 {
   "errorCode": 0,
   "message": "Access to posting shares denied",
   "requestId": "XXXXXXXXXX",
   "status": 403,
   "timestamp": 1442509229748

Below is the code I am trying to use:

POST("https://api.linkedin.com/v1/people/~/shares?format=json",        
     body = list(
            content = list(title="Title",
            description ="Description"),
            comment = "Comment",
     visibility = list(code="anyone")
     ),
     config=list(token = token)
     )

 #submitted-url=url,
 #submitted-image-url=imageurl

The documentation is here: https://developer.linkedin.com/docs/share-on-linkedin

I have w_share enabled in the application, so I am not sure what the problem is. Do I need the "submitted-url" and "submitted-image-url"?

I'd appreciate a working POST code example.

Upvotes: 1

Views: 319

Answers (0)

Related Questions