我正在尝试使用 LinkedIn API 通过电子邮件 ID 发送邀请
NSURL *url = [NSURL URLWithString:@"http://api.linkedin.com/v1/people/~/mailbox"];
OAMutableURLRequest *request =
[[OAMutableURLRequest alloc] initWithURL:url
consumer:consumer
token:token
callback:nil
signatureProvider:nil];
[request setHTTPMethod:@"POST"];
NSString *messageToPerson = [NSString stringWithFormat:@"/people/email=anuisac@gmail.com"];
NSDictionary *person = [[NSDictionary alloc] initWithObjectsAndKeys:[[NSDictionary alloc] initWithObjectsAndKeys:messageToPerson,@"_path",@"Anu",@"first-name",@"Isac",@"last-name",nil] , @"person",nil];
NSArray *valueArray = [[NSArray alloc] initWithObjects:person,nil];
NSDictionary *values = [[NSDictionary alloc] initWithObjectsAndKeys:valueArray,@"values", nil];
NSDictionary *ir = [[NSDictionary alloc] initWithObjectsAndKeys:[[NSDictionary alloc] initWithObjectsAndKeys:@"friend",@"connect-type",nil] , @"invitation-request",nil];
NSDictionary *ic = [[NSDictionary alloc] initWithObjectsAndKeys:ir,@"item-content", nil];
NSDictionary *update = [[NSDictionary alloc] initWithObjectsAndKeys:values,@"recipients",@"Invitation",@"subject",@"ConnectWithMe",@"body", ir, @"item-content", nil];
[request setValue:@"json" forHTTPHeaderField:@"x-li-format"];
[request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
NSLog(@"%@",[update description]);
NSString *updateString = [update JSONString];
[request prepare];
[request setHTTPBodyWithString:updateString];
并且响应是错误消息,如图所示
"errorCode": 0,
"message": "Access to sending invitation denied.",
"requestId": "LFECWXJDXG",
"status": 403,
"timestamp": 1375091724948