API 介绍
专门用于马赛克内容移除的人工智能技术,通过 MosaicRemoval.com API 变得前所未有的简单。只需几行代码,您就可以将这项技术集成到您的应用程序中。
1
购买套餐
购买专用于 API 的套餐
3
使用代码示例
使用以下代码示例快速开始
4
调整参数
参考参数说明调整请求
身份验证
我们使用特殊的 API 密钥(或 App Code)对用户进行身份验证。您可以在这里轻松获取。API 密钥是唯一的,与其他密钥完全不同。出于安全考虑,请不要公开您的 App Code。
API 端点
POST https://api.mosaicremoval.com/sjccup
请求头
Authorization:
APPCODE YourAppCode
Content-Type:
application/json; charset=UTF-8
代码示例
使用我们的代码示例快速开始
public static void main(String[] args) {
String host = "https://api.mosaicremoval.com";
String path = "/sjccup";
String method = "POST";
String appcode = "YourAppCode";
Map<String, String> headers = new HashMap<String, String>();
// The final format in the header (with a space in between) is Authorization:APPCODE 83359fd73fe94948385f570e3c139105
headers.put("Authorization", "APPCODE " + appcode);
// Define the corresponding Content-Type according to API requirements
headers.put("Content-Type", "application/json; charset=UTF-8");
Map<String, String> querys = new HashMap<String, String>();
String bodys = "{\"media_id\":\"Base64 encoded image value, with the longest side not exceeding 4000px; remove the prefix data:image/png;base64\",\"keep_distortion\":boolean type, false - auto-corrects distortion, true - disables correction\",\"keep_ori\":boolean type, false - the image will be rotated to the correct orientation, true - retains the orientation when uploaded}";
try {
HttpResponse response = HttpUtils.doPost(host, path, method, headers, querys, bodys);
System.out.println(response.toString());
// Get the body of the response
// System.out.println(EntityUtils.toString(response.getEntity()));
} catch (Exception e) {
e.printStackTrace();
}
}请求参数
使用这些参数配置您的 API 请求
| 参数 | 类型 | 描述 |
|---|---|---|
| media_id | string | 图片的 Base64 编码值,最长边不超过 4000px;移除前缀 data:image/png;base64 |
| keep_distortion | boolean | false – 自动纠正失真,true – 禁用纠正 |
| keep_ori | boolean | false – 图片将旋转到正确方向,true – 保持上传时的方向 |
错误代码
API 响应代码参考
| 错误代码 | 错误信息 | 描述 |
|---|---|---|
| 0 | success | Success |
| 1000 | body error | Request body error |
| 1001 | param error | Request parameter error |
| 1002 | content type error | Content-Type error |
| 1003 | image not exists | Image file not found |
| 1004 | image size error | Image size error |
| 1005 | image format error | Image format error |
| 1006 | invalid signature | Invalid signature |
| 1007 | body size error | Body size error |
| 1008 | no authorization | Authorization failed |
| 2000 | server unknown error | Server unknown error |
| 2001 | server timeout | Server timeout |
| 2003 | no content recognition | No content recognized |
| 2004 | validate data error | Validation data error |
| 3000 | remote server error | Remote server error |
| 4000 | base server error | Base server error |
API 定价方案
以下方案专用于 API
基础版
$499$0.10 / 积分
5,000 积分
6个月有效期
无风险:7天退款保证
最受欢迎
热门版
$799$0.08 / 积分
10,000 积分
6个月有效期
无风险:7天退款保证
专属
专属版
$3999$0.04 / 积分
100,000 积分
1年有效期
无风险:7天退款保证