雲尚API

查詢產品列表(products)

回傳平台所有已啟用的產品(API)列表。無額外業務參數,僅需攜帶通用請求參數。僅限銷售/管理員角色呼叫。

介面資訊

項目說明
介面位址POST /api.php
actionproducts
認證方式全域應用 APP ID / APP KEY
角色限制僅銷售/管理員

請求參數

無額外參數,僅通用請求參數(action / app_id / app_key)。

請求範例

{
    "action": "products",
    "app_id": "68B0FA47FEC9E7EBC4BF80F8",
    "app_key": "2b901515a427b6c0b68f866eece70e0d2ecf687146022412"
}

PHP

<?php
$app_id = '68B0FA47FEC9E7EBC4BF80F8';
$app_key = '2b901515a427b6c0b68f866eece70e0d2ecf687146022412';
$url = 'https://yunsapi.com/api.php';

$params = [
    'action'  => 'products',
    'app_id'  => $app_id,
    'app_key' => $app_key,
];

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($params));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

$resp = curl_exec($ch);
curl_close($ch);
echo $resp;

Java

import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class ApiDemo {
    static final String URL = "https://yunsapi.com/api.php";
    static final String APP_ID = "68B0FA47FEC9E7EBC4BF80F8";
    static final String APP_KEY = "2b901515a427b6c0b68f866eece70e0d2ecf687146022412";

    public static void main(String[] args) throws Exception {
        String body = "{\"action\":\"products\",\"app_id\":\"" + APP_ID + "\",\"app_key\":\"" + APP_KEY + "\"}";
        HttpClient client = HttpClient.newHttpClient();
        HttpRequest req = HttpRequest.newBuilder()
                .uri(URI.create(URL))
                .header("Content-Type", "application/json")
                .POST(HttpRequest.BodyPublishers.ofString(body))
                .build();
        HttpResponse<String> resp = client.send(req, HttpResponse.BodyHandlers.ofString());
        System.out.println(resp.body());
    }
}

回應範例

{
    "code": 0,
    "msg": "success",
    "data": [
        {
            "id": "1",
            "cat_id": "1",
            "name": "簡訊驗證碼",
            "code": "dxyzm",
            "price": "0.0000",
            "is_buyout": "0",
            "intro": "呼叫阿里雲簡訊介面發送驗證碼",
            "doc_url": "https://yunsapi.com/doc/?page=dxyzm",
            "status": "1",
            "require_realname": "1"
        }
    ]
}

回應參數

參數類型說明
data[].idstringAPI ID
data[].namestringAPI 名稱
data[].codestringAPI 程式碼
data[].pricestring原價格
data[].is_buyoutstring是否買斷(1 買斷 / 0 套餐)
data[].introstring簡介
data[].doc_urlstring文件位址
data[].require_realnamestring是否需要實名(1 需要 / 0 不需要)