リテンションポリシーを作成

post
https://api.box.com/2.0
/retention_policies

リテンションポリシーを作成します。

リクエスト

application/json

リクエスト本文

boolean本文内省略可能
true

ポリシーの有効期限が近付いたときにファイルの所有者と共同所有者に通知するかどうか。

boolean本文内省略可能
true

ファイルの所有者がリテンションを延長できるかどうか。

object array本文内省略可能
12312312

通知を送るユーザーのID

apple@example.com

ユーザーが通知に使用するメールアドレス

Tim Apple

通知を送るユーザーの名前

user

次の値に固定: user

string本文内必須
permanently_delete

リテンションポリシーの廃棄アクション。 このアクションをpermanently_deleteに設定すると、ポリシーによって保持されているコンテンツが完全に削除されます。remove_retentionに設定すると、コンテンツへのリテンションポリシーの適用が解除され、リテンションポリシーの有効期限が切れた後は、ユーザーがコンテンツを削除できるようになります。

次の値のいずれか1つ: permanently_delete,remove_retention

string本文内必須
Some Policy Name

リテンションポリシーの名前

string本文内必須
finite

リテンションポリシーのタイプ。リテンションポリシーのタイプは、finite (コンテンツを保持する期間が事前にわかっている場合)、またはindefinite (コンテンツを保持する期間が不明な場合)のいずれかになります。

次の値のいずれか1つ: finite,indefinite

string / int32本文内省略可能
0

リテンションポリシーの期間。これはリテンションポリシーがコンテンツに割り当てられた後、有効である日数を示します。ポリシーのpolicy_typeindefiniteである場合は、retention_lengthindefiniteになります。

レスポンス

新しいリテンションポリシーオブジェクトを返します。

infiniteリテンションポリシーに対してretention_lengthが指定された場合、または誤ったdisposition_actionが設定された場合は、bad_requestエラーを返します。

指定した名前を持つリテンションポリシーがすでに存在する場合は、エラーを返します

予期しないクライアントエラー。

post
リテンションポリシーを作成
このドキュメント内で一部のAPIを試せるようになりました。
ログイン

リクエストの例

cURL
curl -X POST https://api.box.com/2.0/retention_policies \
     -H 'Authorization: Bearer <ACCESS_TOKEN>" '
     -H 'Content-Type: application/json" '
     -d '{
       "policy_name": "Some Policy Name",
       "policy_type": "finite",
       "retention_length": 365,
       "disposition_action": "permanently_delete"
     }'
.NET
var policyParams = new BoxRetentionPolicyRequest()
{
    PolicyName = "Important Documents!",
    PolicyType = "finite",
    RetentionLength = 365,
    DispositionAction = "remove_retention"
};
BoxRetentionPolicy policy = await client.RetentionPoliciesManager
    .CreateRetentionPolicyAsync(policyParams);
Java
BoxRetentionPolicy.createIndefinitePolicy(api, name);
Python
policy_name = 'Test Indefinite Policy Name'
disposition_action = 'remove_retention'
indefinite_retention_policy = client.create_retention_policy(policy_name, disposition_action, float('inf'))
print('Indefinite Retention Policy ID is {0} and the policy name is {1}'.format(indefinite_retention_policy.id, indefinite_retention_policy.policy_name))
Node
client.retentionPolicies.create(
	'Tax Documents',
	client.retentionPolicies.policyTypes.INDEFINITE,
	client.retentionPolicies.dispositionActions.REMOVE_RETENTION)
).then(policy => {
	/* policy -> {
		type: 'retention_policy',
		id: '123456789',
		policy_name: 'Tax Documents',
		policy_type: 'indefinite',
		retention_length: 'indefinite',
		disposition_action: 'remove_retention',
		can_owner_extend_retention: false,
		status: 'active',
		are_owners_notified: true,
		custom_notification_recipients: []
		assignment_counts: { enterprise: 0, folder: 1, metadata_template: 0 },
		created_by: 
		{ type: 'user',
			id: '11111',
			name: 'Example User',
			login: 'user@example.com' },
		created_at: '2015-05-01T11:12:54-07:00',
		modified_at: '2015-06-08T11:11:50-07:00' }
	*/
});