Notification

Icon
Error

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
0
Like
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!)

https://myurl.com/api.as...ecretkey&Subject=New 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:

https://myurl.com/api.as...ecretkey&Subject=New 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..

Thanks



prighi61
#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:

http://myurl.com/api.asp...estAPI&Email=amiller@127.0.0.1&CustomFields={"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 Upgrade Win 10 build to version 2004
by  CyberCitizen   Go to last post Go to first unread
Last post: Today at 12:11:55 AM(UTC)
Lansweeper Sort Reports by Last Changed
by  LANGuy  
Go to last post Go to first unread
Last post: Yesterday at 7:02:23 PM(UTC)
Lansweeper Windows Encryption Method
by  elKastr0nom   Go to last post Go to first unread
Last post: Yesterday at 6:02:07 PM(UTC)
Lansweeper Built in report - AD Password Expired
by  FezUSA  
Go to last post Go to first unread
Last post: Yesterday at 3:12:17 PM(UTC)
Lansweeper Helpdesk Dashboard Shared Tab
by  mark chamberlain   Go to last post Go to first unread
Last post: Yesterday at 2:32:20 PM(UTC)
Lansweeper Uninstall an software with Password
by  CyberCitizen   Go to last post Go to first unread
Last post: Yesterday at 6:20:28 AM(UTC)
Lansweeper Scanning for Events in Applications and Services Logs
by  Geoff P G  
Go to last post Go to first unread
Last post: 10/20/2021 5:22:11 PM(UTC)