接口信息
接口地址
https://verify.rokig.fun/api.php?api=getfile
返回格式
json请求方式
json请求示例
https://api.example.com
请求参数说明
| 名称 | 变量 | 必填 | 类型 | 说明 |
|---|---|---|---|---|
| 接口 | api | 是 | GET | 填写getfile |
| 应用 | app | 是 | GET | 填写后台应用APPID |
| 文件ID | id | 否 | GET | 填写则返回指定外链,不填则输出该应用下全部外链 |
返回参数说明
| 名称 | 类型 | 说明 |
|---|---|---|
| code | String | 返回状态 |
| file_url | String | 外链地址 |
| date | String | 添加时间 |
| state | String | 外链开关 |
返回示例
返回示例
{
"code": 200,
"msg": [{
"file_url":
"https://developer5.baidupan.com/030221bb/2018/06/25/4d9f2679fb059aca678eedc64303aaf3.exe?st=AUxq-dJJnBaYr42OBYlmoQ&e=1614694462&b=BgMPaghqUAZZZFNgUW0OZlRKDDlWOwFrUSxdNVMsUjU_c&fi=3892949&pid=124-89-203-73&up=",
"date": "2021-03-02 21:40:50",
"state": "y"
}],
"time": 1614692463,
"check": "7f5396bd94ea73c952a20294f3bcdd79"
}
错误码参照
| 名称 | 类型 | 说明 |
|---|---|---|
| 101 | String | 应用不存在 |
| 102 | String | 应用已关闭 |
| 171 | String | 接口维护中 |
| 172 | String | 接口未添加或不存在 |
示例代码
C++ 示例代码
// R验云网络验证 - 获取文件外链 接口调用示例(C++)
// 编译:g++ -o getfile getfile.cpp -lcurl
#include <iostream>
#include <string>
#include <curl/curl.h>
// 回调函数:接收服务器返回的数据
static size_t write_callback(void *contents, size_t size, size_t nmemb, void *userp) {
((std::string*)userp)->append((char*)contents, size * nmemb);
return size * nmemb;
}
int main() {
std::string appid = "你的APPID"; // 后台应用 APPID
std::string api = "getfile";
std::string url = "https://verify.rokig.fun/api.php?api=" + api + "&app=" + appid;
// 请求参数(是=必填,否=选填)
std::string params = "id=否";
// 发送请求
CURL *curl = curl_easy_init();
std::string response;
if (curl) {
std::string request_url = url + "&" + params;
curl_easy_setopt(curl, CURLOPT_URL, request_url.c_str());
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_callback);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response);
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
CURLcode res = curl_easy_perform(curl);
curl_easy_cleanup(curl);
if (res != CURLE_OK) {
std::cerr << "请求失败: " << curl_easy_strerror(res) << std::endl;
return 1;
}
}
// 输出返回结果(JSON,code 为 200 表示成功)
std::cout << "返回结果: " << response << std::endl;
return 0;
}