How do I create a new ticket using the API? - How do I create a ticket using the API with Custom Fields?

Posted: Thursday, September 23, 2021 6:41:37 PM(UTC)
Rion Carpadakis

Rion Carpadakis

Member Original PosterPosts: 1
I have followed all the documentation and spent several days trying to create a new ticket. When I add just the standard keys to the url, it works fine. But if I add even 1 single custom field, I get this response:

{"Files":null,"Success":false,"Message":"The creation has failed. -> Given user doesn't exist and can not be created because no Active Directory user is found and email is not given. | No user given."}

My user account obviously exists or I wouldn't be able to create them with no custom fields. The custom fields I added just to test and try to get it to work are simple text fields First_Name and Last_Name

This is the url I am sending to the API (obviously without my security key!) Employee&Type=New_Onboarding&Description=New Employee&Priority=Medium&State=Open&Team=Onboarding&Username=domain\username&Displayname=myname&CustomFields={"customFields":[{"name":"First_Name","value":"MyFirstNameTest"},{"name":"Last_Name","value":"MyLastNameTest"}]}

I pass it urlencoded.. so it sends this: Employee&Type=New_Onboarding&Description=New Employee&Priority=Medium&State=Open&Team=Onboarding&Username=domain\username&Displayname=myname&CustomFields=%7B%22customFields%22%3A%5B%7B%22name%22%3A%22First_Name%22%2C%22value%22%3A%22MyFirstNameTest%22%7D%2C%7B%22name%22%3A%22Last_Name%22%2C%22value%22%3A%22MyLastNameTest%22%7D%5D%7D

I'm at a loss as to why I keep getting the message I am getting.. Any help would be greatly appreciated..


#1prighi61 Member Posts: 21  
posted: 9/24/2021 9:36:39 AM(UTC)
Hi Rion,

I tried this, setting a text custom field named "AssetName", and it worked:{"customFields":[{"name":"AssetName","value":"Asset Name 3"}]}

I received:
{"TicketID":2045,"Subject":"testAPI","Description":"testAPI","CreationDate":"2021-09-24T10:05:37.087","Type":"Help desk","Priority":"Media","State":"Open","Team":"IT Support","Agent":"","AgentID":0,"User":"Anne Miller","UserID":26,"FollowUp":false,"AgentInitiated":false,"Personal":false,"CustomFields":[{"Name":"AssetName","Value":"Asset Name 3"}],"Files":[],"Success":true,"Message":"The creation was successful. "}

Active Discussions

Lansweeper Chrome 95 Audit
by  Esben.D  
Go to last post Go to first unread
Last post: Yesterday at 11:14:31 AM(UTC)
Lansweeper Detecting and Reporting on Programs in Apps & Features
by  LANGuy  
Go to last post Go to first unread
Last post: 10/18/2021 6:09:11 PM(UTC)
Lansweeper OS: Not latest Build of Windows 10 not working
by  jmm25   Go to last post Go to first unread
Last post: 10/18/2021 12:48:41 PM(UTC)
Lansweeper AD DistinguishedName of Computer object
by  elKastr0nom   Go to last post Go to first unread
Last post: 10/14/2021 6:52:50 PM(UTC)
Lansweeper Report if Credential Guard is active
by  ericatbrandmauer  
Go to last post Go to first unread
Last post: 10/14/2021 10:28:15 AM(UTC)