I cannot find the correct way to add an article to an existing ticket using a rest call.
The ticket itself must remain unchanged but I want only add a note.
How can I do?
Thanks
[SOLVED] Add an article using rest
Moderator: crythias
-
- OTRS newbie
- Posts: 35
- Joined: 11 Jun 2020, 14:56
- OTRS Version?: 6.0.27
- Real Name: Rodolfo Rughi
- Company: none
[SOLVED] Add an article using rest
Last edited by rodolfor on 02 Dec 2020, 15:41, edited 1 time in total.
-
- Moderator
- Posts: 2463
- Joined: 18 Dec 2007, 12:23
- OTRS Version?: 4/5/6 and Znuny LTS
- Real Name: Roy Kaldung
- Company: Znuny
- Contact:
Re: Add an article using rest
Hi,
What have you tried so far?
- Roy
What have you tried so far?
- Roy
Znuny LTS and ((OTRS) Community Edition CentOS / RHEL / Debian / SLES / MySQL / PostgreSQL / Oracle / OpenLDAP / Active Directory / SSO
Do you need professional services? Check out https://www.znuny.com/
Do you want to contribute or want to know why ?
Do you need professional services? Check out https://www.znuny.com/
Do you want to contribute or want to know why ?
-
- OTRS newbie
- Posts: 35
- Joined: 11 Jun 2020, 14:56
- OTRS Version?: 6.0.27
- Real Name: Rodolfo Rughi
- Company: none
Re: Add an article using rest
#1
#2 (changing only the ticketID in the url)
Thanks
Code: Select all
curl -X "PATCH" "http://<your-domain>/otrs/nph-genericinterface.pl/Webservice/WebServiceAPI001/TicketUpdate/[ticketid]?UserLogin=otrsadmin&Password=password" \
-H "Content-Type: application/json" \
-d $'{
"Ticket": {
"Article": {
"Subject": "mysubject",
"Body": "mybody",
"ContentType": "text/plain; charset=utf8"
}
}
}
Code: Select all
curl -X "PATCH" "http://<your-domain>/otrs/nph-genericinterface.pl/Webservice/WebServiceAPI001/TicketUpdate?UserLogin=otrsadmin&Password=password&&TicketID=123"
-
- Moderator
- Posts: 2463
- Joined: 18 Dec 2007, 12:23
- OTRS Version?: 4/5/6 and Znuny LTS
- Real Name: Roy Kaldung
- Company: Znuny
- Contact:
Re: Add an article using rest
Hi,
You used the wrong structure in the body. Article is not a sub eelement of ticket, see https://github.com/OTRS/otrs/blob/rel-6 ... te.pm#L113 for the proper structure.
- Roy
You used the wrong structure in the body. Article is not a sub eelement of ticket, see https://github.com/OTRS/otrs/blob/rel-6 ... te.pm#L113 for the proper structure.
- Roy
Znuny LTS and ((OTRS) Community Edition CentOS / RHEL / Debian / SLES / MySQL / PostgreSQL / Oracle / OpenLDAP / Active Directory / SSO
Do you need professional services? Check out https://www.znuny.com/
Do you want to contribute or want to know why ?
Do you need professional services? Check out https://www.znuny.com/
Do you want to contribute or want to know why ?
-
- OTRS superhero
- Posts: 677
- Joined: 15 Dec 2016, 15:13
- OTRS Version?: 3.x–6.0.x
- Real Name: Emin
- Company: Efflux GmbH
- Contact:
Re: Add an article using rest
And you are also missing some mandatory fields.
— Emin
— Emin
Professional OTRS & ((OTRS)) Community Edition services: efflux.de | efflux.de/en/
Free and premium OTRS add-ons: German | English
Free and premium OTRS add-ons: German | English
-
- OTRS newbie
- Posts: 35
- Joined: 11 Jun 2020, 14:56
- OTRS Version?: 6.0.27
- Real Name: Rodolfo Rughi
- Company: none
Re: Add an article using rest
Thanks , the link show me a lot of new things!
I tried these url:and the error is:
HTTP::REST Error while determine Operation for request URI '/TicketUpdate'[/code]
Then I tried:and the error is:
HTTP::REST Error while determine Operation for request URI '/TicketUpdate/2020120173000001'
Either with POST and PATCH and to map the method in REST using:
/Ticket/:TicketNumber or /Ticket
With this data:
In webservice log I cannot see other informations.
Thanks if you can see my error.
I tried these url:
Code: Select all
curl -X POST ".../TicketUpdate?UserLogin=usg&Password=pwg&TicketNumber=2020120173000001"
HTTP::REST Error while determine Operation for request URI '/TicketUpdate'[/code]
Then I tried:
Code: Select all
curl -X POST ".../TicketUpdate/2020120173000001?UserLogin=usg&Password=pwg"
HTTP::REST Error while determine Operation for request URI '/TicketUpdate/2020120173000001'
Either with POST and PATCH and to map the method in REST using:
/Ticket/:TicketNumber or /Ticket
With this data:
Code: Select all
-H "Content-Type:application/json"
-d "{\"Article\":
{\"CommunicationChannelID\": \"1\"
, \"IsVisibleForCustomer\": \"0\"
, \"SenderType\": \"Portal\"
, \"From\": \"UserPortal\"
, \"Subject\": \"UpdatePortal\"
, \"Body\": \"bodyportal\"
, \"ContentType\": \"text/plain; charset=utf8\"
}
}"
Thanks if you can see my error.
Last edited by rodolfor on 02 Dec 2020, 11:31, edited 3 times in total.
-
- OTRS newbie
- Posts: 35
- Joined: 11 Jun 2020, 14:56
- OTRS Version?: 6.0.27
- Real Name: Rodolfo Rughi
- Company: none
Re: Add an article using rest
SOLUTION:
1. read the link https://github.com/OTRS/otrs/blob/rel-6 ... te.pm#L113
to know correct structure and mandatory values
2. you must use Ticket routing, with PATCH
3. the correct curl is
Be shure to modify the call to this rest api in otrs webservice, and modify from /Ticket/:TicketID to /Ticket/:TicketNumber
Thanks all.
Rodolfo
1. read the link https://github.com/OTRS/otrs/blob/rel-6 ... te.pm#L113
to know correct structure and mandatory values
2. you must use Ticket routing, with PATCH
3. the correct curl is
Code: Select all
curl -X PATCH ".../Ticket/2020120173000001?UserLogin=usg&Password=pwg"
-H "Content-Type:application/json"
-d "{\"Article\":
{\"CommunicationChannelID\": \"1\"
, \"IsVisibleForCustomer\": \"0\"
, \"SenderType\": \"Portal\"
, \"From\": \"UserPortal\"
, \"Subject\": \"UpdatePortal\"
, \"Body\": \"bodyportal\"
, \"ContentType\": \"text/plain; charset=utf8\"
}
}"
Thanks all.
Rodolfo