Example

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

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

{
 "Shipments": [
 {
 "TxnId": "IB14950506712553",
 "ShipDate": "2017-06-02",
 "ShipMethod": " FirstClass Parcel",
 "Weight": {
 "Value": 2,
 "Unit": "OZ"
 },
 "TrackingInfo": {
 "TrackingNumber": "987654321",
 "CarrierName": "USPS"
 },
 "PostageAmount": {
 "Amount": 1,
 "Currency": "USD"
 },
 "WarehouseId": 0,
 "Force": false
 }
 ]
 }
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\": \"IB14950506712553\",\"ShipDate\": \"2017-06-02\",";
      postJson=postJson+"\"ShipMethod\": \" FirstClass Parcel\",\"Weight\": {\"Value\": 2,\"Unit\": \"OZ\"},";
      postJson=postJson+"\"TrackingInfo\": {\"TrackingNumber\": \"987654321\",\"CarrierName\": \"USPS\"},";
      postJson=postJson+"\"PostageAmount\": {\"Amount\": 1,\"Currency\": \"USD\"},";
      postJson=postJson+"\"WarehouseId\": 0,\"Force\": false}]}";" 
      var requestUri = "https://api.teapplix.com/api2/Shipment";
      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();
    }
 }
}