事例

Function:

 The main function of this example is to obtain the tracking number of the shipped order.

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/6/12

The organization of the program is shown in the figure

Program interface

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;
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> DownLoadTracking()
        {
           //Get the tracking number for the 3577521457902 order 
            var requestUri ="https://api.teapplix.com/api2/Shipment?TxnId=3577521457902";
            if (requestUri.StartsWith("https"))
              ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
            _httpClient.DefaultRequestHeaders.Add("APIToken", "XXXXXXXXXXXXXXXXXXXX");
            var response = await _httpClient.GetAsync(requestUri);
            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)
        {
            //This function is to download tracking no
            //DownLoadTrackingNo();
        }
        private static void DownLoadTrackingNo()
        {
         var sls = HttpClientHelp.DownLoadTracking().Result;
         Console.Write(sls.ToString());
         Console.ReadLine();
       }
    }
 }