Created
June 25, 2015 13:24
-
-
Save KiriKiri/56ec89a15cc5ce81a474 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)newShareWithToken:(NSString *)accessToken | |
{ | |
AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; | |
AFJSONRequestSerializer *serializer = [AFJSONRequestSerializer serializer]; | |
[serializer setValue:[NSString stringWithFormat:@"Bearer %@", accessToken] forHTTPHeaderField:@"Authorization"]; | |
[serializer setValue:@"application/json" forHTTPHeaderField:@"Content-Type"]; | |
[serializer setValue:@"json" forHTTPHeaderField:@"x-li-format"]; | |
manager.requestSerializer = serializer; | |
NSDictionary *params = @{@"comment": @"Check out developer.linkedin.com! http://linkd.in/1FC2PyG", | |
@"visibility": @{@"code": @"anyone"}, @"content":@{ | |
@"title":@"Title", | |
@"description":@"Description", | |
@"submitted-url":@"http://linkd.in/1FC2PyG" | |
}}; | |
[manager POST:@"https://api.linkedin.com/v1/people/~/shares?format=json" parameters:params | |
success:^(AFHTTPRequestOperation *operation, id responseObject) | |
{ | |
NSLog(@"JSON: %@", responseObject); | |
} | |
failure: | |
^(AFHTTPRequestOperation *operation, NSError *error) { | |
NSLog(@"Error: %@", error); | |
}]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment