2014-08-16 2 views
0

Я следую процедуре, приведенной в следующем URL-адресе, чтобы удалить файл и папку в поле api.Не удалось удалить файл в поле v2 api

http://developers.box.com/docs/#files-delete-a-file

http://developers.box.com/docs/#folders-delete-a-folder

Я использую следующий код для удаления файлов в окне API. Мне удалось удалить папку, но не удалось удалить файл.

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 ; 

ответ

0

Получено решение. небольшая ошибка

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 ; 
1

Вы сделали правильно, но небольшая ошибка. нужно разместить? вместо & в нижней строке.

str = [NSString stringWithFormat:@"https://api.box.com/2.0/files/%@?access_token=%@&If-Match=%@",folder_id,str_access_token,etag];