马赛克移除应用程序接口
$curl -i -k -X POST 'https://api.mosaicremoval.com/sjccup' \
-H 'Authorization:APPCODE YourAppCode' (授权:APPCODE YourAppCode
–data ‘{“media_id”:”Base64 encoded value of the image, 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}’ \
-H'Content-Type:application/json;charset=UTF-8'(内容类型:应用/json; charset=UTF-8

应用程序接口简介
使用MosaicRemoval.com API,马赛克移除方面的人工智能技术变得前所未有的简单。只需几行代码,您就可以将这项技术引入到您的应用程序中。
开始
步骤 1: 购买 API 专用软件包,查看 定价.
步骤 2: 电子邮件 [email protected] 以获取专用的 AppCode。
步骤 3: 使用以下代码示例可快速入门。
步骤 4: 回到参数参考,调整请求。
认证
我们使用特殊的 API 密钥(或应用程序代码)对用户进行身份验证。在这里可以轻松获取。API 密钥独一无二,与其他密钥截然不同。出于安全考虑,请不要公布您的应用程序代码。
public static void 主要(字符串[] args) {
字符串 东道主 = "https://api.mosaicremoval.com";
字符串 路 = "/sjccup";
字符串 方法 = "发布";
字符串 应用代码 = "您的应用程序代码";
地图<字符串, 字符串> 页眉 = 新 HashMap<字符串, 字符串>();
// 头中的最终格式(中间有空格)是 Authorization:APPCODE 83359fd73fe94948385f570e3c139105
headers.put("授权", "APPCODE + appcode);
// 根据应用程序接口要求定义相应的内容类型
headers.put("内容类型", "application/json; charset=UTF-8");
地图<字符串, 字符串> 问题 = 新 HashMap<字符串, 字符串>();
字符串 身体 = "{\"media_id\": "Base64编码的图像值,最长边不超过4000px;移除前缀data:image/png;base64\",\"keep_distortion\":布尔类型,false--自动纠正变形,true--禁用纠正",\"keep_ori\":布尔类型,false--图像将旋转到正确的方向,true--上传时保留方向}";
尝试 {
HttpResponse 回应 = HttpUtils.doPost(主机、路径、方法、标头、查询、正文);
系统.out.println(response.toString());
// 获取响应正文
// System.out.println(EntityUtils.toString(response.getEntity());
} 捕捉 (例外情况 e) {
e.打印堆栈跟踪();
}
}
<?php
$host = "https://api.mosaicremoval.com";
$path = "/sjccup";
$method = "POST";
$appcode = "YourAppCode";
$headers = array();
array_push($headers, "Authorization:APPCODE " . $appcode);
// Define the corresponding Content-Type according to API requirements
array_push($headers, "Content-Type" . ":" . "application/json; charset=UTF-8");
$querys = "";
$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}";
$url = $host . $path;
$curl = curl_init();
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_FAILONERROR, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HEADER, true);
if (1 == strpos("$".$host, "https://")) {
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
}
curl_setopt($curl, CURLOPT_POSTFIELDS, $bodys);
var_dump(curl_exec($curl));
?>
舶来品 urllib, urllib2, sys
舶来品 ssl
东道主 = 'https://api.mosaicremoval.com'
路 = '/sjccup
方法 = POST
应用代码 = 您的应用程序代码
问题 = ''
身体 = {}
网址 = 主机 + 路径
bodys[''] = "{\"media_id\": "Base64编码的图像值,最长边不超过4000px;移除前缀data:image/png;base64\",\"keep_distortion\":布尔类型,false--自动纠正变形,true--禁用纠正",\"keep_ori\":布尔类型,false--图像将旋转到正确的方向,true--上传时保留方向}"
post_data = 身体['']
要求 = urllib2.要求(url, post_data)
请求。add_header(授权, APPCODE + appcode)
# 根据 API 要求定义相应的内容类型
要求。add_header(内容类型, 应用程序/json; charset=UTF-8)
ctx = ssl。创建默认上下文()
ctx.check_hostname = 假的
ctx.verify_mode = ssl.CERT_NONE
回应 = urllib2.打开(请求,上下文=ctx)
内容 = 响应。阅读()
如果 (内容):
打印(内容)
NSString *应用代码 = @"YourAppCode";
NSString *东道主 = @"https://api.mosaicremoval.com";
NSString *路 = @"/sjccup";
NSString *方法 = @"POST";
NSString *问题 = @"";
NSString *网址 = [NSString stringWithFormat:@"%@%@%@",主机,路径,查询];
NSString *身体 = @"{\"media_id\":\"Base64 编码图像值,最长边不超过 4000px;移除前缀 data:image/png;base64\",\"keep_distortion\":布尔类型,false - 自动纠正变形,true - 禁用纠正",\"keep_ori\":布尔类型,false - 将图像旋转到正确方向,true - 上传时保留方向}";
NSMutableURLRequest *要求 = [NSMutableURLRequest requestWithURL:[NSURL URLWithString: url]
缓存策略1
timeoutInterval:5];
request.HTTPMethod = method;
[请求 addValue:[NSString stringWithFormat:@"appcode %@",appcode]
forHTTPHeaderField:@"Authorization"];
// 根据应用程序接口要求定义相应的内容类型
[请求 addValue:@"application/json; charset=UTF-8"
forHTTPHeaderField:@"Content-Type"];
NSData *数据 = [身体 dataUsingEncoding:NSUTF8StringEncoding];
[请求 setHTTPBody:数据];
NSURLSession *请求会话 = [NSURLSession 会话配置:[NSURLSessionConfiguration 默认会话配置]];
NSURLSessionDataTask *工作 = [请求会话 dataTaskWithRequest:要求
completionHandler:^(NSData * 可空 身体、 NSURLResponse *可空 回应、 NSError * _Nullable 错误) {
NSLog(@"响应对象:%@"答复);
NSString *bodyString = [[NSString 分配] initWithData:机构 编码:NSUTF8StringEncoding];
// 打印响应正文
NSLog(@"响应正文:%@", bodyString);
}];
任务 简历];
错误代码 | 错误信息 | 说明 |
---|---|---|
0 | 成功 | 成功 |
1000 | 身体错误 | 请求正文错误 |
1001 | 参数错误 | 请求参数错误 |
1002 | 内容类型错误 | 内容类型错误 |
1003 | 图像不存在 | 未找到图像文件 |
1004 | 图像大小错误 | 图像尺寸错误 |
1005 | 图像格式错误 | 图像格式错误 |
1006 | 无效签名 | 无效签名 |
1007 | 体型误差 | 体型误差 |
1008 | 无授权 | 授权失败 |
2000 | 服务器未知错误 | 服务器未知错误 |
2001 | 服务器超时 | 服务器超时 |
2003 | 无内容识别 | 未识别内容 |
2004 | 验证数据错误 | 验证数据错误 |
3000 | 远程服务器错误 | 远程服务器错误 |
4000 | 基础服务器错误 | 基础服务器错误 |
100% 退款保证!
放心购买。如果您发现该工具不能满足您的需求,我们将提供 7 天无条件退款保证。您可以放心付款。我们有 退款政策 以确保您的付款安全。