Search code examples
iphonesocial-networkinglinkedin-api

url for posting title,description and link in linkedIn


I need to post on the wall of linkedIn from my iphone application.

For that i am downloading the code from the source.

In this For the posting on the wall code is

- (RDLinkedInConnectionID *)updateStatus:(NSString *)newStatus {
  NSURL* url = [NSURL URLWithString:[kAPIBaseURL stringByAppendingString:@"/v1/people/~/current-status"]];
  newStatus = [newStatus length] > kRDLinkedInMaxStatusLength ? [newStatus substringToIndex:kRDLinkedInMaxStatusLength] : newStatus;
  NSData* body = [RDLinkedInRequestBuilder buildSimpleRequestWithRootNode:@"current-status" content:newStatus];
  return [self sendAPIRequestWithURL:url HTTPMethod:@"PUT" body:body];
} 

this is code for posting only current status but i need to post title,description and url like facebook.

How can i done this,can any one please help me.


Solution

  • I resolve it by using sharelink method.Code for thais is

    -(RDLinkedInConnectionID *)shareLink:(NSDictionary *)shareDict { 
        NSURL* url = [NSURL URLWithString:[kAPIBaseURL stringByAppendingString:@"/v1/people/~/shares"]];   
        NSString *xmlStr = [NSString stringWithFormat:@"<share><content><title>%@</title><submitted-url>%@</submitted-url><description>%@</description></content><visibility><code>anyone</code></visibility></share>",[shareDict objectForKey:@"Title"],[shareDict objectForKey:@"Link"],[[shareDict objectForKey:@"Description"]substringWithRange:NSMakeRange(0,150)]];  
        NSData* body = [xmlStr dataUsingEncoding:NSUTF8StringEncoding]; 
        return [self sendAPIRequestWithURL:url HTTPMethod:@"POST" body:body];
    }