Coder Social home page Coder Social logo

tracking-sdk-java's Introduction

Trackingmore-JAVA

The JAVA SDK of Trackingmore API

Official document

Document

##Init

import api.Api;

    //in you class
    public class Test {
      ...
      static Api api = new Api("you api Key");
      ...
    }

Quick Start

  • Put your ApiKey in the constructor of the Api class
  • All returns are in Json format String.
  • After instantiating the Api class, you can use its interface methods
  • You can set the sandbox of the Api instance to true to turn on the sandbox mode: api.sandbox=true;
  • Most Api params receive multiple tracking numbers

Get a list of the couriers in Trackingmore

String response = api->courier();

Detect which couriers defined in your account match a tracking number

String data = "{\"tracking_number\":\"UB209300714LV\"}"
String response = api->detect(data);

Post trackings to your account

//Create single tracking numbers
String data = "{\"tracking_number\" => \"RP325552475CN\", \"carrier_code\" => \"china-post\"}";
//Create multiple tracking numbers
String data = "[{\"tracking_number\" => \"RP325552475CN\", \"carrier_code\" => \"china-post\"}",
    "{\"tracking_number\" => \"LZ448865302CN\", \"carrier_code\" => \"china-ems\"}]";
String response =api->create(data);

Summary of Connection API Methods with all the api and Methods

#sandbox model
api->sandbox = true;
# Get a tracking number of real-time query result data
//String data = "{\"tracking_number\" => \"UB209300714LV\", \"carrier_code\" => \"cainiao\"}";
//String response = api->realtime(data);

# archive
String data = "{\"tracking_number\" => \"RP325552475CN\", \"carrier_code\" => \"china-post\"}";
String response = api->archive(data);

# Get a list of all carriers
String response = api->courier();

# Create a tracking number
String data = "{\"tracking_number\" => \"RP325552475CN\", \"carrier_code\" => \"china-post\"}";
String response = api->create(data);

# Create multiple tracking numbers
String data = "[{\"tracking_number\" => \"RP325552475CN\", \"carrier_code\" => \"china-post\"}",
"{\"tracking_number\" => \"LZ448865302CN\", \"carrier_code\" => \"china-ems\"}]";
String response =api->create(data);

# Get logistics information for multiple tracking numbers
String data = "{\"tracking_number\" => \"RP325552475CN,LZ448865302CN\"}";
String response = api->get(data);

# Modify other information of a tracking number
String data = ['num'=>\"RP325552475CN\",'carrier_code'=>\"china-post\",\"order_id\" => \"#1234\"];
String response = api->modifyinfo(data);

# Modify the information of multiple tracking numbers
String data = "[{\"tracking_number\" => \"RP325552475CN\", \"carrier_code\" => \"china-post\", \"order_id\" => \"#1234\",}{\"tracking_number\" => \"LZ448865302CN\", \"carrier_code\" => \"china-ems\", \"order_id\" => \"#5678\",},]";
String response =  api->modifyinfo(data);

# Modify the carrier code of a tracking number
String data = "{\"tracking_number\" => \"RP325552475CN\", \"carrier_code\" => \"china-post\", \"new_carrier_code\" => \"china-ems\"}";
String response =  api->modifyCourier(data);

# Delete a tracking number
String response = api->delete("{\"tracking_number\":\"RP325552475CN\"}");

# Delete multiple tracking numbers
String data = "[{\"tracking_number\" => \"RP325552475CN\", \"carrier_code\" => \"china-post\"}",
"{\"tracking_number\" => \"LZ448865302CN\", \"carrier_code\" => \"china-ems\"}]";
String response = api->delete(data);

# Set multiple tracking numbers no longer update
String data ="[
{\"tracking_number\" => \"RP325552475CN\", \"carrier_code\" => \"china-post\"}",
"{\"tracking_number\" => \"LZ448865302CN\", \"carrier_code\" => \"china-ems\"},
]";
String response = api->notUpdate(data);

# Get status statistics of tracking ticket number
String data = "{\"created_at_min\" => "1621663220", \"created_at_max\" => "1621664220"}";
String response = api->status(data);

# Get user information
String response =  api->user();

# Query whether remote
String data = "[
{\"country\" => \"Japan\", \"postcode\" => \"7621094\"},
{\"country\" => \"NZ\", \"postcode\" => \"Papaaroha\"},
]";
String response = api->remote(data);

# Get the timeliness of multiple carriers
String data = "[
{\"original\" => \"CN\", \"destination\" => \"US\", \"carrier_code\" => \"dhl\"},
{\"original\" => \"CN\", \"destination\" => \"RU\", \"carrier_code\" => \"dhl\"},
]";
String response = api->transitTime(data);

Typical Server Responses

We will respond with one of the following status codes.

Code Type Message
200 Success Request response is successful
203 PaymentRequired API service is only available for paid account Please subscribe paid plan to unlock API services ul
204 No Content Request was successful, but no data returned Tracking NO. or target data possibly do not exist
400 Bad Request Request type error Please check the API documentation for the request type of this API
401 Unauthorized Authentication failed or has no permission Please check and ensure your API Key is correct
403 Bad Request Page does not exist Please check and ensure your link is correct ul
404 Not Found Page does not exist Please check and ensure your link is correct
408 Time Out Request timeout The official website did not return data, please try again later
411 Bad Request Specified request parameter length exceeds length limit Please check and ensure that the request parameters are of the required length
412 Bad Request Specified request parameter format doesn't meet requirements Please check and ensure that the request parameters are in the required format
413 Out limited The number of request parameters exceeds the limit Please check the API documentation for the limit of this API
417 Bad Request Missing request parameters or request parameters cannot be parsed Please check and ensure that the request parameters are complete and correctly formatted
421 Bad Request Some of required parameters are empty Some couriers need special parameters to track logistics information (Special Couriers)
422 Bad Request Unidentifiable courier code Please check and ensure that the courier code are correct(Courier code)
423 Bad Request Tracking No. already exists
424 Bad Request Tracking No. no exists Please use 「Create trckings」 API first to create trackings
429 Bad Request Exceeded API request limits, please try again later Please check the API documentation for the limit of this API
511 Server Error Server error Please contact us: [email protected].
512 Server Error Server error Please contact us: [email protected].
513 Server Error Server error Please contact us: [email protected].

tracking-sdk-java's People

Contributors

trackingmore100 avatar tuyutian avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.