中篇:热门免费 API 集合(附接入代码示例)

1、通知短信:当您需要快速通知用户时,通知短信是最快捷有效的方式。短信通知支持三大运营商以及虚拟运营商,我们提供电信级运维保障、独享专用通道。

Java 接入示例:

OkHttpClient client = new OkHttpClient().newBuilder().build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{"msg":"","params":"","sendtime":"","extend":"","uid":""}");
Request request = new Request.Builder()
  .url("https://eolink.o.apispace.com/sms-notify/notify")
  .method("POST",body)
  .addHeader("X-APISpace-Token","")
  .addHeader("Authorization-Type","apikey")
  .addHeader("Content-Type","")
  .build();

Response response = client.newCall(request).execute();
System.out.println(response.body().string());

2 空气质量查询:支持国内3400+个城市的整点观测,并附带空气质量监测点(全国共2335个)的整点观测数据。

Python 接入示例:

import requests

url = "https://eolink.o.apispace.com/34324/air/v001/aqi"

payload = {"areacode" : "101010100","lonlat" : "116.407526,39.904030"}

headers = {
    "X-APISpace-Token":"",
    "Authorization-Type":"apikey"
}

response=requests.request("GET", url, params=payload, headers=headers)

print(response.text)

3、二维码识别OCR:对图片中的二维码、条形码进行检测和识别,返回存储的文字内容。

PHP 接入示例:

 "https://eolink.o.apispace.com/ocrbarcode/ocr/v1/barcode",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "{"image":null,"url":null,"pdf":null,"pdf_page":null}",
  CURLOPT_HTTPHEADER => array(
    "X-APISpace-Token:",
    "Authorization-Type:apikey",
    "Content-Type:application/json"
  ),
));

$response = curl_exec($curl);

$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}

4、发票核验:发票真伪验证服务,根据发票类型代码和发票四要素获取发票全票面信息,支持全国增值税专用发票、增值税普通发票(含电子普通发票、卷式发票、通行费发票)、机动车销售统一发票、货物运输业增值税专用发票、二手车销售统一发票等不同发票的验真。

JavaScript 接入示例:

var data = "{"date":"20180101","number":"12341234","code":"1234123412","verifyCode":"123132","priceWithoutTax":"123.12","type":"01"}"

var xhr = new XMLHttpRequest();
xhr.withCredentials = false;

xhr.addEventListener("readystatechange", function () {
    if (this.readyState === 4) {
        console.log(this.responseText);
    }
});

xhr.open("POST", "https://eolink.o.apispace.com/fphy2/fapiao2");
xhr.setRequestHeader("X-APISpace-Token","");
xhr.setRequestHeader("Authorization-Type","apikey");
xhr.setRequestHeader("Content-Type","application/json");

xhr.send(data);

5、全国快递物流地图轨迹查询:通过物流单号和收寄件地址,自动评估物流时效,并在地图中展示包裹运输轨迹。包括顺丰、圆通、申通等主流快递公司。自动识别快递公司及单号,实时查询,稳定高效,服务器毫秒响应,数据及时准确。

微信小程序接入示例:

var data = "{"cpCode":null,"mailNo":null,"phone":null,"origin":null,"destination":null,"receiveAddress":null,"responseModel":null}"

wx.request({
    "url":"https://eolink.o.apispace.com/wldtgj1/paidtobuy_api/trace_map",
    "method": "POST",
    "header": {
        "X-APISpace-Token":"",
        "Authorization-Type":"apikey",
        "Content-Type":""
    },
    "data": data,
    "success": (response)=> {
        console.log(response.data)
    }
})

6、空号检测:通过手机号码查询其在网活跃度,返回包括空号、实号、停机、库无、沉默号、风险号等状态。

NodeJS 接入示例:

var qs = require("querystring");
var http = require("https");
var requestInfo={
    "method": "POST",
    "hostname": "eolink.o.apispace.com",
    "path": "/konghao/batch-ucheck",
    "headers": {
        "X-APISpace-Token":"",
        "Authorization-Type":"apikey",
        "Content-Type":""
   }
};

var req = http.request(requestInfo, function (res) {
    var chunks = [];

    res.on("data", function (chunk) {
        chunks.push(chunk);
    });

    res.on("end", function () {
        var body = Buffer.concat(chunks);
        console.log(body.toString());
    });
});

req.write(qs.stringify({
        "mobiles": "",
        "type": ""
}));
req.end();

你可能感兴趣的:(中篇:热门免费 API 集合(附接入代码示例))