-3

我需要从我的 IOS APP 中重命名和删除 box API 中的文件或文件夹。我正在从 box 中获取所有文件并显示在我的应用程序中。我需要从我的应用程序中重命名和删除这些文件。请建议我。

我正在使用以下内容删除框中的文件,

curl https://api.box.com/2.0/folders/FOLDER_ID?recursive=true  \
   -H "Authorization: Bearer ACCESS_TOKEN" \
   -X DELETE

如何重命名文件夹?以及删除也不适用于上述网址?

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

4

2 回答 2

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 ;
    postParams.userInfo = [NSDictionary dictionaryWithObject:@"DeleteFolder" forKey:@"id"];

    NSLog(@"Url is ---> %@",postParams.url);
    NSLog(@"response string is-----> %@",postParams.responseString);
于 2014-08-18T06:33:44.407 回答
0

删除非常简单,因为有用于此指定的 API。

// For folder
BoxFoldersRequestBuilder * builder = [[BoxFoldersRequestBuilder alloc] initWithRecursiveKey:YES];
[boxFoldersResourceManager deleteFolderWithID:identifier
                               requestBuilder:builder
                                      success:successCallback
                                      failure:failureCallback];

// For file
[boxFilesResourceManager deleteFileWithID:identifier
                           requestBuilder:nil
                                  success:successCallback
                                  failure:failureCallback];

并改名。

// For folder
BoxFoldersRequestBuilder *builder = [[BoxFoldersRequestBuilder alloc] init];
builder.name = newName;
[boxFoldersResourceManager editFolderWithID:file.identifier
                             requestBuilder:builder
                                    success:successCallback
                                    failure:failureCallback];
// For file
BoxFilesRequestBuilder *builder = [[BoxFilesRequestBuilder alloc] init];
builder.name = newName;
[boxFilesResourceManager editFileWithID:file.identifier
                         requestBuilder:builder
                                success:successCallback
                                failure:failureCallback];
于 2014-08-26T11:05:24.173 回答