Skip to content

develbro/portainer_ce_api

 
 

Repository files navigation

portainer-ce-api

Portainer API is an HTTP API served by Portainer. It is used by the Portainer UI and everything you can do with the UI can be done using the HTTP API. Examples are available at https://documentation.portainer.io/api/api-examples/ You can find out more about Portainer at http://portainer.io and get some support on Slack. # Authentication Most of the API endpoints require to be authenticated as well as some level of authorization to be used. Portainer API uses JSON Web Token to manage authentication and thus requires you to provide a token in the Authorization header of each request with the Bearer authentication mechanism. Example: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwidXNlcm5hbWUiOiJhZG1pbiIsInJvbGUiOjEsImV4cCI6MTQ5OTM3NjE1NH0.NJ6vE8FY1WG6jsRQzfMqeatJ4vh2TWAeeYfDhP71YEE # Security Each API endpoint has an associated access policy, it is documented in the description of each endpoint. Different access policies are available: - Public access - Authenticated access - Restricted access - Administrator access ### Public access No authentication is required to access the endpoints with this access policy. ### Authenticated access Authentication is required to access the endpoints with this access policy. ### Restricted access Authentication is required to access the endpoints with this access policy. Extra-checks might be added to ensure access to the resource is granted. Returned data might also be filtered. ### Administrator access Authentication as well as an administrator role are required to access the endpoints with this access policy. # Execute Docker requests Portainer DOES NOT expose specific endpoints to manage your Docker resources (create a container, remove a volume, etc...). Instead, it acts as a reverse-proxy to the Docker HTTP API. This means that you can execute Docker requests via the Portainer HTTP API. To do so, you can use the /endpoints/{id}/docker Portainer API endpoint (which is not documented below due to Swagger limitations). This endpoint has a restricted access policy so you still need to be authenticated to be able to query this endpoint. Any query on this endpoint will be proxied to the Docker API of the associated endpoint (requests and responses objects are the same as documented in the Docker API). NOTE: You can find more information on how to query the Docker API in the Docker official documentation as well as in this Portainer example.

This Python package is automatically generated by the Swagger Codegen project:

  • API version: 2.6.0
  • Package version: 2.6.0
  • Build package: io.swagger.codegen.languages.PythonClientCodegen

Requirements.

Python 2.7 and 3.4+

Installation & Usage

pip install

If the python package is hosted on Github, you can install directly from Github

pip install portainer-ce-api

(you may need to run pip with root permission: sudo pip install portainer-ce-api)

Then import the package:

import portainer_ce_api 

Setuptools

Install via Setuptools.

python setup.py install --user

(or sudo python setup.py install to install the package for all users)

Then import the package:

import portainer_ce_api

Getting Started

Please follow the installation procedure and then run the following:

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.DefaultApi(portainer_ce_api.ApiClient(configuration))
id = 56 # int | Team identifier
body = portainer_ce_api.TeamsTeamUpdatePayload() # TeamsTeamUpdatePayload | Team details

try:
    # Update a team
    api_response = api_instance.team_update(id, body)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling DefaultApi->team_update: %s\n" % e)

Documentation for API Endpoints

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

Class Method HTTP request Description
DefaultApi team_update PUT /team/{id} Update a team
DefaultApi user_admin_init POST /users/admin/init Initialize administrator account
AuthApi authenticate_user POST /auth Authenticate
AuthApi logout POST /auth/logout Logout
AuthApi validate_o_auth POST /auth/oauth/validate Authenticate with OAuth
BackupApi backup POST /backup Creates an archive with a system data snapshot that could be used to restore the system.
BackupApi restore POST /restore Triggers a system restore using provided backup file
CustomTemplatesApi custom_template_create POST /custom_templates Create a custom template
CustomTemplatesApi custom_template_delete DELETE /custom_templates/{id} Remove a template
CustomTemplatesApi custom_template_file GET /custom_templates/{id}/file Get Template stack file content.
CustomTemplatesApi custom_template_inspect GET /custom_templates/{id} Inspect a custom template
CustomTemplatesApi custom_template_list GET /custom_templates List available custom templates
CustomTemplatesApi custom_template_update PUT /custom_templates/{id} Update a template
DockerhubApi docker_hub_inspect GET /dockerhub Retrieve DockerHub information
DockerhubApi docker_hub_update PUT /dockerhub Update DockerHub information
EdgeApi endpoints_id_edge_jobs_job_id_logs_post POST /endpoints/{id}/edge/jobs/{jobID}/logs Inspect an EdgeJob Log
EdgeApi endpoints_id_edge_stacks_stack_id_get GET /endpoints/{id}/edge/stacks/{stackId} Inspect an Edge Stack for an Endpoint
EdgeGroupsApi edge_group_create POST /edge_groups Create an EdgeGroup
EdgeGroupsApi edge_group_delete DELETE /edge_groups/{id} Deletes an EdgeGroup
EdgeGroupsApi edge_group_inspect GET /edge_groups/{id} Inspects an EdgeGroup
EdgeGroupsApi edge_group_list GET /edge_groups list EdgeGroups
EdgeGroupsApi ege_group_update PUT /edge_groups/{id} Updates an EdgeGroup
EdgeJobsApi edge_job_create POST /edge_jobs Create an EdgeJob
EdgeJobsApi edge_job_delete DELETE /edge_jobs/{id} Delete an EdgeJob
EdgeJobsApi edge_job_file GET /edge_jobs/{id}/file Fetch a file of an EdgeJob
EdgeJobsApi edge_job_inspect GET /edge_jobs/{id} Inspect an EdgeJob
EdgeJobsApi edge_job_list GET /edge_jobs Fetch EdgeJobs list
EdgeJobsApi edge_job_task_logs_inspect GET /edge_jobs/{id}/tasks/{taskID}/logs Fetch the log for a specifc task on an EdgeJob
EdgeJobsApi edge_job_tasks_clear DELETE /edge_jobs/{id}/tasks/{taskID}/logs Clear the log for a specifc task on an EdgeJob
EdgeJobsApi edge_job_tasks_collect POST /edge_jobs/{id}/tasks/{taskID}/logs Collect the log for a specifc task on an EdgeJob
EdgeJobsApi edge_job_tasks_list GET /edge_jobs/{id}/tasks Fetch the list of tasks on an EdgeJob
EdgeJobsApi edge_job_update POST /edge_jobs/{id} Update an EdgeJob
EdgeStacksApi edge_stack_create POST /edge_stacks Create an EdgeStack
EdgeStacksApi edge_stack_delete DELETE /edge_stacks/{id} Delete an EdgeStack
EdgeStacksApi edge_stack_file GET /edge_stacks/{id}/file Fetches the stack file for an EdgeStack
EdgeStacksApi edge_stack_inspect GET /edge_stacks/{id} Inspect an EdgeStack
EdgeStacksApi edge_stack_list GET /edge_stacks Fetches the list of EdgeStacks
EdgeStacksApi edge_stack_status_update PUT /edge_stacks/{id}/status Update an EdgeStack status
EdgeStacksApi edge_stack_update PUT /edge_stacks/{id} Update an EdgeStack
EdgeStacksApi endpoints_id_edge_stacks_stack_id_get GET /endpoints/{id}/edge/stacks/{stackId} Inspect an Edge Stack for an Endpoint
EdgeTemplatesApi edge_template_list GET /edge_templates Fetches the list of Edge Templates
EndpointGroupsApi endpoint_group_add_endpoint PUT /endpoint_groups/{id}/endpoints/{endpointId} Add an endpoint to an endpoint group
EndpointGroupsApi endpoint_group_delete DELETE /endpoint_groups/{id} Remove an endpoint group
EndpointGroupsApi endpoint_group_delete_endpoint DELETE /endpoint_groups/{id}/endpoints/{endpointId} Removes endpoint from an endpoint group
EndpointGroupsApi endpoint_group_list GET /endpoint_groups List Endpoint groups
EndpointGroupsApi endpoint_group_update PUT /endpoint_groups/:id Update an endpoint group
EndpointGroupsApi endpoint_groups_post POST /endpoint_groups Create an Endpoint Group
EndpointGroupsApi endpoint_groupsid_get GET /endpoint_groups/:id Inspect an Endpoint group
EndpointsApi endpoint_create POST /endpoints Create a new endpoint
EndpointsApi endpoint_delete DELETE /endpoints/{id} Remove an endpoint
EndpointsApi endpoint_inspect GET /endpoints/{id} Inspect an endpoint
EndpointsApi endpoint_list GET /endpoints List endpoints
EndpointsApi endpoint_settings_update PUT /api/endpoints/:id/settings Update settings for an endpoint
EndpointsApi endpoint_snapshot POST /endpoints/{id}/snapshot Snapshots an endpoint
EndpointsApi endpoint_snapshots POST /endpoints/snapshot Snapshot all endpoints
EndpointsApi endpoint_status_inspect GET /endpoints/{id}/status Get endpoint status
EndpointsApi endpoint_update PUT /endpoints/{id} Update an endpoint
EndpointsApi endpoints_id_edge_jobs_job_id_logs_post POST /endpoints/{id}/edge/jobs/{jobID}/logs Inspect an EdgeJob Log
EndpointsApi endpoints_id_edge_stacks_stack_id_get GET /endpoints/{id}/edge/stacks/{stackId} Inspect an Edge Stack for an Endpoint
MotdApi motd_get GET /motd fetches the message of the day
RegistriesApi registry_configure POST /registries/{id}/configure Configures a registry
RegistriesApi registry_create POST /registries Create a new registry
RegistriesApi registry_delete DELETE /registries/{id} Remove a registry
RegistriesApi registry_inspect GET /registries/{id} Inspect a registry
RegistriesApi registry_list GET /registries List Registries
RegistriesApi registry_update PUT /registries/{id} Update a registry
ResourceControlsApi resource_control_create POST /resource_controls Create a new resource control
ResourceControlsApi resource_control_delete DELETE /resource_controls/{id} Remove a resource control
ResourceControlsApi resource_control_update PUT /resource_controls/{id} Update a resource control
RolesApi role_list GET /roles List roles
SettingsApi settings_inspect GET /settings Retrieve Portainer settings
SettingsApi settings_ldap_check PUT /settings/ldap/check Test LDAP connectivity
SettingsApi settings_public GET /settings/public Retrieve Portainer public settings
SettingsApi settings_update PUT /settings Update Portainer settings
StacksApi stack_create POST /stacks Deploy a new stack
StacksApi stack_delete DELETE /stacks/{id} Remove a stack
StacksApi stack_file_inspect GET /stacks/{id}/file Retrieve the content of the Stack file for the specified stack
StacksApi stack_inspect GET /stacks/{id} Inspect a stack
StacksApi stack_list GET /stacks List stacks
StacksApi stack_migrate POST /stacks/{id}/migrate Migrate a stack to another endpoint
StacksApi stack_start POST /stacks/{id}/start Starts a stopped Stack
StacksApi stack_stop POST /stacks/{id}/stop Stops a stopped Stack
StacksApi stack_update PUT /stacks/{id} Update a stack
StatusApi status_inspect GET /status Check Portainer status
StatusApi status_inspect_version GET /status/version Check for portainer updates
TagsApi tag_create POST /tags Create a new tag
TagsApi tag_delete DELETE /tags/{id} Remove a tag
TagsApi tag_list GET /tags List tags
TeamMembershipsApi team_membership_create POST /team_memberships Create a new team membership
TeamMembershipsApi team_membership_delete DELETE /team_memberships/{id} Remove a team membership
TeamMembershipsApi team_membership_list GET /team_memberships List team memberships
TeamMembershipsApi team_membership_update PUT /team_memberships/{id} Update a team membership
TeamMembershipsApi team_memberships GET /teams/{id}/memberships List team memberships
TeamsApi team_create POST /team Create a new team
TeamsApi team_delete DELETE /teams/{id} Remove a team
TeamsApi team_inspect GET /teams/{id} Inspect a team
TeamsApi team_list GET /teams List teams
TemplatesApi template_file POST /templates/file Get a template's file
TemplatesApi template_list GET /templates List available templates
UploadApi upload_tls POST /upload/tls/{certificate} Upload TLS files
UsersApi user_admin_check GET /users/admin/check Check administrator account existence
UsersApi user_create POST /users Create a new user
UsersApi user_delete DELETE /users/{id} Remove a user
UsersApi user_inspect GET /users/{id} Inspect a user
UsersApi user_list GET /users List users
UsersApi user_memberships_inspect GET /users/{id}/memberships Inspect a user memberships
UsersApi user_update PUT /users/{id} Update a user
UsersApi user_update_password PUT /users/{id}/passwd Update password for a user
WebhooksApi webhooks_get GET /webhooks List webhooks
WebhooksApi webhooks_id_delete DELETE /webhooks/{id} Delete a webhook
WebhooksApi webhooks_post POST /webhooks Create a webhook
WebhooksApi webhooks_token_post POST /webhooks/{token} Execute a webhook
WebsocketApi websocket_attach_get GET /websocket/attach Attach a websocket
WebsocketApi websocket_exec_get GET /websocket/exec Execute a websocket
WebsocketApi websocket_pod_get GET /websocket/pod Execute a websocket on pod

Documentation For Models

Documentation For Authorization

jwt

  • Type: API key
  • API key parameter name: Authorization
  • Location: HTTP header

Author

info@portainer.io

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 99.9%
  • Shell 0.1%