文档
测试

照片识别

POST
http://foxconn.gateway.api.liyueyun.com/api/picjulei/scan

接口描述

创建分组

headers

参数名
类型
描述
必填
Authorization
string
Bearer AccessToken
必填

body参数

multipart/form-data
参数名
类型
描述
必填
file
照片文件
必填
gid
string
分组id
可选
scope
string
查询范围,例如:group,in-service
必填

说明 / 示例

**照片识别使用POST请求** **参数gid未非必填项,但如果scope指定的组合中包含group选项,则gid必填** **scope为必填项,可指定group或/和in-service,分别代表查询使用分组以及查询在职员工,多个选项使用","分隔** **请求头中需附带Bearer Token 。** **调用成功返回数组:** ``` [ { "x": 547.2129106521606,( "y": 491.0869359970093, "width": 56.94325447082515, "height": 70.00076293945312, "users": { "group": [ { "uid": "111", "name": "张三", "score": "0.8594954" } ], "in-service": [ { "uid": "222", "name": "李四", "score": "0.8512676" }, { "uid": "333", "name": "王五", "score": "0.9447399" } ] } }, { "x": 349.2039155960083, "y": 752.5735187530518, "width": 93.92117500305172, "height": 135.37988662719727, "users": { "group": [], "in-service": [ { "uid": "333", "name": "王五", "score": "0.9447399" } ] } }, ] ``` **数组中的对象表示识别出来的人员信息,人员信息包含出现在照片中的位置,人像宽高,以及符合此人脸信息的可能人脸列表,score从高到低排序。** #### 错误列表 |httpCode|error|message| |-|-|-| |403|SecretIsInvalid|无效的 secret |400|INVALID_PARAMETER|无效的参数 |400|INVALID_GID|无效的gid| ### 各平台的代码示例 ##### C#访问示例代码: ```CSharp var client = new RestClient("https://foxconn.gateway.api.liyueyun.com/api/picjulei/scan"); client.Timeout = -1; var request = new RestRequest(Method.POST); request.AddHeader("Authorization", "Bearer AccessToken"); request.AddFile("", "/Users/jedi/Desktop/IMG271.jpeg"); request.AddParameter("gid", "xxx"); request.AddParameter("scope", "group,in-service"); IRestResponse response = client.Execute(request); Console.WriteLine(response.Content); ``` ##### Java访问示例代码: ~~~ java OkHttpClient client = new OkHttpClient().newBuilder() .build(); MediaType mediaType = MediaType.parse("text/plain"); RequestBody body = new MultipartBody.Builder().setType(MultipartBody.FORM) .addFormDataPart("","IMG271.jpeg", RequestBody.create(MediaType.parse("application/octet-stream"), new File("/Users/jedi/Desktop/IMG271.jpeg"))) .addFormDataPart("gid","xxx") .addFormDataPart("scope","group,in-service") .build(); Request request = new Request.Builder() .url("https://foxconn.gateway.api.liyueyun.com/api/picjulei/scan") .method("POST", body) .addHeader("Authorization", "Bearer AccessToken") .build(); Response response = client.newCall(request).execute(); ~~~ #### Nodejs访问示例代码: ~~~javascript var axios = require('axios'); var FormData = require('form-data'); var fs = require('fs'); var data = new FormData(); data.append('', fs.createReadStream('/Users/jedi/Desktop/IMG271.jpeg')); data.append('gid', 'xxx'); data.append('scope', 'group,in-service'); var config = { method: 'post', url: 'https://foxconn.gateway.api.liyueyun.com/api/picjulei/scan', headers: { 'Authorization': 'Bearer AccessToken', ...data.getHeaders() }, data : data }; axios(config) .then(function (response) { console.log(JSON.stringify(response.data)); }) .catch(function (error) { console.log(error); }); ~~~ #