说明
-
官方文档地址:
-
有问题,bug 等 可以联系我,email:
admin@www.baijiekang.com
-
如果接口数据返回成功,
code
等于 200, 不为200
都是失败
接口Url
完整请求路径为:https://api.vpsdie.com/版本/接口名/api.html
例如:https://api.vpsdie.com/v1/UserData/api.html
目前支持post,get请求
请求必选参数:uk
用户密钥
Go
下面代码可以简单获取用户密钥为test
的FecApi用户信息
package main
import (
"fmt"
"io/ioutil"
"net/http"
"strings"
)
func main() {
url := "https://api.vpsdie.com/v1/UserData/api.html"
payload := strings.NewReader("uk=test")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
PHP
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.vpsdie.com/v1/UserData/api.html",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "uk=test",
CURLOPT_HTTPHEADER => array(
"Content-Type: application/x-www-form-urlencoded",
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
JAVA
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
RequestBody body = RequestBody.create(mediaType, "uk=test");
Request request = new Request.Builder()
.url("https://api.vpsdie.com/v1/UserData/api.html")
.post(body)
.addHeader("Content-Type", "application/x-www-form-urlencoded")
.build();
Response response = client.newCall(request).execute();
Curl
curl -X POST \
https://api.vpsdie.com/v1/UserData/api.html \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d 'uk=test'
JAVASCRIPT
var data = "uk=test";
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("POST", "https://api.vpsdie.com/v1/UserData/api.html");
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.send(data);
Python
import requests
url = "https://api.vpsdie.com/v1/UserData/api.html"
payload = "uk=test"
headers = {'Content-Type': "application/x-www-form-urlencoded"}
response = requests.request("POST", url, data=payload, headers=headers)
print(response.text)
用户密钥 UserKey
USERKEY又名Token,是请求接口时的必选参数,需要在