SOAP, PHP and TicketFree

English! place to talk about development, programming and coding
Post Reply
Nathan
Znuny newbie
Posts: 1
Joined: 05 Jan 2011, 15:23
Znuny Version: 2.3.4

SOAP, PHP and TicketFree

Post by Nathan »

Hi,

I have successfully used the OTRS SOAP interface to create a ticket with an article using the code below.

Code: Select all

# Create a new ticket. The function returns the Ticket ID.
$TicketID = $client->__soapCall("Dispatch", array($username, $password,
"TicketObject", "TicketCreate",
"Title",        $title,
"Queue",        "IT Infrastructure::Infrastructure Change",
"Lock",         "Unlock",
"PriorityID",   2,
"State",        "new",
"CustomerUser", $from,
"OwnerID",      10,
"UserID",       1,
));

# A ticket is not usefull without at least one article. The function
# returns an Article ID.
$ArticleID = $client->__soapCall("Dispatch",
array($username, $password,
"TicketObject",   "ArticleCreate",
"TicketID",       $TicketID,
"ArticleType",    "webrequest",
"SenderType",     "customer",
"HistoryType",    "WebRequestCustomer",
"HistoryComment", "Ticket Created using the IT Change Request System",
"From",           $from,
"Subject",        $title,
"ContentType",    "text/plain; charset=ISO-8859-1",
"Body",           "This is the body",
"UserID",         1,
"Loop",           0,
"AutoResponseType", 'auto reply',
"OrigHeader", array(
        'From' => $from,
        'To' => 'Postmaster',
        'Subject' => $title,
        'Body' => "This is the body"
    ),
));
What I would like to achieve is to create the ticket and populate one of the free fields with a custom string(Server Name). Could anyone point me in the right direction of how to populate a free field using SOAP?

Thanks,
Nathan
FairFight
Znuny newbie
Posts: 14
Joined: 29 Sep 2011, 22:51
Znuny Version: 3.0.10

Re: SOAP, PHP and TicketFree

Post by FairFight »

Sorry for bringing up an old thread, but I have exactly the same question - how do you populate Free Fields through SOAP?
jojo
Znuny guru
Posts: 15020
Joined: 26 Jan 2007, 14:50
Znuny Version: Git Master
Contact:

Re: SOAP, PHP and TicketFree

Post by jojo »

have a look at the API (dev.otrs.org)
"Production": OTRS™ 8, OTRS™ 7, STORM powered by OTRS
"Testing": ((OTRS Community Edition)) and git Master

Never change Defaults.pm! :: Blog
Professional Services:: http://www.otrs.com :: enjoy@otrs.com
FairFight
Znuny newbie
Posts: 14
Joined: 29 Sep 2011, 22:51
Znuny Version: 3.0.10

Re: SOAP, PHP and TicketFree

Post by FairFight »

Thank you. I found ArticleFreeTextSet in the dev documentation.
I added the following to my PHP script:

Code: Select all

$ArticleFreeText = $client->__soapCall("Dispatch", array($username, $password,
"TicketObject",   "ArticleFreeTextSet",
"TicketID",       $TicketID,
"ArticleID",      $ArticleID,
"Counter",        1,
"Key",            "Tester",
"Value",          "Testing",
"UserID",         1,
));
However it does not seem to work, it does not fill any freetext fields out.
Hope you can help, thanks.
jojo
Znuny guru
Posts: 15020
Joined: 26 Jan 2007, 14:50
Znuny Version: Git Master
Contact:

Re: SOAP, PHP and TicketFree

Post by jojo »

thats Article Free Text, not Ticket Free Text

And you alwanys need to set the Key and the value
"Production": OTRS™ 8, OTRS™ 7, STORM powered by OTRS
"Testing": ((OTRS Community Edition)) and git Master

Never change Defaults.pm! :: Blog
Professional Services:: http://www.otrs.com :: enjoy@otrs.com
FairFight
Znuny newbie
Posts: 14
Joined: 29 Sep 2011, 22:51
Znuny Version: 3.0.10

Re: SOAP, PHP and TicketFree

Post by FairFight »

Thank you.
I found the following in the dev doc.

Code: Select all

my $Success = $TicketObject->TicketFreeTextSet(
        Counter  => 1,
        Key      => 'Planet', # optional
        Value    => 'Sun',  # optional
        TicketID => 123,
        UserID   => 23,
);
That helped me to solve the problem.
martini
Moderator
Posts: 12
Joined: 13 Oct 2008, 20:43
Znuny Version: 3.x.x
Real Name: Martin Edenhofer
Company: Znuny GmbH
Contact:

Re: SOAP, PHP and TicketFree

Post by martini »

JFI. Take care, the API will change in OTRS 3.1.

Greetings,

-Martin
Privat: http://edenhofer.de - Passion: http://otterhub.org - OTRS Services: http://znuny.com
Post Reply