Skip to content

Latest commit

 

History

History
218 lines (154 loc) · 6.3 KB

WebhooksApi.md

File metadata and controls

218 lines (154 loc) · 6.3 KB

portainer_ce_api.WebhooksApi

All URIs are relative to http://localhost/api

Method HTTP request Description
webhooks_get GET /webhooks List webhooks
webhooks_id_delete DELETE /webhooks/{id} Delete a webhook
webhooks_post POST /webhooks Create a webhook
webhooks_token_post POST /webhooks/{token} Execute a webhook

webhooks_get

list[PortainerWebhook] webhooks_get(body, endpoint_id=endpoint_id, resource_id=resource_id)

List webhooks

Example

from __future__ import print_function
import time
import portainer_ce_api
from portainer_ce_api.rest import ApiException
from pprint import pprint

# Configure API key authorization: jwt
configuration = portainer_ce_api.Configuration()
configuration.api_key['Authorization'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Authorization'] = 'Bearer'

# create an instance of the API class
api_instance = portainer_ce_api.WebhooksApi(portainer_ce_api.ApiClient(configuration))
body = portainer_ce_api.WebhooksWebhookCreatePayload() # WebhooksWebhookCreatePayload | Webhook data
endpoint_id = 56 # int |  (optional)
resource_id = 'resource_id_example' # str |  (optional)

try:
    # List webhooks
    api_response = api_instance.webhooks_get(body, endpoint_id=endpoint_id, resource_id=resource_id)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling WebhooksApi->webhooks_get: %s\n" % e)

Parameters

Name Type Description Notes
body WebhooksWebhookCreatePayload Webhook data
endpoint_id int [optional]
resource_id str [optional]

Return type

list[PortainerWebhook]

Authorization

jwt

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

webhooks_id_delete

webhooks_id_delete(id)

Delete a webhook

Example

from __future__ import print_function
import time
import portainer_ce_api
from portainer_ce_api.rest import ApiException
from pprint import pprint

# Configure API key authorization: jwt
configuration = portainer_ce_api.Configuration()
configuration.api_key['Authorization'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Authorization'] = 'Bearer'

# create an instance of the API class
api_instance = portainer_ce_api.WebhooksApi(portainer_ce_api.ApiClient(configuration))
id = 56 # int | Webhook id

try:
    # Delete a webhook
    api_instance.webhooks_id_delete(id)
except ApiException as e:
    print("Exception when calling WebhooksApi->webhooks_id_delete: %s\n" % e)

Parameters

Name Type Description Notes
id int Webhook id

Return type

void (empty response body)

Authorization

jwt

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

webhooks_post

PortainerWebhook webhooks_post(body)

Create a webhook

Example

from __future__ import print_function
import time
import portainer_ce_api
from portainer_ce_api.rest import ApiException
from pprint import pprint

# Configure API key authorization: jwt
configuration = portainer_ce_api.Configuration()
configuration.api_key['Authorization'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Authorization'] = 'Bearer'

# create an instance of the API class
api_instance = portainer_ce_api.WebhooksApi(portainer_ce_api.ApiClient(configuration))
body = portainer_ce_api.WebhooksWebhookCreatePayload() # WebhooksWebhookCreatePayload | Webhook data

try:
    # Create a webhook
    api_response = api_instance.webhooks_post(body)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling WebhooksApi->webhooks_post: %s\n" % e)

Parameters

Name Type Description Notes
body WebhooksWebhookCreatePayload Webhook data

Return type

PortainerWebhook

Authorization

jwt

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

webhooks_token_post

webhooks_token_post(token)

Execute a webhook

Acts on a passed in token UUID to restart the docker service

Example

from __future__ import print_function
import time
import portainer_ce_api
from portainer_ce_api.rest import ApiException
from pprint import pprint

# create an instance of the API class
api_instance = portainer_ce_api.WebhooksApi()
token = 'token_example' # str | Webhook token

try:
    # Execute a webhook
    api_instance.webhooks_token_post(token)
except ApiException as e:
    print("Exception when calling WebhooksApi->webhooks_token_post: %s\n" % e)

Parameters

Name Type Description Notes
token str Webhook token

Return type

void (empty response body)

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]