TicketCreate operation returns with a "MissingParameter" error

Moderator: crythias

Locked
ATD39401
Znuny newbie
Posts: 21
Joined: 28 Jun 2024, 14:38
Znuny Version: 6.0.44
Real Name: Amber Denton
Company: UTK College of Veterinary Medicine

TicketCreate operation returns with a "MissingParameter" error

Post by ATD39401 »

I'm getting data for ticket A with the Ticket::TicketSearch operation, and I want to make a new ticket B and make its body text the same as ticket A's body text. I'm trying to call Ticket::TicketCreate (documentation I'm following) for this. However, I'm getting back the error

Code: Select all

TicketCreate.MissingParameter
which seems to suggest I'm either not including something the operation needs or my parameters into Python's request.get() function are malformed. From what I can tell the fields below are what OTRS 6 requires for this call. Am I missing something else?

Code: Select all

params = {
		'UserLogin': OTRSLogin,		
		'Password': OTRSPassword,
			'Ticket': {
				'Title': desiredTitle,
				'QueueID': 27,
				'StateID': 3,
				'PriorityID': 3
			},
			'Article': {
				'CommunicationChannel': 'Email',
				'CommunicationChannelID': 1,
				'IsVisibleForCustomer': 1,
				'ArticleSend': 1,
				'From': fromEmail,
				'Subject': desiredTitle,
				'Body': bodyTicketA,
				'ContentType': 'text/plain; charset=utf-8'
			}
		}
You do not have the required permissions to view the files attached to this post.
root
Administrator
Posts: 4249
Joined: 18 Dec 2007, 12:23
Znuny Version: Znuny and Znuny LTS
Real Name: Roy Kaldung
Company: Znuny
Contact:

Re: TicketCreate operation returns with a "MissingParameter" error

Post by root »

Hi,

Are there more details on what's missing in the GenericInterface debugger log or the system log of Znuny?

- 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 ?
ATD39401
Znuny newbie
Posts: 21
Joined: 28 Jun 2024, 14:38
Znuny Version: 6.0.44
Real Name: Amber Denton
Company: UTK College of Veterinary Medicine

Re: TicketCreate operation returns with a "MissingParameter" error

Post by ATD39401 »

Nothing obvious: the logger doesn't seem to have even recorded the "TicketCreate" operation, only "TicketGet" calls made earlier in my script. Below is what returns from the API call I posted.

Code: Select all

{'Error': {'ErrorMessage': 'TicketCreate: Ticket parameter is missing or not valid!', 'ErrorCode': 'TicketCreate.MissingParameter'}}
skullz
Znuny superhero
Posts: 658
Joined: 24 Feb 2012, 03:58
Znuny Version: LTS and Features
Real Name: Mo Azfar
Location: Kuala Lumpur, MY
Contact:

Re: TicketCreate operation returns with a "MissingParameter" error

Post by skullz »

TicketCreate should use Post method

Im not sure about python, but in perl have to set additional header

Code: Select all

# Method: POST
# Endpoint: /Ticket

$RestClient->addHeader('Content-Type', 'application/json');
$RestClient->addHeader('charset', 'UTF-8');
$RestClient->addHeader('Accept', 'application/json');
My Github
OTRS CE/LTS Discord Channel
Cant Update Package Anymore ? Check This

Professional OTRS, Znuny & OTOBO services: efflux.de/en
Free and premium add-ons: English
root
Administrator
Posts: 4249
Joined: 18 Dec 2007, 12:23
Znuny Version: Znuny and Znuny LTS
Real Name: Roy Kaldung
Company: Znuny
Contact:

Re: TicketCreate operation returns with a "MissingParameter" error

Post by root »

Hi,

Is the ticket type enabled in your system? If yes, add parameter to the payload.

- Roy

P.S.: Set the log level to debug
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 ?
ATD39401
Znuny newbie
Posts: 21
Joined: 28 Jun 2024, 14:38
Znuny Version: 6.0.44
Real Name: Amber Denton
Company: UTK College of Veterinary Medicine

Re: TicketCreate operation returns with a "MissingParameter" error

Post by ATD39401 »

root wrote: 08 Aug 2024, 08:37 Hi,

Is the ticket type enabled in your system? If yes, add parameter to the payload.

- Roy

P.S.: Set the log level to debug
I'm not sure what you mean by ticket type, but a route for the TicketCreate operation is enabled, and I have changed the following section of my web service configuration to accept only the POST method.

Code: Select all

RouteOperationMapping:
        TicketCreate:
          RequestMethod:
          - POST
          Route: /TicketCreate
        TicketGet:
          Route: /TicketGet/:TicketId
        TicketSearch:
          Route: /TicketSearch
        TicketUpdate:
          Route: /TicketUpdate
root
Administrator
Posts: 4249
Joined: 18 Dec 2007, 12:23
Znuny Version: Znuny and Znuny LTS
Real Name: Roy Kaldung
Company: Znuny
Contact:

Re: TicketCreate operation returns with a "MissingParameter" error

Post by root »

ATD39401 wrote: 08 Aug 2024, 17:06 I'm not sure what you mean by ticket type,
Hi,

Is the system configuration Ticket::Type enabled?

- 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 ?
ATD39401
Znuny newbie
Posts: 21
Joined: 28 Jun 2024, 14:38
Znuny Version: 6.0.44
Real Name: Amber Denton
Company: UTK College of Veterinary Medicine

Re: TicketCreate operation returns with a "MissingParameter" error

Post by ATD39401 »

Is the system configuration Ticket::Type enabled?
Turns out it was not. However after enabling this change in the system configuration and deploying it, I still get the same error back when running my script.
skullz
Znuny superhero
Posts: 658
Joined: 24 Feb 2012, 03:58
Znuny Version: LTS and Features
Real Name: Mo Azfar
Location: Kuala Lumpur, MY
Contact:

Re: TicketCreate operation returns with a "MissingParameter" error

Post by skullz »

You are missing Ticket->CustomerUser and Article->To (valid email address when Article->ArticleSend is set)

Code: Select all


my $Params = {
    UserLogin => $User,       
    Password  => $Pass,   
    Ticket    => {
        Title        => "desiredTitle",
        Queue        => "Raw",
        State        => "new",
        Priority     => "3 normal",
        Type => "Unclassified",
        CustomerUser => "test\@localhost.com",
        },
    Article => {
        CommunicationChannel => "Email",
        CommunicationChannelID => 1,
        IsVisibleForCustomer => 1,
        ArticleSend => 1,
        From       => "test\@localhost.com",
        To        => "test\@localhost.com",
        Subject     => "some subject",
        Body        => "some body",
        ContentType => "text/plain; charset=utf8",
    },
	
};

My Github
OTRS CE/LTS Discord Channel
Cant Update Package Anymore ? Check This

Professional OTRS, Znuny & OTOBO services: efflux.de/en
Free and premium add-ons: English
Locked