发送消息 API 错误
我正在从我的 iPhone 应用程序发送带有 XML 正文的发送消息请求
<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
I am sending send message request with XML bodyfrom my iphone application
<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>
But getting this error
++ LinkedIn engine reports failure for connection 3CD3052A-7061-4EA0-8863-5584270B9177
The operation couldn’t be completed. (HTTP error 404.)
Code is
- (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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它之前不是一个已解决的问题...
但现在解决方案已经
完成...
在此之前,我对用户 ID 进行了硬编码,该 ID 显示在 Web 上用户个人资料的 URL 中。
但它可以正常使用通过 API 传入的用户 ID ..
但不明白为什么linkedin用户使用不同的id?
作为
LinkedIn 对每个用户/应用程序组合使用唯一的用户 ID 来保护用户的隐私。只有最初请求(并获得)成员身份验证的应用程序才能使用该令牌来检索更多信息。
http://developer.linkedin.com/thread/3044
its not a closed issue before it...
But now the solution is
its done...
Before it I am hardcoded the user id which is shown in the URL of user profile on Web.
But its working ok with id of user which is coming through API ..
But not getting why linkedin user different ids??
as
LinkedIn use unique user IDs for each user/application combination to protect user's privacy. Only the application which originally requested (and got) authentication from the member can use that token to retrieve further information.
http://developer.linkedin.com/thread/3044