跳至主要内容

取得企業基本資訊

讀取企業公開的基本資訊,例如企業名稱和 Logo。

介面資訊​

項目說明
介面名稱取得企業基本資訊
權限標識enterprise.info.read(讀取企業基本資訊)
請求方式POST / GET
請求地址https://{gateway_host}/open/v1/enterprise/info
資料格式application/json(POST 時)或 URL Query
鑑權方式應用級 access_token(需具備 enterprise.info.read 權限)

注意:本介面的實際請求路徑以 /info 結尾,末尾沒有 /get。

前置條件​

  1. 應用已在管理後臺「內部應用」中發布並啟用。
  2. 已取得有效的應用級 access_token。

請求參數​

請求標頭​

請求標頭必填說明
Authorization否Bearer <access_token>,建議的憑證傳遞方式;請不要與 Query 或表單方式同時使用
Content-Type否POST 使用 JSON 時傳入 application/json

參數列表​

本介面沒有必填的業務參數:

參數名類型必填說明
access_tokenstring是應用級令牌(未在 Authorization 標頭中攜帶時必填)
targetCorpIdstring否相容性保留欄位,系統會忽略,不影響目前企業資訊的返回

請求範例​

POST 請求:

POST https://{gateway_host}/open/v1/enterprise/info
Authorization: Bearer <access_token>
Content-Type: application/json

{}

GET 請求:

GET https://{gateway_host}/open/v1/enterprise/info
Authorization: Bearer <access_token>

回應參數​

成功回應(平臺統一回應外殼):

{
"code": 200,
"msg": "",
"data": { "name": "範例企業", "logo": "https://cdn.example.com/logo.png" }
}
欄位類型說明
codeinteger業務狀態碼;200 表示成功
msgstring訊息;成功時為空
data.namestring企業註冊名稱或顯示名稱
data.logostring企業 Logo 圖片 URL;未設定時省略

權限與可見範圍​

  1. 不受可見範圍影響:基本企業資訊是租戶級顯示資料,不受應用成員或部門可見範圍限制。
  2. 保護私有設定:私有企業設定、付款參數、安全密鑰等後臺管理資料屬於敏感內部資料,不在開放能力範圍內,本介面不會返回。

錯誤碼​

鑑權與中介軟體錯誤(HTTP 狀態碼)​

HTTP 狀態碼msg 錯誤碼說明
401INVALID_TOKEN令牌缺失、過期、撤銷,或應用不可用
403SCOPE_DENIED令牌缺少 enterprise.info.read 權限
403IP_DENIED來源 IP 不在應用安全設定的 IP 白名單中

業務錯誤(HTTP 200,code=500)​

msg 錯誤碼說明與排查建議
PERMISSION_DENIED應用狀態無效(已停用、未發布或已刪除)
SERVER_ERROR服務端異常,請稍後重試

多語言呼叫範例​

以下範例在服務端執行;應用密鑰和應用令牌不得下發到客戶端。

Shell​

curl -sS -X GET "https://{gateway_host}/open/v1/enterprise/info" -H "Authorization: Bearer access-token-xxx"

PHP​

<?php
// 生產環境應檢查 HTTP 狀態和回應體,再映射業務錯誤。
$handle = curl_init('https://{gateway_host}/open/v1/enterprise/info');
curl_setopt_array($handle, [CURLOPT_CUSTOMREQUEST => 'GET', CURLOPT_HTTPHEADER => ['Authorization: Bearer access-token-xxx'], CURLOPT_RETURNTRANSFER => true]);
echo curl_exec($handle); curl_close($handle);

Golang​

package main
import "net/http"
func main() {
// 令牌只在服務端請求中使用,並遵循介面的傳輸約定。
request, _ := http.NewRequest(http.MethodGet, "https://{gateway_host}/open/v1/enterprise/info", nil)
request.Header.Set("Authorization", "Bearer access-token-xxx")
response, _ := http.DefaultClient.Do(request); defer response.Body.Close()
}

C++​

#include <curl/curl.h>
int main() {
// 生產環境應啟用 TLS 校驗並處理 HTTP 錯誤。
CURL* handle = curl_easy_init();
struct curl_slist* headers = curl_slist_append(nullptr, "Authorization: Bearer access-token-xxx");
curl_easy_setopt(handle, CURLOPT_URL, "https://{gateway_host}/open/v1/enterprise/info"); curl_easy_setopt(handle, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(handle, CURLOPT_CUSTOMREQUEST, "GET");
const CURLcode result = curl_easy_perform(handle); curl_slist_free_all(headers); curl_easy_cleanup(handle); return result == CURLE_OK ? 0 : 1;
}