了解云银签 API的所有接口详情、参数说明及使用方法
所有 API 接口的请求都必须使用以下基础路径 (Base URL):
https://openapi.yunyinsign.com
实际请求时,请将这个基础路径和文档里每个接口的具体地址(比如 /service/getAccessToken)拼接起来,形成完整的请求地址。
例如,获取服务凭证的完整请求地址就是:https://openapi.yunyinsign.com/service/getAccessToken
只需三步,即可完成您的第一个云银签 API 调用。
在调用任何 API 之前,您需要拥有有效的应用凭证:
请前往 云银签开发者平台(具体地址请咨询平台管理员)注册账号、创建应用,并在应用详情中获取您的 AppId 和 AppSecret。
重要: AppSecret 是高度敏感信息,请务必妥善保管,切勿泄露或硬编码在客户端代码中。
所有业务 API 的调用都需要一个有效的 `accessToken` 进行身份验证。您需要使用您的 AppId 和 AppSecret 调用以下接口来获取它:
接口: POST
/service/getAccessToken (查看接口详情)
请求 Body (JSON):
{
"appId": "YOUR_APP_ID", // 替换为您的 AppId
"appSecret": "YOUR_APP_SECRET" // 替换为您的 AppSecret
}
调用示例:
curl -X POST 'https://your-api-host.com/service/getAccessToken' \
-H 'Content-Type: application/json' \
-d '{
"appId": "YOUR_APP_ID",
"appSecret": "YOUR_APP_SECRET"
}'
private static final String serverUrl = "https://your-api-host.com";
private static final String appId = "YOUR_APP_ID";
private static final String appSecret = "YOUR_APP_SECRET";
public static void main(String[] args) {
// 1. 初始化客户端
YunYinClient client = new YunYinClient(appId, appSecret, serverUrl);
}
成功响应示例:
{
"code": "0",
"msg": "success",
"data": {
"accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...", // 这就是您需要的 Access Token
"expiresIn": 1686096000000, // Token 过期时间戳 (毫秒)
"corpId": 12345 // 关联的企业ID
}
}
提示:
accessToken **2 小时** 的有效期 (`expiresIn`
表示过期时间点)。您需要在它过期前重新获取。建议在服务端缓存 `accessToken`,并在每次使用前检查其是否接近过期,提前刷新。注意accessToken是高度敏感信息,请务必妥善保管,切勿泄露或硬编码在客户端代码中。
在调用具体的业务接口前,您需要知道是**哪个用户**在执行这个操作。这个用户必须是您企业在云银签系统中的成员。您需要获取该用户的 `userId`。
接口: POST
/member/infoByCorpId (查看接口详情)
关键:调用此接口时,需要在 **请求 Header** 中携带 `appId` 和上一步获取的 `accessToken`。(sdk无需此操作)
请求 Header 示例:
appId: YOUR_APP_ID
accessToken: PREVIOUSLY_OBTAINED_ACCESS_TOKEN
请求 Body (JSON, 以手机号查询为例):
{
"mobile": "13800138000" // 需要查询的操作者手机号
}
调用示例:
curl -X POST 'https://your-api-host.com/member/infoByCorpId' \
-H 'Content-Type: application/json' \
-H 'appId: YOUR_APP_ID' \
-H 'accessToken: YOUR_ACCESS_TOKEN' \
-H 'source: pc' \
-d '{
"mobile": "13700137000"
}'
YunYinClient client = new YunYinClient(appId, appSecret, serverUrl);
MemberInfoQueryReq request = new MemberInfoQueryReq();
request.setMobile("13700137000");
MemberInfoQueryResponse response = client.execute(request);
System.out.println(JSON.toJSONString(response));
成功响应示例 (JSON):
{
"code": "0",
"msg": "success",
"data": [ // 可能返回多个,如果查询条件不唯一
{
"userId": 20001, // 这就是您需要的操作者 userId
"userName": "张三",
"mobile": "13800138000",
// ... 其他用户信息字段
}
]
}
说明: `userId` 代表了在您的系统中实际执行操作的用户(例如发起合同的业务员)。该用户需要预先被添加到云银签的企业成员中。
获取到 `accessToken` 和操作者 `userId` 后,您就可以调用具体的业务接口了。**调用业务接口时,必须在请求 Header 中统一携带以下四个基本参数:**
appId: 您的应用 ID。accessToken: 您获取到的有效令牌。userId: 当前操作者的用户 ID。source: 标识请求来源客户端类型。请求 Header 示例:
appId: YOUR_APP_ID
accessToken: PREVIOUSLY_OBTAINED_ACCESS_TOKEN
userId: 20001
source: pc
`source` 参数说明:
pc:app:h5:wx:alipay:我们以查询企业印章信息列表分页为例:
接口: POST
/seal/getSealListByPage (查看接口详情)
请求 Body (JSON, 仅包含业务参数):
curl -X POST 'https://your-api-host.com/seal/getSealListByPage' \
-H 'Content-Type: application/json' \
-H 'appId: YOUR_APP_ID' \
-H 'accessToken: YOUR_ACCESS_TOKEN' \
-H 'userId: OPERATOR_USER_ID' \
-d '{
"listPageNo": 1,
"listPageSize": 5,
"sealStatus": 1
}'
调用示例:
curl -X POST 'https://your-api-host.com/seal/getSealListByPage' \
-H 'Content-Type: application/json' \
-H 'appId: YOUR_APP_ID' \
-H 'accessToken: YOUR_ACCESS_TOKEN' \
-H 'userId: OPERATOR_USER_ID' \
-d '{
"listPageNo": 1,
"listPageSize": 5,
"sealStatus": 1
}'
YunYinClient client = new YunYinClient(appId, appSecret, serverUrl); GetSealListReq getSealListReq = new GetSealListReq(); getSealListReq.setHeaderUserId(000000000L); getSealListReq.setListPageNo(1); getSealListReq.setListPageNo(5); getSealListReq.setSealStatus(1); GetSealListResponse getSealListResponse = client.execute(getSealListReq); System.out.println(JSON.toJSONString(getSealListResponse.getData()));
成功响应示例 (JSON):
{
"code": "200",
"msg": "成功",
"listPageNo": 1,
"countInPage": 2,
"listPageCount": 1,
"totalCount": 2,
"data": [ // 获取印章信息列表
{
"sealId": 50001,
"corpName": "示例有限公司",
"sealCode": "SEAL001",
"sealName": "市场部合同专用章",
"categoryType": "CONTRACT",
"sealStyle": 1,
"sealWidth": 159,
"sealHeight": 159,
"sealImageUrl": "https://your-resource-host.com/seal/50001.png",
"defaultFlag": 0,
"status": 1,
"sealHorizontalText": "市场部",
"sealBottomText": null,
"source": "API",
"authorNum": 3, // 授权数量
"createTime": "2024-01-20T10:00:00.000+0800"
},
{
"sealId": 50002,
"corpName": "示例有限公司",
"sealCode": "SEAL002",
"sealName": "手签章-张三",
"categoryType": "OTHER",
"sealStyle": 3,
"sealWidth": 200,
"sealHeight": 200,
"sealImageUrl": "https://your-resource-host.com/seal/50002.png",
"defaultFlag": 1,
"status": 1,
"sealHorizontalText": null,
"sealBottomText": null,
"source": "API",
"authorNum": 1,
"createTime": "2024-01-21T11:00:00.000+0800"
}
]
}
恭喜!您已成功完成第一个 API 调用。现在您可以根据业务需求,浏览下方的 API 目录,查找并调用其他接口了。
按功能划分的API文档分类