### Bash: Docker Compose Management and Container Operations Source: https://context7.com/rotheross/otobo/llms.txt Bash scripts for managing OTOBO Docker deployments. Includes commands to build and start services, perform initial setup within a container, execute console commands inside a running container, and view logs. ```bash # Build and start services docker-compose up -d # Initial setup docker exec -it otobo-web /opt/otobo/bin/docker/quick_setup.pl # Run console commands in container docker exec -it otobo-web /opt/otobo/bin/otobo.Console.pl Admin::User::List # View logs docker-compose logs -f otobo-web ``` -------------------------------- ### Untitled No description -------------------------------- ### Untitled No description -------------------------------- ### Untitled No description -------------------------------- ### Untitled No description -------------------------------- ### Untitled No description -------------------------------- ### Import and Test Web Service Configuration Source: https://context7.com/rotheross/otobo/llms.txt Commands to import a web service configuration file and test a REST endpoint using curl. ```APIDOC ## Import and Test Web Service ### Import Web Service Configuration **Description**: Imports a generic web service configuration file into OTOBO. **Command**: ```bash /opt/otobo/bin/otobo.Console.pl Admin::WebService::Add \ --name "GenericTicketConnectorREST" \ --source-path /path/to/GenericTicketConnectorREST.yml ``` ### Test Web Service Endpoint **Description**: Tests the SessionCreate endpoint of the GenericTicketConnectorREST service using curl. **Command**: ```bash curl -X POST http://localhost/otobo/nph-genericinterface.pl/Webservice/GenericTicketConnectorREST/Session \ -H "Content-Type: application/json" \ -d '{"UserLogin": "admin@example.com", "Password": "password"}' ``` **Request Body Example**: ```json { "UserLogin": "admin@example.com", "Password": "password" } ``` ``` -------------------------------- ### Untitled No description -------------------------------- ### REST API - Search Tickets Source: https://context7.com/rotheross/otobo/llms.txt Enables searching for tickets based on various criteria including queue, state, customer, dates, and full-text search via a GET request. ```APIDOC ## GET /Webservice/GenericTicketConnectorREST/Ticket ### Description Search tickets using various criteria including queue, state, customer, dates, and full-text search. ### Method GET ### Endpoint `/Webservice/GenericTicketConnectorREST/Ticket` ### Parameters #### Query Parameters - **UserLogin** (string) - Required - The login name of the agent. - **Password** (string) - Required - The password of the agent. - **Queues** (string) - Optional - Comma-separated list of queues to search within. - **States** (string) - Optional - Comma-separated list of states to filter by. - **Priority** (string) - Optional - Comma-separated list of priorities to filter by. - **TicketCreateTimeNewerDate** (string) - Optional - Filter tickets created after this date/time (YYYY-MM-DD HH:MM:SS). - **Limit** (integer) - Optional - The maximum number of tickets to return. - **SortBy** (string) - Optional - The field to sort the results by (e.g., 'Age'). - **OrderBy** (string) - Optional - The order of sorting ('Down' or 'Up'). ### Response #### Success Response (200) - **TicketID** (array of integers) - An array containing the IDs of the found tickets. #### Response Example ```json { "TicketID": [ 101, 102, 103 ] } ``` ``` -------------------------------- ### Search OTOBO Tickets via REST API (Perl) Source: https://context7.com/rotheross/otobo/llms.txt Searches for OTOBO tickets using various criteria via the REST API. Requires REST::Client and JSON modules. It constructs a GET request with query parameters for queues, states, dates, and sorting. Returns a list of matching ticket IDs. ```perl use REST::Client; use JSON; my $RestClient = REST::Client->new({ host => 'http://localhost/otobo/nph-genericinterface.pl', }); my $QueryParams = $RestClient->buildQuery( UserLogin => 'agent@example.com', Password => 'securepassword', Queues => 'IT::Infrastructure', States => 'new,open', Priority => '4 high,5 very high', TicketCreateTimeNewerDate => '2025-01-01 00:00:00', Limit => 50, SortBy => 'Age', OrderBy => 'Down', ); my $SearchURL = '/Webservice/GenericTicketConnectorREST/Ticket' . $QueryParams; $RestClient->GET($SearchURL); if ($RestClient->responseCode() eq '200') { my $Response = decode_json($RestClient->responseContent()); my @TicketIDs = @{$Response->{TicketID}}; print "Found " . scalar(@TicketIDs) . " tickets:\n"; foreach my $TicketID (@TicketIDs) { print "Ticket ID: $TicketID\n"; } } else { die "Ticket search failed: " . $RestClient->responseCode(); } ``` -------------------------------- ### Untitled No description -------------------------------- ### Retrieve OTOBO Ticket Details via REST API with Perl Source: https://context7.com/rotheross/otobo/llms.txt Fetches detailed information about a specific OTOBO ticket, including articles, dynamic fields, and attachments, using a GET request. It constructs query parameters for extended data and specifies ordering and limits for articles. Requires REST::Client and JSON modules. ```perl use REST::Client; use JSON; my $RestClient = REST::Client->new({ host => 'http://localhost/otobo/nph-genericinterface.pl', }); my $TicketID = 42; my $QueryParams = $RestClient->buildQuery( UserLogin => 'agent@example.com', Password => 'securepassword', DynamicFields => 1, Extended => 1, AllArticles => 1, Attachments => 1, ArticleOrder => 'DESC', ArticleLimit => 10, ); my $GetURL = "/Webservice/GenericTicketConnectorREST/Ticket/$TicketID" . $QueryParams; $RestClient->GET($GetURL); if ($RestClient->responseCode() eq '200') { my $Response = decode_json($RestClient->responseContent()); my $Ticket = $Response->{Ticket}[0]; print "Ticket #" . $Ticket->{TicketNumber} . ": " . $Ticket->{Title} . "\n"; print "State: " . $Ticket->{State} . ", Queue: " . $Ticket->{Queue} . "\n"; print "Customer: " . $Ticket->{CustomerUserID} . "\n"; foreach my $Article (@{$Ticket->{Article}}) { print "\nArticle: " . $Article->{Subject} . "\n"; print "From: " . $Article->{From} . ", Date: " . $Article->{Created} . "\n"; } } else { die "Ticket retrieval failed: " . $RestClient->responseCode(); } ``` -------------------------------- ### Create and Manage Tickets using OTOBO Perl API Source: https://context7.com/rotheross/otobo/llms.txt Demonstrates direct manipulation of tickets using OTOBO's Perl API. It utilizes Kernel::System::ObjectManager to get ticket objects for creating, updating (locking, setting state, changing queue), and retrieving ticket data. Requires access to the OTOBO Perl modules. ```perl use Kernel::System::ObjectManager; local $Kernel::OM = Kernel::System::ObjectManager->new(); my $TicketObject = $Kernel::OM->Get('Kernel::System::Ticket'); # Create ticket my $TicketID = $TicketObject->TicketCreate( Title => 'Server Maintenance Required', Queue => 'IT::Infrastructure', Lock => 'unlock', Priority => '3 normal', State => 'new', CustomerID => 'ACME-001', CustomerUser => 'john.doe@acme.com', OwnerID => 1, UserID => 1, ); die "Failed to create ticket" unless $TicketID; # Update ticket properties $TicketObject->TicketLockSet( Lock => 'lock', TicketID => $TicketID, UserID => 1, ); $TicketObject->TicketStateSet( State => 'open', TicketID => $TicketID, UserID => 1, ); $TicketObject->TicketQueueSet( Queue => 'IT::Hardware', TicketID => $TicketID, UserID => 1, ); # Retrieve ticket data my %Ticket = $TicketObject->TicketGet( TicketID => $TicketID, DynamicFields => 1, Extended => 1, UserID => 1, ); print "Ticket: " . $Ticket{TicketNumber} . " - " . $Ticket{Title} . "\n"; print "State: " . $Ticket{State} . ", Owner: " . $Ticket{Owner} . "\n"; ``` -------------------------------- ### Untitled No description -------------------------------- ### Untitled No description -------------------------------- ### Untitled No description -------------------------------- ### Perl: OTOBO PSGI Application Configuration Source: https://context7.com/rotheross/otobo/llms.txt Perl code demonstrating the configuration of an OTOBO Plack/PSGI application. It shows how to enable middleware and mount different OTOBO interfaces to specific URL paths. ```perl #!/usr/bin/env perl use strict; use warnings; use Plack::Builder; # Start the application server (otobo.psgi) # plackup bin/psgi-bin/otobo.psgi # Or with specific server # plackup --server Gazelle --workers 4 bin/psgi-bin/otobo.psgi # Access URLs: # http://localhost:5000/otobo/index.pl - Agent interface # http://localhost:5000/otobo/customer.pl - Customer interface # http://localhost:5000/otobo/public.pl - Public FAQ interface # http://localhost:5000/otobo/installer.pl - Installation wizard # http://localhost:5000/otobo/nph-genericinterface.pl - Web services endpoint # http://localhost:5000/otobo-web/ - Static assets # Example middleware usage within OTOBO builder { enable 'ReverseProxy'; enable 'Plack::Middleware::ContentLength'; enable 'Plack::Middleware::HTTPExceptions'; mount '/otobo/nph-genericinterface.pl' => Kernel::System::Web::App->new( Interface => 'Kernel::GenericInterface::Provider', )->to_app; mount '/otobo/index.pl' => Kernel::System::Web::App->new( Interface => 'Kernel::System::Web::InterfaceAgent', )->to_app; }; ``` -------------------------------- ### Install Bundled Modules using cpanm Source: https://github.com/rotheross/otobo/blob/rel-11_0/Kernel/cpan-lib/README.md Installs bundled Perl modules into a local directory using `cpanm`. It's recommended to run this command twice to ensure a complete installation. Specific directories and files that are not meant to be bundled are then removed. ```bash cd Kernel/cpan-lib cpanm --notest --installdeps . --local-lib local cpanm --notest --installdeps . --local-lib local ``` -------------------------------- ### Local Installation Cleanup Source: https://github.com/rotheross/otobo/blob/rel-11_0/Kernel/cpan-lib/README.md Removes the temporary local installation directory after modules have been copied to their final destination. ```bash rm -rf local ``` -------------------------------- ### Untitled No description -------------------------------- ### Ensure Dependencies are Installed Source: https://github.com/rotheross/otobo/blob/rel-11_0/Kernel/cpan-lib/README.md This command ensures that all necessary dependencies for OTOBO are installed. It should be run as part of the preparation step before module updates or regeneration. ```bash bin/otobo.CheckModules.pl --inst ``` -------------------------------- ### Cleanup Temporary Perl Modules and Directories Source: https://github.com/rotheross/otobo/blob/rel-11_0/Kernel/cpan-lib/README.md After installing or updating Perl modules, this process cleans up temporary installation directories and any empty directories that may have been created. It uses `rm`, `find`, and `git status` to ensure a clean state. ```shell rm -rf local/lib/perl5/x86_64-linux-gnu-thread-multi find . \( -name "*.pl" \) -delete find . -type d -empty -delete rm -rf local git status ``` -------------------------------- ### Untitled No description -------------------------------- ### Install Missing Perl Modules with cpanm Source: https://github.com/rotheross/otobo/blob/rel-11_0/Kernel/cpan-lib/README.md This section details how to identify and reinstall missing Perl modules using the `cpanm` utility. It requires manual intervention to specify modules and their versions for reinstallation into the local library path. Ensure `cpanm` is installed and accessible. ```shell cpanm --notest --reinstall --local-lib local CPAN::DistnameInfo@0.12 cpanm --notest --reinstall --local-lib local File::Slurp@9999.32 cpanm --notest --reinstall --local-lib local Font::TTF@1.06 cpanm --notest --reinstall --local-lib local IO::String@1.08 cpanm --notest --reinstall --local-lib local Module::CPANfile@1.1004 cpanm --notest --reinstall --local-lib local Module::Extract::VERSION@1.116 cpanm --notest --reinstall --local-lib local XML::LibXML::Simple@1.01 ``` -------------------------------- ### Untitled No description -------------------------------- ### Import and Test OTOBO Web Service Configuration Source: https://context7.com/rotheross/otobo/llms.txt Commands to import a generic web service configuration file (YAML) into OTOBO and test a specific endpoint (Session creation) using curl. The import command uses the otobo.Console.pl script, while the test command demonstrates a POST request with JSON payload. Ensure the paths and hostnames are correctly set for your environment. ```bash # Import web service configuration /opt/otobo/bin/otobo.Console.pl Admin::WebService::Add \ --name "GenericTicketConnectorREST" \ --source-path /path/to/GenericTicketConnectorREST.yml # Test web service endpoint curl -X POST http://localhost/otobo/nph-genericinterface.pl/Webservice/GenericTicketConnectorREST/Session \ -H "Content-Type: application/json" \ -d '{"UserLogin": "admin@example.com", "Password": "password"}' ```