@@ -23,6 +23,21 @@ def baseurl(self) -> str:
23
23
24
24
@api (version = "3.6" )
25
25
def get (self , req_options : Optional ["RequestOptions" ] = None ) -> tuple [list [WebhookItem ], PaginationItem ]:
26
+ """
27
+ Returns a list of all webhooks on the site.
28
+
29
+ REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref.htm#list_webhooks_for_site
30
+
31
+ Parameters
32
+ ----------
33
+ req_options : Optional[RequestOptions]
34
+ Filter and sorting options for the request.
35
+
36
+ Returns
37
+ -------
38
+ tuple[list[WebhookItem], PaginationItem]
39
+ A tuple of the list of webhooks and pagination item
40
8000
+ """
26
41
logger .info ("Querying all Webhooks on site" )
27
42
url = self .baseurl
28
43
server_response = self .get_request (url , req_options )
@@ -32,6 +47,21 @@ def get(self, req_options: Optional["RequestOptions"] = None) -> tuple[list[Webh
32
47
33
48
@api (version = "3.6" )
34
49
def get_by_id (self , webhook_id : str ) -> WebhookItem :
50
+ """
51
+ Returns information about a specified Webhook.
52
+
53
+ Rest API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref.htm#get_webhook
54
+
55
+ Parameters
56
+ ----------
57
+ webhook_id : str
58
+ The ID of the webhook to query.
59
+
60
+ Returns
61
+ -------
62
+ WebhookItem
63
+ An object containing information about the webhook.
64
+ """
35
65
8000
if not webhook_id :
36
66
error = "Webhook ID undefined."
37
67
raise ValueError (error )
@@ -42,6 +72,20 @@ def get_by_id(self, webhook_id: str) -> WebhookItem:
42
72
43
73
@api (version = "3.6" )
44
74
def delete (self , webhook_id : str ) -> None :
75
+ """
76
+ Deletes a specified webhook.
77
+
78
+ REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref.htm#delete_webhook
79
+
80
+ Parameters
81
+ ----------
82
+ webhook_id : str
83
+ The ID of the webhook to delete.
84
+
85
+ Returns
86
+ -------
87
+ None
88
+ """
45
89
if not webhook_id :
46
90
error = "Webhook ID undefined."
47
91
raise ValueError (error )
@@ -51,6 +95,21 @@ def delete(self, webhook_id: str) -> None:
51
95
52
96
@api (version = "3.6" )
53
97
def create (self , webhook_item : WebhookItem ) -> WebhookItem :
98
+ """
99
+ Creates a new webhook on the site.
100
+
101
+ REST API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref.htm#create_webhook
102
+
103
+ Parameters
104
+ ----------
105
+ webhook_item : WebhookItem
106
+ The webhook item to create.
107
+
108
+ Returns
109
+ -------
110
+ WebhookItem
111
+ An object containing information about the created webhook
112
+ """
54
113
url = self .baseurl
55
114
create_req = RequestFactory .Webhook .create_req (webhook_item )
56
115
server_response = self .post_request (url , create_req )
@@ -61,6 +120,24 @@ def create(self, webhook_item: WebhookItem) -> WebhookItem:
61
120
62
121
@api (version = "3.6" )
63
122
def test (self , webhook_id : str ):
123
+ """
124
+ Tests the specified webhook. Sends an empty payload to the configured
125
+ destination URL of the webhook and returns the response from the server.
126
+ This is useful for testing, to ensure that things are being sent from
127
+ Tableau and received back as expected.
128
+
129
+ Rest API: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref.htm#test_webhook
130
+
131
+ Parameters
132
+ ----------
133
+ webhook_id : str
134
+ The ID of the webhook to test.
135
+
136
+ Returns
137
+ -------
138
+ XML Response
139
+
140
+ """
64
141
if not webhook_id :
65
142
error = "Webhook ID undefined."
66
143
raise ValueError (error )
0 commit comments