Problem to add some conversation to a ticket with postgreSQL request in OTRS 6

Moderator: crythias

Post Reply
kpemonon
Znuny newbie
Posts: 10
Joined: 11 Jun 2021, 15:26
Znuny Version: 6.0.29
Real Name: Kevin Pemonon

Problem to add some conversation to a ticket with postgreSQL request in OTRS 6

Post by kpemonon »

Hello everyone,

I am using OTRS 6 and I try to insert a ticket and to link him some conversation from terminal with psql request.

I have done an insert on table ticket :

INSERT INTO ticket (id, tn, title, queue_id, ticket_lock_id, type_id, service_id, sla_id, user_id, responsible_user_id, ticket_priority_id, ticket_state_id, customer_id, customer_user_id, timeout, until_time, escalation_time, escalation_update_time, escalation_response_time, escalation_solution_time, archive_flag, create_time, create_by, change_time, change_by)
VALUES (4616, '20210618103045', 'Test Kevin 1', 90121, 1, null, null, null, 150, 150, 1, 1, '', 'kevin-p', 0, 0, 0, 0, 0, 0, 0, '2021-06-18 10:30:45', 150, '2021-06-18 10:40:00', 150);

And i have done an insert on table article :

INSERT INTO article (id, ticket_id, communication_channel_id, article_sender_type_id, is_visible_for_customer, create_by, create_time, change_by, change_time)
VALUES (92004, 4616, 3, 3, 1, 150, '2021-06-18 10:00:00', 150, '2021-06-18 12:00:00');

Finally i have done an insert on table article_data_mime :

INSERT INTO article_data_mime (article_id, a_from, a_to, a_subject, a_body, incoming_time, create_by, create_time, change_by, change_time)
VALUES (92004, 'OTRS Feedback <marketing@otrs.com>', 'Your OTRS System <otrs@localhost>', 'Welcome to OTRS!', 'Hello world', 0, 150, '2021-06-18 10:00:00', 150 , '2021-06-18 12:00:00');

All my insert are successful.
My problem is that when i go on the interface OTRS, i can see my ticket but i don't see the conversation linked to him.

Do you know if I need to do some inserts on others table ?

Or if my insert are not good ?

Or do you have any ideas to solve my problem ?

Thanks for your time.

Best regards,

Kevin
root
Administrator
Posts: 3934
Joined: 18 Dec 2007, 12:23
Znuny Version: Znuny and Znuny LTS
Real Name: Roy Kaldung
Company: Znuny
Contact:

Re: Problem to add some conversation to a ticket with postgreSQL request in OTRS 6

Post by root »

kpemonon wrote: 18 Jun 2021, 15:20 Or do you have any ideas to solve my problem ?
Hi,

It's simple: do not bypass the API by writing into the database. Use the Perl APi, the GenericInterface, etc

- Roy
Znuny and Znuny LTS running on CentOS / RHEL / Debian / SLES / MySQL / PostgreSQL / Oracle / OpenLDAP / Active Directory / SSO

Use a test system - always.

Do you need professional services? Check out https://www.znuny.com/

Do you want to contribute or want to know where it goes ?
kpemonon
Znuny newbie
Posts: 10
Joined: 11 Jun 2021, 15:26
Znuny Version: 6.0.29
Real Name: Kevin Pemonon

Re: Problem to add some conversation to a ticket with postgreSQL request in OTRS 6

Post by kpemonon »

Hi Roy,

The idea is to use a python script to insert some old data of tickets/article/article_data_mime from an other software like OTRS in the current database.
It's why i try to do manually insert to test that it can works.
By using API Perl, what does it means ? Where can i find a documentation of that ?

Thans for your answer.

Best regard,

Kevin
skullz
Znuny superhero
Posts: 618
Joined: 24 Feb 2012, 03:58
Znuny Version: LTS and Features
Real Name: Mo Azfar
Location: Kuala Lumpur, MY
Contact:

Re: Problem to add some conversation to a ticket with postgreSQL request in OTRS 6

Post by skullz »

use the generic interface / webservice for this..

super long read..
https://doc.znuny.org/doc/manual/admin/ ... rface.html
kpemonon
Znuny newbie
Posts: 10
Joined: 11 Jun 2021, 15:26
Znuny Version: 6.0.29
Real Name: Kevin Pemonon

Re: Problem to add some conversation to a ticket with postgreSQL request in OTRS 6

Post by kpemonon »

Hi Skullz,

Thanks for your answer, i watch that.

Best regard,

Kevin
kpemonon
Znuny newbie
Posts: 10
Joined: 11 Jun 2021, 15:26
Znuny Version: 6.0.29
Real Name: Kevin Pemonon

Re: Problem to add some conversation to a ticket with postgreSQL request in OTRS 6

Post by kpemonon »

I have tried to use the webservice and testing to do the mapping of a route and get all ticket but i have a connect error in my json :
{
"Error": {
"ErrorCode": "TicketGet.AuthFail",
"ErrorMessage": "TicketGet: Authorization failing!"
}
}

Does you know how to configure the authentification ?
skullz
Znuny superhero
Posts: 618
Joined: 24 Feb 2012, 03:58
Znuny Version: LTS and Features
Real Name: Mo Azfar
Location: Kuala Lumpur, MY
Contact:

Re: Problem to add some conversation to a ticket with postgreSQL request in OTRS 6

Post by skullz »

taken from the docs, are you sure the userlogin and password is correct ?

Code: Select all

my $CreateOrUpdateParams = {
    UserLogin => "some agent user login",       # to be filled with valid agent login
    Password  => "some agent user password",    # to be filled with valid agent password
    Ticket    => {
        Title        => 'some ticket title',
        Queue        => 'Raw',
        Lock         => 'unlock',
        Type         => 'Unclassified',
        State        => 'new',
        Priority     => '3 normal',
        Owner        => 'some agent user login',
        CustomerUser => 'customer-1',
    },
    Article => {
        Subject     => 'some subject',
        Body        => 'some body',
        ContentType => 'text/plain; charset=utf8',
    },
};

Post Reply