Here is sample code written in C# to create a Company.

using System;
using System.IO;
using System.Net;
using System.Text;
using System.Xml;
namespace TeamSupport.Api.Consumer
  class Program
    static void Main(string[] args)
      // Create a company
      string URI = "https://app.[ServerName]";
      HttpWebRequest request = (HttpWebRequest)WebRequest.Create(URI);
      string organizationID       = "{Your organization ID}";
      string apiToken             = "{Your API Token}";
      string credentials          = string.Format("{0}:{1}", organizationID, apiToken);
      Byte[] credentialsByteArray = UTF8Encoding.UTF8.GetBytes(credentials);
      string encodedCredentials   = Convert.ToBase64String(credentialsByteArray);
      request.Headers.Add("Authorization", "Basic " + encodedCredentials);
      request.Method      = "POST";
      request.ContentType = "application/xml";
      request.UserAgent   = "your organization name";
      MemoryStream stream = new MemoryStream();
      XmlTextWriter writer = new XmlTextWriter(stream, new UTF8Encoding(false));
      writer.Formatting = Formatting.Indented;
      writer.WriteElementString("Name", "Second Company, Inc.");
      writer.WriteElementString("Website", "");
      writer.WriteElementString("Customercustomfield1", "CustomField1Value");
      stream.Position = 0;
      StreamReader reader = new StreamReader(stream);
      string body = reader.ReadToEnd();
      Byte[] bodyByteArray = UTF8Encoding.UTF8.GetBytes(body);
      int offSet = 0;
      int count = bodyByteArray.Length;
      using (Stream requestStream = request.GetRequestStream())
        requestStream.Write(bodyByteArray, offSet, count);
      HttpWebResponse response = (HttpWebResponse)request.GetResponse();

Here is sample code written in PHP to create a ticket.

$apiToken ='Your_API_KEY';
        <Name>Title goes here</Name>
        <Description>This is the content of the new ticket description.</Description>
  $process = curl_init();
  curl_setopt( $process, CURLOPT_URL, $host );
  curl_setopt( $process, CURLOPT_POST, true );
  curl_setopt($process, CURLOPT_HTTPHEADER,array('Content-Type: application/xml', 'Authorization: Basic '.$base64str));
  curl_setopt($process, CURLOPT_TIMEOUT, 30);
  curl_setopt($process, CURLOPT_POSTFIELDS, $input_xml);
  curl_setopt($process, CURLOPT_RETURNTRANSFER, TRUE);
  $return = curl_exec($process);
  $response = curl_getinfo( $process );

Click here to learn more about our API.

Need more help with this?
Don’t hesitate to contact us here.

Was this helpful?

Yes No
You indicated this topic was not helpful to you ...
Could you please leave a comment telling us why? Thank you!
Thanks for your feedback.