ファイルリクエストのコピー
ファイルリクエストのコピー
既存のテンプレートファイルリクエストのコピーを作成するために必要なのは、その一意のIDと、新しいファイルリクエストの適用先となるフォルダのIDだけです。
cURL
curl -i -X POST "https://api.box.com/2.0/file_requests/42037322/copy" \
-H "authorization: Bearer <ACCESS_TOKEN>" \
-d '{
"title": "Please upload required documents",
"description": "Please upload required documents",
"status": "active",
"is_email_required": true,
"is_description_required": false,
"folder": {
"id": "2233212",
"type": "folder"
}
}'
TypeScript Gen
await client.fileRequests.createFileRequestCopy(fileRequestId, {
folder: {
id: fileRequest.folder.id,
type: 'folder' as FileRequestCopyRequestFolderTypeField,
} satisfies FileRequestCopyRequestFolderField,
} satisfies FileRequestCopyRequest);
Python Gen
client.file_requests.create_file_request_copy(
file_request_id,
CreateFileRequestCopyFolder(
id=file_request.folder.id,
type=CreateFileRequestCopyFolderTypeField.FOLDER.value,
),
)
.NET Gen
await client.FileRequests.CreateFileRequestCopyAsync(fileRequestId: fileRequestId, requestBody: new FileRequestCopyRequest(folder: new FileRequestCopyRequestFolderField(id: fileRequest.Folder.Id) { Type = FileRequestCopyRequestFolderTypeField.Folder }));
Java
BoxFileRequest fileRequest = new BoxFileRequest(api, "id");
BoxFileRequest.Info fileRequestInfo = fileRequest.new Info();
fileRequestInfo.setDescription("Following documents are requested for your process");
fileRequestInfo.setIsDescriptionRequired(true);
fileRequestInfo.setStatus(BoxFileRequest.Status.ACTIVE);
fileRequestInfo = fileRequest.copyInfo(fileRequestInfo, "folderId");
Python
file_request = client.file_request(file_request_id='123456')
folder = client.folder(folder_id='123456789')
new_file_request = file_request.copy(folder=folder, title="Copied file request")
.NET
var destinationFolder = new BoxRequestEntity
{
Id = "123456",
Type = BoxType.folder
};
var copyRequest = new BoxFileRequestCopyRequest
{
Description = "New file request description",
Folder = destinationFolder
};
BoxFileRequestObject fileRequest = await client.FileRequestsManager.CopyFileRequestAsync("12345", copyRequest);
Node
client.fileRequests.copy(fileRequestId, {
folder: {
id: '157979815648',
type: 'folder'
}
}).then((r: FileRequest) => {
// do something with the copied file request
console.log(r)
});
iOS
let destinationFolder = FolderEntity(id: "33333")
let copyRequest = FileRequestCopyRequest(
title: "New file request title",
description: "New file request description",
isEmailRequired: true,
isDescriptionRequired: false,
folder: destinationFolder
)
client.fileRequests.copy(fileRequestId: "123456", copyRequest: copyRequest) { result in
guard case let .success(fileRequest) = result else {
print("Error copying file request")
return
}
print("Copied file request title: \(fileRequest.title ?? "n/a"), description: \(fileRequest.description ?? "n/a")")
}
コピー時にファイルリクエストを更新する
テンプレートからコピーする際、ファイルリクエストに基本的な変更を行うことができます。ファイルリクエストをテンプレートからコピーするときに更新できるのは、ファイルリクエストのタイトル、説明、ステータス、およびその他いくつかの設定です。
curl -i -X POST "https://api.box.com/2.0/file_requests/2342235/copy" \
-H "Authorization: Bearer <ACCESS_TOKEN>" \
-d '{
"title": "Please upload required documents",
"description": "Please upload required documents",
"status": "active",
"is_email_required": true,
"is_description_required": false,
"folder": {
"id": "342323423"
}
}'