## 1. 文件上传 1. Method:POST 2. HOST: http://file.domain.com 3. URI:file/upload_one | 字段 | 说明 | 类型 | | ----- | ---- | ---- | | image | 文件 | file | 3. Response:JSON | 字段 | 类型 | 说明 | | -------| ------ | -------- | | code | Number | 错误代码 | | msg | String | 错误信息 | | img | String | 图片远程地址 | | qr | String | 二维码地址 | 4. errcode 定义 | 字段 | 说明 | | ---- | -------------- | | 0 | 无错误 | | 11 | 服务端错误 | | 100 | 一般性错误 | | 50x | 服务错误 | | 30x | 无权限访问该接口 | 5. 示例代码 ```bash curl --location --request POST 'http://file.domain.com/file/upload_one' \ --form 'image=@/data/Pictures/5c14a679db141e0c4ebc5379.png' ``` ```java // use OKHttp OkHttpClient client = new OkHttpClient().newBuilder() .build(); MediaType mediaType = MediaType.parse("text/plain"); RequestBody body = new MultipartBody.Builder().setType(MultipartBody.FORM) .addFormDataPart("image","5c14a679db141e0c4ebc5379.png", RequestBody.create(MediaType.parse("application/octet-stream"), new File("/data/images/5c14a679db141e0c4ebc5379.png"))) .build(); Request request = new Request.Builder() .url("http://file.domain.com/file/upload_one") .method("POST", body) .build(); Response response = client.newCall(request).execute(); ```