Python API client for zammad
Project description
Zammad API Client
Python API client for zammad
- Free software: MIT license
- Documentation: https://zammad-py.readthedocs.io.
Quickstart
from zammad_py import ZammadAPI
# Initialize the client with the URL, username, and password
# Note the Host URL should be in this format: 'https://zammad.example.org/api/v1/'
client = ZammadAPI(url='<HOST>', username='<USERNAME>', password='<PASSWORD>')
# Example: Access all users
this_page = client.user.all()
for user in this_page:
print(user)
# Example: Get information about the current user
print(client.user.me())
# Example: Create a ticket
params = {
"title": "Help me!",
"group": "2nd Level",
"customer": "david@example.com",
"article": {
"subject": "My subject",
"body": "I am a message!",
"type": "note",
"internal": False
}
}
new_ticket = client.ticket.create(params=params)
General Methods
Most resources support these methods:
.all(): Returns a paginated response with the current page number and a list of elements..next_page(): Returns the next page of the current pagination object..prev_page(): Returns the previous page of the current pagination object..search(params): Returns a paginated response based on the search parameters..find(id): Returns a single object with the specified ID..create(params): Creates a new object with the specified parameters..update(params): Updates an existing object with the specified parameters..destroy(id): Deletes an object with the specified ID.
Available Resources
| Resource | Property |
|---|---|
| User | client.user |
| Organization | client.organization |
| Group | client.group |
| Role | client.role |
| Ticket | client.ticket |
| Link | client.link |
| TicketArticle | client.ticket_article |
| TicketArticleAttachment | client.ticket_article_attachment |
| TicketArticlePlain | client.ticket_article_plain |
| TicketPriority | client.ticket_priority |
| TicketState | client.ticket_state |
| TagList | client.taglist |
| TicketTag | client.ticket_tag |
| KnowledgeBases | client.knowledge_bases |
| KnowledgeBasesAnswers | client.knowledge_bases_answers |
| KnowledgeBasesCategories | client.knowledge_bases_categories |
Resource-Specific Methods
User
.me(): Returns information about the current user.
Ticket
.articles(id): Returns all articles associated with a ticket..tags(id): Returns all tags associated with a ticket..merge(id, number): Merges two tickets (requires password auth).
Link
.get(id): Returns all links associated with a ticket..add(...): Creates a link between two objects..remove(...): Removes a link between two objects.
TicketArticleAttachment
.download(id, article_id, ticket_id): Downloads a ticket attachment.
TagList
.all(): Returns all tags (paginated)..create(params): Creates a new tag..destroy(id): Deletes a tag.
TicketTag
.add(id, tag): Adds a tag to a ticket..remove(id, tag): Removes a tag from a ticket.
KnowledgeBases
.init(): Returns the entire knowledge base structure..manage(id, settings): Updates knowledge base settings..show_permissions(id): Returns permissions for a knowledge base..change_permissions(id, permissions): Updates permissions..reorder_sub_categories(id, category_id, params): Reorders sub-categories..reorder_root_categories(id, params): Reorders root categories.
KnowledgeBasesAnswers
.find_answer(knowledge_base_id, answer_id): Retrieves a specific answer..create(params): Creates a new answer (requiresknowledge_base_idin params)..update(id, params): Updates an answer (requiresanswer_idin params)..destroy_answer(knowledge_base_id, answer_id): Deletes an answer..change_answer_visibility(knowledge_base_id, answer_id, visibility): Updates answer visibility..add_attachment(knowledge_base_id, answer_id, attachment): Uploads an attachment..delete_attachment(knowledge_base_id, answer_id, attachment_id): Removes an attachment.
KnowledgeBasesCategories
.find_category(knowledge_base_id, category_id): Retrieves a specific category..create(params): Creates a new category (requiresknowledge_base_idin params)..update(id, params): Updates a category (requirescategory_idin params)..destroy_category(knowledge_base_id, category_id): Deletes a category..show_permissions(knowledge_base_id, category_id): Returns category permissions..change_permissions(knowledge_base_id, category_id, permissions): Updates permissions..reorder_answers(knowledge_base_id, category_id, params): Reorders answers.
On Behalf Of
You can set the on_behalf_of attribute to perform actions on behalf of another user:
client.on_behalf_of = 'user@example.com'
Or use the context manager:
with client.request_on_behalf_of('user@example.com'):
client.ticket.create(params=params)
Contributing
The Zammad API Client (zammad_py) welcomes contributions.
You can contribute by reporting bugs, fixing bugs, implementing new features, writing documentation, and submitting feedback.
To get started, see the contributing section in the docs!
Please ensure that your changes include tests and updated documentation if necessary.
Credits
This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file zammad_py-3.2.1.tar.gz.
File metadata
- Download URL: zammad_py-3.2.1.tar.gz
- Upload date:
- Size: 11.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.5 CPython/3.13.11 Linux/6.18.7-100.fc42.x86_64
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7ed3f57c181efddcb68eee008ae41c54b18701c0b53ac8f5cbf0f602088f587f
|
|
| MD5 |
79a73723a7b1a2180199c976d81b5774
|
|
| BLAKE2b-256 |
c1f592d4f9ee8e40f12095f50eddc1c5b7f575a9154dc4a674e1f5287afb5531
|
File details
Details for the file zammad_py-3.2.1-py3-none-any.whl.
File metadata
- Download URL: zammad_py-3.2.1-py3-none-any.whl
- Upload date:
- Size: 11.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.5 CPython/3.13.11 Linux/6.18.7-100.fc42.x86_64
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
93158fabbdb033d0c60470dcd85179fbfa36792693abe3d188f93c55a81a57b5
|
|
| MD5 |
97e7d68dccd304550c88f77425c33c8e
|
|
| BLAKE2b-256 |
f3171d5601dda084477fafa9322e5e60c6f4fa16a43751db3b5331ab88334e77
|