跳到主要内容

获取企业基础信息

读取企业公开的基础信息(如企业名称、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)​

{
"code": 500,
"msg": "PERMISSION_DENIED",
"data": null
}
msg 错误码说明与排查建议
PERMISSION_DENIED应用状态异常(已被停用、取消发布或删除)
SERVER_ERROR服务端内部异常,请稍后重试

多语言调用示例​

以下示例使用服务端调用方式;应用密钥和应用令牌不得下发到客户端。

Shell​

curl -sS -X GET "https://{gateway_host}/open/v1/enterprise/info" \
-H "Authorization: Bearer access-token-xxx" \\\n -H "Content-Type: application/json" \

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', 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => null,
CURLOPT_RETURNTRANSFER => true,
]);
echo curl_exec($handle);
curl_close($handle);

Golang​

package main

import (
"bytes"
"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")
request.Header.Set("Content-Type", "application/json")
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 = nullptr;
headers = curl_slist_append(headers, "Authorization: Bearer access-token-xxx");
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(handle, CURLOPT_URL, "https://{gateway_host}/open/v1/enterprise/info");
curl_easy_setopt(handle, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(handle, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(handle, CURLOPT_POSTFIELDS, nullptr);
const CURLcode result = curl_easy_perform(handle);
curl_slist_free_all(headers);
curl_easy_cleanup(handle);
return result == CURLE_OK ? 0 : 1;
}