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...cretkey&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...cretkey&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: 41  
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...stAPI&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 Linux Agent - login user
by  Dinusha Chandrasinghe   Go to last post Go to first unread
Last post: Today at 11:03:07 AM(UTC)
Lansweeper device with multiple NICs
by  mzipperer  
Go to last post Go to first unread
Last post: Yesterday at 7:42:57 PM(UTC)
Lansweeper Internal Note
by  mdavis2503   Go to last post Go to first unread
Last post: Yesterday at 6:00:07 PM(UTC)
Lansweeper Problem with deploy software
by  Max90  
Go to last post Go to first unread
Last post: Yesterday at 12:09:40 PM(UTC)
Lansweeper Can lsagent be protected from deletion
by  RKCar   Go to last post Go to first unread
Last post: 11/29/2021 8:56:09 PM(UTC)
Lansweeper HTTPS not secure
by  Larry Rhea  
Go to last post Go to first unread
Last post: 11/29/2021 7:50:59 PM(UTC)
Lansweeper Warning about Built-in Admin
by  Larry Rhea   Go to last post Go to first unread
Last post: 11/29/2021 7:45:45 PM(UTC)