1
API: CreateIncomingTicket and SetFollowUp
Problem reported by carlos camara - 8/9/2023 at 9:04 PM
Submitted
Hi am, trying to add by api tickets but having a return 400 error.   think is DateTime that is give that error
I have tested many ways but still not accomplish to have connection.  am adding code used to setfollow 
 string soapEndpoint = "http://www.smartertools.com/SmarterTrack/Services2/svcTickets.asmx";; 

Int32 ticketNumberID = Convert.ToInt32(requestResultElement2.Value);
                                                        // var tim = DateTime.UtcNow.ToString("");
                                                        DateTime now = DateTime.UtcNow.AddDays(1);
                                                        DateTime localNow = TimeZoneInfo.ConvertTimeFromUtc(now, TimeZoneInfo.Local);

                                                        string soapAction4= "http://www.smartertools.com/SmarterTrack/Services2/svcTickets.asmx/SetFollowUp";;
                                                        //Changing Soap addrees andd setticket
                                                        string soapXml4 = $@"<?xml version=""1.0"" encoding=""utf-8""?>
                                            <soap12:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance""; xmlns:xsd=""http://www.w3.org/2001/XMLSchema""; xmlns:soap12=""http://www.w3.org/2003/05/soap-envelope"">;
                                            <soap12:Body>
                                                <SetFollowUp xmlns=""http://www.smartertools.com/SmarterTrack/Services2/svcTickets.asmx"">;
                                                  <authUserName>{username}</authUserName>
                                                  <authPassword>{password}</authPassword>
                                                  <<ticketId>{ticketNumberID}</ticketId>
                                                  <followUpDateUtc>{localNow}</followUpDateUtc>
                                                  <newGroupId>{groupId}</newGroupId>
                                                  <newAgentId>{agentId}</newAgentId>
                                                  <newStatus>Open</newStatus>
                                                  <pinToAgent>false</pinToAgent>
                                                  <comment>{subject}</comment>
                                                </SetFollowUp>
                                              </soap12:Body>
                                            </soap12:Envelope>";

                                                        using (var httpClient4 = new HttpClient())
                                                        {
                                                            httpClient4.DefaultRequestHeaders.Add("SOAPAction", soapAction4);

                                                            var content4 = new StringContent(soapXml4, Encoding.UTF8, "application/application/soap+xml");

                                                            var response4 = await httpClient4.PostAsync(soapEndpoint, content4);

                                                            if (response4.IsSuccessStatusCode)
                                                            {
                                                                string soapResponse4 = await response4.Content.ReadAsStringAsync();
                                                            }
                                                            else
                                                            {
                                                                Console.WriteLine(response4);
                                                                string error = "RequestResult not found in response.";
                                                            }
Hope you can explain

2 Replies

Reply to Thread
0
carlos camara Replied
Can some help me on this

1
Tony Scholz Replied
Employee Post
Hello Carlos, 

I believe the issue is the URL that you are using 
You will want this to reference your install
I did some test calls to verify that they are working. Here i Have created the ticket


And here I am setting to follow up. 


You should be good after switching up the URL that you are using. 

Thank you
Tony Scholz System/Network Administrator SmarterTools Inc. www.smartertools.com

Reply to Thread