Getting Started

Install the OTOBO Python SDK and create your first ticket via the GenericInterface REST API.

Getting Started — OTOBO Python SDK

Webservice required. pip install otobo alone is not enough. You must configure a GenericInterface REST webservice on your OTOBO server before any API call works. Start with Webservice setup if you have not done this yet.

Install the distribution and import the OTOBO-branded namespace:

Bash
pip install otobo
Python
from otobo import OTOBOClient, BasicAuth, ClientConfig, TicketCreate, TicketOperation

Prerequisites

  • OTOBO with GenericInterface enabled and a REST webservice configured.
  • An agent login with permission to use that webservice.
  • Python 3.11+.

OTOBO admin concepts

OTOBO termMeaning for this SDK
WebserviceNamed REST endpoint group; ClientConfig.webservice_name must match
OperationOne ticket action; mapped in operation_url_map
Agent loginUser account passed to BasicAuth
QueueTicket inbox; use IdName(name="Raw") or your queue name
Dynamic fieldCustom ticket attribute; pass as dict[str, str] on models

Configure webservices in the OTOBO admin area, or run otobo-cli setup-system to create one automatically. See Webservice setup for the full walkthrough.

Configuration

ClientConfig describes how the client reaches your webservice. The operation_url_map keys are TicketOperation enum values; values are the operation path segments configured in OTOBO (not full URLs).

Python
config = ClientConfig(
base_url="https://your-otobo-server",
webservice_name="PythonClientWebService",
operation_url_map={
TicketOperation.CREATE: "ticket-create",
TicketOperation.GET: "ticket-get",
TicketOperation.SEARCH: "ticket-search",
TicketOperation.UPDATE: "ticket-update",
},
)
client = OTOBOClient(config)
client.login(BasicAuth(user_login="agent1", password="secret"))

The client builds URLs like:

{base_url}/Webservice/{webservice_name}/{operation_path}

Create a ticket

Python
import asyncio
from otobo import Article, IdName, TicketCreate
async def main() -> None:
ticket = TicketCreate(
title="New request",
queue=IdName(name="Raw"),
article=Article(subject="Hello", body="Ticket body"),
)
async with client:
created = await client.create_ticket(ticket)
print(created.id)
asyncio.run(main())

CLI setup

On an OTOBO host or inside its Docker container:

Bash
otobo-cli setup-system

Further reading