Mac OS X support #5

Closed
flemingm opened this Issue Jan 31, 2012 · 6 comments

Projects

None yet

2 participants

I've added a new target to IOS project that support Mac OS X following REST API Commands. are implemented so far.

-(void) getUserProfile;
-(NSURL *) getUserProfileImage;

  • (void) getPermissions;
  • (void) getUserAlbums;

// Not working yet: createAlbum getting missing 'name' & Untested: udpateAlbums

  • (void) createAlbum: (NSString ) theFolderName folderDescription: (NSString) description;
  • (void) udpateAlbums: (NSString ) inFolderID folderName: (NSString *) theFolderName folderDescription: (NSString) description;
  • (void) getMediaInfo: (NSString *) mediaID options: (NSDictionary *) options;
  • (void) getTags: (NSString *) mediaID options: (NSDictionary *) options; // limit=2 etc
  • (void) getComments: (NSString *) mediaID options: (NSDictionary *) options;
  • (void) getUserContacts: (NSString *)contentID;

//- (void) createContacts: (NSString *)contentID contactList: (NSDictionary *) newContacts;

  • (void) getUserFriends;
  • (void) getUserApplications;
  • (void) getFolderProperties: (NSString *) folderID options: (NSDictionary *) optionsDict;
  • (void) getFileListInFolder: (NSString *) folderID options: (NSDictionary *) optionsDict;
  • (void) getFileProperties: (NSString *) fileID;
  • (NSString *) getFileURLString: (NSString *) fileID;

But I am having issue with creating albums JSON Body contains:

createAlbum call with JSON Body: '{ 'name' : 'iWatermark Pro' } type: "album"
'
2012-01-30 21:29:35.833 LiveServicesMacOS[39187:a0f] startPOSTRequest /v5.0/me/skydrive as Type: application/json
body: 45 lenth
2012-01-30 21:29:37.278 LiveServicesMacOS[39187:a0f] response: 400 - URL path /v5.0/me/skydrive
2012-01-30 21:29:37.278 LiveServicesMacOS[39187:a0f] Path: @ error: /v5.0/me/skydrive
Error return:

error = {
code = "request_parameter_missing";
message = "The provided request entity body is missing a required parameter 'name'. Required parameters are the following: 'name'.";
};
}

Any suggestions?

I also using JSON Parser :

@mainpage A strict JSON parser and generator for Objective-C

JSON (JavaScript Object Notation) is a lightweight data-interchange
format. This framework provides two apis for parsing and generating
JSON. One standard object-based and a higher level api consisting of
categories added to existing Objective-C classes.

Learn more on the http://code.google.com/p/json-framework project site.

This framework does its best to be as strict as possible, both in what it
accepts and what it generates. For example, it does not support trailing commas
in arrays or objects. Nor does it support embedded comments, or
anything else not in the JSON specification. This is considered a feature.

@ghost
Contributor
ghost commented Jan 31, 2012

Thanks for your feedback! The issue you are facing is around the json body created.
The format expected by the REST Services is as such:-

{
"name": "iWatermark Pro",
"type": "album"
}

Can you try and let me know how it works out.
Thanks
Deepesh

flemingm commented Feb 2, 2012

POST on create albums (debug log):

createAlbum Watermarked by iWatermark Pro
Body: '{
"name": "iWatermark Pro",
"type" : "album"
}'
2012-02-01 22:24:27.032 LiveServicesMacOS[54970:a0f] restUrl https://apis.live.net/v5.0/me/skydrive?access_token=EwA4Aq1DBAAUlb ... 08MAAA%3d%3d
Body: '{
"name": "iWatermark Pro",
"type" : "album"
}'
2012-02-01 22:24:27.032 LiveServicesMacOS[54970:a0f] startPOSTRequest /v5.0/me/skydrive as Type: application/json
body: 46
2012-02-01 22:24:27.707 LiveServicesMacOS[54970:a0f] response: 400 - URL path /v5.0/me/skydrive

Getting:

{
error = {
code = "request_parameter_missing";
message = "The provided request entity body is missing a required parameter 'name'. Required parameters are the following: 'name'.";
};
}

also tried:

Body: '{{
"name": "iWatermark Pro"},
"type" : "album"
}'

same message.

flemingm commented Feb 2, 2012

also BODY is encoded with UTF8 Encoding

flemingm commented Feb 2, 2012

solved it forgot to set

HTTPHeaderField: "Content-Type" to  "application/json";

on post.

feedback: error message should include contact type of message sent.

also very useful for playing is:
http://isdk.dev.live.com/

@flemingm flemingm closed this Feb 2, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment