事例

Function:

 The main function of this example is to  upload tracking number and other information to Teapplix 
and mark the order shipped.

Interface:

 https://aip.teapplix.com/api2/Shipment

Program development environment

 The development environment of the sample program is Visual studio .NET 2015 C # .

Published Date:

  2017/12/05

Need to confirm the shipping order for the json string as follows

{
    "Shipments": [
        {
            "TxnId": "IB14950573227684",
            "ShipDate": "2017-11-05",
            
            "TrackingInfo": {
                "TrackingNumber": "999999999999",
                "CarrierName": "USPS"
            }           
        }
    ]
}
The organization of the program is shown in the figure

Program interface

The .NET console program example is as follows

1、.NET reference is required as follows
2、XXXXXXXXXXXXXXXXXXX on behalf of the APIToken value, you can logon Teapplix in the SETUP-API menu obtained.

The HttpClientHelp.cs program is as follows:
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Security.Policy;
using System.Threading.Tasks;
using System.Web;

namespace WebApp.Utility
{
  public class HttpClientHelp
  {
    public static readonly HttpClient _httpClient = null;
    static HttpClientHelp()
    {
      _httpClient = new HttpClient();          
    }   
  }
  public static async Task<string> MakeOrderShipped()
  {
      var postJson = "{\"Shipments\": [{\"TxnId\": \"IB14950573227684\",\"ShipDate\": \"2017-11-05\",";
      postJson=postJson+"\"TrackingInfo\":{\"TrackingNumber\": \"999999999999\",\"CarrierName\": \"USPS\"}}]}" 
      var requestUri = "https://api.teapplix.com/api2/Shipment";
     if (requestUri.StartsWith("https"))
        ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
      HttpContent httpContent = new StringContent(postJson);
      httpContent.Headers.Add("ContentType", "application/json");
      httpContent.Headers.Add("APIToken", "XXXXXXXXXXXXXXXXXXXXXX");
      var response = await _httpClient.PostAsync(requestUri, httpContent);
      response.EnsureSuccessStatusCode();
      return await response.Content.ReadAsStringAsync();
  }
 }
}

The program.cs program is as follows:

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WebApp.Utility;
using System.Net.Http;
using System.Runtime.Serialization.Json;
using System.Web.Script.Serialization;

namespace ConsoleApplication1
{
 class Program
 {
   static void Main(string[] args)
   {    
     MakeOrderShipped();
   }
    private static void MakeOrderShipped()
    {
        var sls = HttpClientHelp.MakeOrderShipped().Result;       
        Console.ReadLine();
    }
 }
}