日本時間5月16日のContent Cloud Summitで、カスタムアプリにBox AI APIを活用する方法を紹介します。

詳細を表示

すべてのリテンションポリシーのリストの取得

ガイド リテンションポリシー すべてのリテンションポリシーのリストの取得

すべてのリテンションポリシーのリストの取得

会社内に作成されたすべてのリテンションポリシーのリストを取得するには、GET /retention_policies APIエンドポイントを呼び出します。

cURL
curl -i -X GET "https://api.box.com/2.0/retention_policies" \
     -H "authorization: Bearer <ACCESS_TOKEN>"
.NET
BoxCollectionMarkerBased<BoxRetentionPolicy> policies = await client.RetentionPoliciesManager
    .GetRetentionPoliciesAsync();
Java
Iterable<BoxRetentionPolicy.Info> policies = BoxRetentionPolicy.getAll(api);
for (BoxRetentionPolicy.Info policyInfo : policies) {
	// Do something with the retention policy.
}
Python
retention_policies = client.get_retention_policies()
for policy in retention_policies:
    print(f'The policy ID is {policy.id} and the name is {policy.policy_name}')
Node
client.retentionPolicies.getAll({ policy_name: 'Tax' }).then((policies) => {
	/* policies -> {
			entries:
			[ { type: 'retention_policy',
				id: '123456789',
				name: 'Tax Documents' } ],
			limit: 100,
			next_marker: 'someMarkerString' }
		*/
});
iOS
let iterator = client.retentionPolicy.list(type: .indefinite)
iterator.next { results in
    switch results {
    case let .success(page):
        for policy in page.entries {
            print("Retention policy \(policy.id)")
        }
        
    case let .failure(error):
        print(error)
    }
}

必須のスコープ

リテンションポリシーAPIのいずれかを使用する前に、アプリケーションでは適切なスコープを有効にしておく必要があります。詳細については、必須のスコープを参照してください。