Box Developerドキュメント

Webhookを取得

get
https://api.box.com/2.0
/webhooks/:webhook_id

特定のWebhookを取得します。

リクエスト

bearer [ACCESS_TOKEN]
application/json

パスパラメータ

stringパス内必須
3321123

WebhookのID。

レスポンス

application/jsonWebhook

Webhookオブジェクトを返します

アプリケーションにWebhookを管理する権限が付与されていない場合は、エラーを返します。

Webhookが見つからなかった場合は、エラーを返します

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

get
Webhookを取得
このドキュメント内で一部のAPIを試せるようになりました。
ログイン

リクエストの例

cURL
curl -i -X GET "https://api.box.com/2.0/webhooks/3321123" \
     -H "authorization: Bearer <ACCESS_TOKEN>"
TypeScript Gen
await client.webhooks.getWebhookById(webhook.id!);
Python Gen
client.webhooks.get_webhook_by_id(webhook.id)
.NET Gen
await client.Webhooks.GetWebhookByIdAsync(webhookId: NullableUtils.Unwrap(webhook.Id));
Java
BoxWebHook webhook = new BoxWebHook(api, id);
BoxWebHook.Info info = webhook.getInfo();
Python
webhook = client.webhook(webhook_id='12345').get()
print(f'Webhooks ID is {webhook.id} and the address is {webhook.address}')
.NET
BoxWebhook webhook = await client.WebhooksManager.GetWebhookAsync("12345");
Node
client.webhooks.get('1234')
	.then(webhook => {
		/* webhook -> {
			id: '1234',
			type: 'webhook',
			target: { id: '22222', type: 'folder' },
			created_by: 
			{ type: 'user',
				id: '33333',
				name: 'Example User',
				login: 'user@example.com' },
			created_at: '2016-05-09T17:41:27-07:00',
			address: 'https://example.com/webhook',
			triggers: [ 'FILE.DOWNLOADED', 'FILE.UPLOADED' ] }
		*/
	});
iOS
client.folders.get(webhookId: "22222", fields: ["id", "created_at"]) { (result: Result<Webhook, BoxSDKError>) in
    guard case let .success(webhook) = result else {
        print("Error getting webhook information")
        return
    }

    print("Webhook \(webhook.id) was created at \(webhook.createdAt)")
}

レスポンスの例

{
  "id": "11446498",
  "type": "webhook",
  "address": "https://example.com/webhooks",
  "created_at": "2012-12-12T10:53:43-08:00",
  "created_by": {
    "id": "11446498",
    "type": "user",
    "login": "ceo@example.com",
    "name": "Aaron Levie"
  },
  "target": {
    "id": "1231232",
    "type": "file"
  },
  "triggers": [
    "FILE.UPLOADED"
  ]
}