文档
测试

创建分享

POST
http://foxconn.gateway.api.liyueyun.com/api/docshare/create

接口描述

创建一次分享

请求头

参数名
类型
描述
必填
Authorization
string
示例:Bearer a4ej3APoltdSZYiE
必填

Body

参数名
类型
描述
必填
uids
array
被分享者的工号
必填
title
string
本次分享的标题
可选
expiredAt
timestamp
过期时间(毫秒时间戳,例如: 1598256895315),默认为一天后
可选

Response

``` { "uids": [ "1400001" ], "title": "来自xxx的分享", "id": "UYWK242U5MR4KPWE", "createdAt": 1598257557975, "expiredAt": 1598256895315, "url": "http://docreader.liyueyun.com/#/share?id=UYWK242U5MR4KPWE" } ``` > 在浏览器中直接打开 url, 如 window.open(url)

说明 / 示例

#### 错误列表 |httpCode|error|message| |-|-|-| |401|AccessTokenNoExist|必须有 accessToken| |401|AccessTokenIsInvalid|无效的 accessToken| |401|AccessTokenHasExpired|accessToken 已过期| |403|SecretIsInvalid|无效的 secret| |403|SecretHasDisabled|secret 已被禁用| |403|SecretError|secret 状态异常| |403|LimitExceeded|已超出用量限制| |400|ParamterError|参数错误(如缺少uids等)| #### 示例代码 ##### C#访问示例代码: ~~~CSharp var client = new RestClient("http://foxconn.gateway.api.liyueyun.com/api/docshare/create"); client.Timeout = -1; var request = new RestRequest(Method.POST); request.AddHeader("Authorization", "Bearer fnP9x4WzVQ2xLyb3"); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"uids\": [\"1400001\"],\n \"title\": \"来自xxx的分享\",\n \"expiredAt\": 1598256895315\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); Console.WriteLine(response.Content); ~~~ # ##### Java访问示例代码: ~~~ java OkHttpClient client = new OkHttpClient().newBuilder() .build(); MediaType mediaType = MediaType.parse("application/json"); RequestBody body = RequestBody.create(mediaType, "{\n \"uids\": [\"1400001\"],\n \"title\": \"来自xxx的分享\",\n \"expiredAt\": 1598256895315\n}"); Request request = new Request.Builder() .url("http://foxconn.gateway.api.liyueyun.com/api/docshare/create") .method("POST", body) .addHeader("Authorization", "Bearer fnP9x4WzVQ2xLyb3") .addHeader("Content-Type", "application/json") .build(); Response response = client.newCall(request).execute(); ~~~ # #### Nodejs访问示例代码 ~~~javascript var axios = require('axios'); var data = JSON.stringify({"uids":["1400001"],"title":"来自xxx的分享","expiredAt":1598256895315}); var config = { method: 'post', url: 'http://foxconn.gateway.api.liyueyun.com/api/docshare/create', headers: { 'Authorization': 'Bearer fnP9x4WzVQ2xLyb3', 'Content-Type': 'application/json' }, data : data }; axios(config) .then(function (response) { console.log(JSON.stringify(response.data)); }) .catch(function (error) { console.log(error); }); ~~~