发送消息API错误

时间:2011-04-29 08:25:07

标签: api iphone-sdk-3.0 linkedin

我从我的iphone应用程序发送带有XML body的发送消息请求

<mailbox-item><recipients><recipient><person path='/people/93619553' /></recipient><recipient><person path='/people/116008244' /></recipient><recipient><person path='/people/96885725' /></recipient></recipients><subject>Message from butterfli</subject><body>Aasd</body></mailbox-item>

但是收到此错误

++ LinkedIn engine reports failure for connection 3CD3052A-7061-4EA0-8863-5584270B9177
The operation couldn’t be completed. (HTTP error 404.)

代码是

- (RDLinkedInConnectionID *)sendMessage:(NSDictionary *)shareDict {
    NSURL* url = [NSURL URLWithString:[kAPIBaseURL stringByAppendingString:@"/v1/people/~/mailbox"]];
    NSString *xmlStr = @"<mailbox-item><recipients>";
    NSArray *toIdArray = [[shareDict objectForKey:@"privacy"] componentsSeparatedByString:@","];
    for (int l=0; l<[toIdArray count]; l++) {
        xmlStr = [xmlStr stringByAppendingString:[NSString stringWithFormat:@"<recipient><person path='/people/%@' /></recipient>",
                                                  [toIdArray objectAtIndex:l]]];
    }
    xmlStr = [xmlStr stringByAppendingString:[NSString stringWithFormat:@"</recipients><subject>%@</subject><body>%@</body></mailbox-item>",
                                              @"Message from butterfli",[shareDict objectForKey:@"text_message"]]];

    [NSString stringWithFormat:@"<share><comment>%@</comment><content><submitted-url>%@</submitted-url></content><visibility><code>anyone</code></visibility></share>",
                        [shareDict objectForKey:@"link_msg"],[shareDict objectForKey:@"link"]];
    NSData *body = [xmlStr dataUsingEncoding:NSUTF8StringEncoding];
    NSLog(@"xmlStr..%@",xmlStr);
    return [self sendAPIRequestWithURL:url HTTPMethod:@"POST" body:body];
}

Amit Battan

1 个答案:

答案 0 :(得分:0)

它之前不是一个封闭的问题......

但现在解决方案是

它的完成......
在它之前,我硬编码了用户ID,该用户ID显示在Web上的用户配置文件的URL中 但它的工作正常,通过API来发送用户的身份。
但没有得到为什么linkedin用户不同的ID?


LinkedIn为每个用户/应用程序组合使用唯一的用户ID来保护用户的隐私。只有最初请求(并获得)成员身份验证的应用程序才能使用该令牌来检索更多信息。

http://developer.linkedin.com/thread/3044