→ The Lansweeper Customer Excellence Awards 2024 - Submit Your Project Now! Learn More & Enter Here

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
rcarpadakis
Engaged Sweeper
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.aspx?Action=AddTicket&Key=mysecretkey&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.aspx?Action=AddTicket&Key=mysecretkey&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



1 REPLY 1
prighi61
Engaged Sweeper III
Hi Rion,

I tried this, setting a text custom field named "AssetName", and it worked:

http://myurl.com/api.aspx?key=xxxxxxxx&action=AddTicket&Subject=testAPI&Description=testAPI&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. "}

New to Lansweeper?

Try Lansweeper For Free

Experience Lansweeper with your own data.
Sign up now for a 14-day free trial.

Try Now