事例

Function:

  Order download is a query you sent to Teapplix, which will return a list of "Order" JSON data to 
be returned from the body.

Interface:

 https://api.teapplix.com/api2/OrderNotification

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> DownLoadOrders()
        {           
            //download the IB14950464025006 order from teapplix
            var requestUri = "https://api.teapplix.com/api2/OrderNotification?TxnId=IB14950464025006";          
            if (requestUri.StartsWith("https"))
               ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
            _httpClient.DefaultRequestHeaders.Add("APIToken", "xxxxxxxxxxxxxxxxxxx");
            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;
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 orders from teapplix
            DownLoadOrderFromTeapplix();
        }

        private static void DownLoadOrderFromTeapplix()
        {
            var sls = HttpClientHelp.DownLoadOrders().Result;
            Console.Write(sls.ToString());
            Console.ReadLine();
        }   
    }
}