Like/Unlike and Comment using REST Api for iOS I'm using the following url and pattern for liking a network post. I get the response as
"Can not parse JSON is-liked document"
. If I make 'is-liked=true' in the url I get the message:
"Unknown field {is-liked=true} in resource {Update}"
. I don't know what must be wrong. Please help.
Here's my code:
updateKey= @"UNIU-c1028-5809277741404942336-SHARE";
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:@"json" forHTTPHeaderField:@"x-li-format"];
[request setHTTPMethod:@"PUT"];
I had the same problem, i found the solution after spending many hours using NSMutableURLRequest combined with AFHTTPRequestOperation of AFNetworking. Try this code:
Alright, I'm leaving this for people having a similar issue. The culprit was the HTTPBody that was not appending '
true
' foris-Liked
key.So I added true for is-Liked manually and that did the trick.