且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

错误:使用iOS版LinkedIn REST Api进行点赞/点赞和评论

更新时间:2023-01-31 14:19:11

好的,我留给有类似问题的人使用.罪魁祸首是没有为is-Liked键添加'true'的HTTPBody.

Alright, I'm leaving this for people having a similar issue. The culprit was the HTTPBody that was not appending 'true' for is-Liked key.

因此,我为is-Liked手动添加了true,并且成功了.

So I added true for is-Liked manually and that did the trick.

NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"http://api.linkedin.com/v1/people/~/network/updates/key=%@/is-liked",updateKey]];
    OAMutableURLRequest *request =
    [[OAMutableURLRequest alloc] initWithURL:url
                                    consumer:self.consumer
                                       token:self.token
                                    callback:nil
                           signatureProvider:nil];

    [request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
    [request setHTTPBodyWithString:@"true"];// <-this is the magic wand!
    [request setHTTPMethod:@"PUT"];