Reputation: 300
I'm following the procedure given in following url's to delete the file and folder in box api .
http://developers.box.com/docs/#files-delete-a-file
http://developers.box.com/docs/#folders-delete-a-folder
I'm using the following code to delete files in box api . I got succeded in deleting the folder but fails in deleting the file .
NSString *str;
if ([type isEqualToString:@"folder"])
{
str = [NSString stringWithFormat:@"https://api.box.com/2.0/folders/%@?recursive=true&access_token=%@",folder_id,str_access_token];
}
else
{
str = [NSString stringWithFormat:@"https://api.box.com/2.0/files/%@&access_token=%@&If-Match=%@",folder_id,str_access_token,etag];
}
ASIFormDataRequest *postParams = [ASIFormDataRequest requestWithURL:[NSURL URLWithString:str]];
[postParams setRequestMethod:@"DELETE"];
[postParams startAsynchronous];
postParams.delegate = self ;
Upvotes: 0
Views: 118
Reputation:
You done correctly but a small mistake . need to place ? instead of & in the below lline.
str = [NSString stringWithFormat:@"https://api.box.com/2.0/files/%@?access_token=%@&If-Match=%@",folder_id,str_access_token,etag];
Upvotes: 1
Reputation: 300
Got the solution . small mistake
NSString *str;
if ([type isEqualToString:@"folder"])
{
str = [NSString stringWithFormat:@"https://api.box.com/2.0/folders/%@?recursive=true&access_token=%@",folder_id,str_access_token];
}
else
{
str = [NSString stringWithFormat:@"https://api.box.com/2.0/files/%@?access_token=%@&If-Match=%@",folder_id,str_access_token,etag];
}
ASIFormDataRequest *postParams = [ASIFormDataRequest requestWithURL:[NSURL URLWithString:str]];
[postParams setRequestMethod:@"DELETE"];
[postParams startAsynchronous];
postParams.delegate = self ;
Upvotes: 0