correiosApi
1.0.0
如何使用
例子
HTTP 获取
NODEJS - HTTP 原生
NODEJS - 使用请求
NODEJS - 使用 UNIREST
C# 使用 RESTSHARP
JAVA - 使用 UNIREST
PHP 卷曲
PYTHON 请求
红宝石
迅速
去
答案
200
404
BASEURL:https://api.linketrack.com/track/json
参数:
用户: 用户名
令牌:用户令牌
代码:订单追踪代码
下面的示例使用测试用户。要请求新用户和令牌,请发送电子邮件至 [email protected]
GET https://api.linketrack.com/track/json?user=teste&token=1abcd00b2731640e886fb41a8a9671ad1434c599dbaa0a0de9a5aa619f29a83f&codigo=LX002249507BR
https://github.com/Diaszano/linketrackjs -> 由@diaszano 创建的非官方客户端
var https = require('follow-redirects').https;var fs = require('fs');var options = { '方法':'获取', '主机名': 'api.linketrack.com', '路径': '/track/json?user=teste&token=1abcd00b2731640e886fb41a8a9671ad1434c599dbaa0a0de9a5aa619f29a83f&codigo=LX002249507BR', '标题':{ }, 'maxRedirects': 20};var req = https.request(选项, 函数 (res) { var 块 = []; res.on("data", function (chunk) {chunks.push(chunk); }); res.on("end", function (chunk) {var body = Buffer.concat(chunks);console.log(body.toString()); }); res.on("错误", 函数(错误) {console.error(错误); });});req.end();
var request = require('request');var options = { '方法':'获取', 'url': 'https://api.linketrack.com/track/json?user=teste&token=1abcd00b2731640e886fb41a8a9671ad1434c599dbaa0a0de9a5aa619f29a83f&codigo=LX002249507BR', '标题':{ }};请求(选项,函数(错误,响应){ 如果(错误)抛出新的错误(错误); console.log(response.body);});
var unirest = require('unirest');var req = unirest('GET', 'https://api.linketrack.com/track/json?user=teste&token=1abcd00b2731640e886fb41a8a9671ad1434c599dbaa0a0de9a5aa619f29a83f&codigo=LX002249507BR') .end(function (res) { if (res.error) throw new Error(res.error); console.log(res.raw_body); });
var client = new RestClient("https://api.linketrack.com/track/json?user=teste&token=1abcd00b2731640e886fb41a8a9671ad1434c599dbaa0a0de9a5aa619f29a83f&codigo=LX002249507BR");client.Timeout = -1;var request = new RestRequest(Method.GET);IRestResponse response = client.Execute(request);Console.WriteLine(response.Content);
Unirest.setTimeouts(0, 0);HttpResponse<String> 响应 = Unirest.get("https://api.linketrack.com/track/json?user=teste&token=1abcd00b2731640e886fb41a8a9671ad1434c599dbaa0a0de9a5aa619f29a83f&codigo=LX002249507BR") .asString();
OkHttpClient 客户端 = new OkHttpClient().newBuilder() .build();Request request = new Request.Builder() .url("https://api.linketrack.com/track/json?user=teste&token=1abcd00b2731640e886fb41a8a9671ad1434c599dbaa0a0de9a5aa619f29a83f&codigo=LX002249507BR") .method("GET", 空) .build();响应response = client.newCall(request).execute();
<?php$curl = curl_init();curl_setopt_array($curl, array( CURLOPT_URL => “https://api.linketrack.com/track/json?user=teste&token=1abcd00b2731640e886fb41a8a9671ad1434c599dbaa0a0de9a5aa619f29a83f&codigo=LX002249507BR”,CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING =>“”、CURLOPT_MAXREDIRS => 10、CURLOPT_TIMEOUT => 0、CURLOPT_FOLLOWLOCATION => true、CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1、CURLOPT_CUSTOMREQUEST =>“GET”、 ));$response = curl_exec($curl);curl_close($curl);echo $response;
导入 requestsurl = "https://api.linketrack.com/track/json?user=teste&token=1abcd00b2731640e886fb41a8a9671ad1434c599dbaa0a0de9a5aa619f29a83f&codigo=LX002249507BR"有效负载 = {}标头= {}response = requests.request("GET", url, headers=headers, data = Payload)print(response.text.encode('utf8'))
需要“uri”需要“net/http”url = URI("https://api.linketrack.com/track/json?user=teste&token=1abcd00b2731640e886fb41a8a9671ad1434c599dbaa0a0de9a5aa619f29a83f&codigo=LX002249507BR")https = Net::HTTP.new(url.host, url.port);https.use_ssl = truerequest = Net::HTTP::Get.new(url)response = https.request(request)puts response.read_body
import Foundationvar semaphore = DispatchSemaphore (值: 0)var request = URLRequest(url: URL(字符串: “https://api.linketrack.com/track/json?user=teste&token=1abcd00b2731640e886fb41a8a9671ad1434c599dbaa0a0de9a5aa619f29a83f&codigo=LX002249507BR”)!,超时间隔: Double.infinity)request.httpMethod = "GET"let task = URLSession.shared.dataTask(with: request) { 数据、响应、错误 Guard let data = data else {print(String(描述:错误))return } 打印(字符串(数据:数据,编码:.utf8)!) semaphore.signal()}task.resume()semaphore.wait()
包 mainimport(“fmt” “网络/http” "io/ioutil")func main() { url := "https://api.linketrack.com/track/json?user=teste&token=1abcd00b2731640e886fb41a8a9671ad1434c599dbaa0a0de9a5aa619f29a83f&codigo=LX002249507BR" 方法:=“获取” 客户端 := &http.Client { } req, err := http.NewRequest(method, url, nil) if err != nil {fmt.Println(err) } res, err := client.Do(req) defer res.Body.Close() body, err := ioutil.ReadAll(res.Body) fmt.Println(string(body)) }
️ subStatus
字段的值根据跟踪源的不同而不同,不应该被考虑:该字段将来将不再使用!
{ “代码”:“LX002249507BR”,“服务”:“PAC - 经济秩序”,“主机”:“dw”,“数量”:12,“事件”:[ { "date": "10/24/2019", "time": "10:40", "location": "CURITIBA/PR", "status": "由 IRS 授权返回", "subStatus": [ “由 CENTRO INTERNACIONAL PR 注册 - CURITIBA/PR”] }, { "date": "09/11/2019", "time": "00:00", "location": "CURITIBA/PR", "status": "未按时付款", "subStatus": [ “目标分析下的对象”] }, { "date": "15/08/2019", "time": "13:37", "location": "CURITIBA/PR", "status": "转发至海关检查", "subStatus": ["由 CENTRO INTERNACIONAL PR 注册 - CURITIBA/PR"] }, { "date": "13/08/2019", "time": "16:53", "location": "CURITIBA/PR", "status": "转发至海关检查", "subStatus": ["由 CENTRO INTERNACIONAL PR 注册 - CURITIBA/PR"] }, { "date": "13/08/2019", "time": "16:13", "location": "CURITIBA/PR", "status": "转发至海关检查", "subStatus": ["由 CENTRO INTERNACIONAL PR 注册 - CURITIBA/PR"] }, { "date": "13/08/2019", "time": "14:34", "location": "CURITIBA/PR", "status": "转发至海关检查", "subStatus": ["由 CENTRO INTERNACIONAL PR 注册 - CURITIBA/PR"] }, { "date": "09/08/2019", "time": "18:11", "location": "CURITIBA/PR", "status": "等待付款", "subStatus": ["<span class="minhasImportacoes">访问环境<a href="https://www.correios.com.br/encomendas-logistica/minhas-importacoes/minhas-importacoes" target="_blank">Minhas Importações</a></span>"] }, { "date": "09/08/2019", "time": "15:23", "location": "CURITIBA/PR", "status": "转发至海关检查", "subStatus": ["由 CENTRO INTERNACIONAL PR 注册 - CURITIBA/PR"] }, { "date": "09/08/2019", "time": "12:22", "location": "CURITIBA/PR", "status": "转发的对象", "subStatus": ["来自 CENTER国际公关 - 库里蒂巴/海关检查公关 - /BR" ] }, { "date": "08/09/2019", "time": "12:22", "location": "CURITIBA/PR", "status": "转发至海关检查", "subStatus": ["由 CENTRO INTERNACIONAL PR 注册 - CURITIBA/PR"] }, { "date": "07/31/2019", "time": "15:10", "location": "CURITIBA/PR", "status": "正在分析中的客户提供的信息", "subStatus" : [“由 CENTRO INTERNACIONAL PR - CURITIBA/PR 注册”] }, { "date": "07/31/2019", "time": "14:15", "location": "CURITIBA/PR", "status": "信息丢失。您需要采取行动", "subStatus " : ["<span class="minhasImportacoes">访问环境<a href="https://www.correios.com.br/encomendas-logistica/minhas-importacoes/minhas-importacoes" target="_blank">Minhas Importações</a></span>"] } ], }
{“代码”:“AA123123123BR”,“服务”:“SEDEX - Encomenda Expressa”,“主机”:“dw”,“数量”:0,“事件”:[ ], }
奇皮图克斯
麻省理工学院