公共参数
前往测试接口:console.open.onebound.cn/console/?i=…
请求地址: api-gw.onebound.cn/taobao/uplo…
| 名称 | 类型 | 必须 | 描述 |
|---|---|---|---|
| key | String | 是 | 调用key(必须以GET方式拼接在URL中) |
| secret | String | 是 | 调用密钥 |
| api_name | String | 是 | API接口名称(包括在请求地址中)[item_search,item_get,item_search_shop等] |
| cache | String | 否 | [yes,no]默认yes,将调用缓存的数据,速度比较快 |
| result_type | String | 否 | [json,jsonu,xml,serialize,var_export]返回数据格式,默认为json,jsonu输出的内容中文可以直接阅读 |
| lang | String | 否 | [cn,en,ru]翻译语言,默认cn简体中文 |
| version | String | 否 | API版本 |
请求参数:imgcode=img14.360buyimg.com/n0/jfs/t1/5…
参数说明:imgcode:base64加密后的图片内容(post方式),或者是直接上传(file方式)
Version: Date:
| 名称 | 类型 | 必须 | 示例值 | 描述 |
|---|---|---|---|---|
| status | Int | 0 | 1 | 状态码 |
| name | String | 0 | TB14_f0bsrrK1Rjy1zeXXXalFXa | 图片名称 |
| url | String | 0 | //g-search3.alicdn.com/img/bao/uploaded/i4/TB14_f0bsrrK1Rjy1zeXXXalFXa | 图片URL |
| error | String | 0 | false | 错误信息 |
| extraInfo | String | 0 | width:430height:430size=26429 | 图片额外信息 |
//using System.Net.Security;
//using System.Security.Cryptography.X509Certificates;
private const String method = "GET";
static void Main(string[] args)
{
String bodys = "";
// 请求示例 url 默认请求参数已经做URL编码
String url = "https://api-gw.onebound.cn/taobao/upload_img/?key=<您自己的apiKey>&secret=<您自己的apiSecret>&imgcode=https://img14.360buyimg.com/n0/jfs/t1/52280/38/7464/140698/5d511f6bE08290bd7/f0bb32ddb47451e8.jpg";
HttpWebRequest httpRequest = null;
HttpWebResponse httpResponse = null;
if (url.Contains("https://"))
{
ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(CheckValidationResult);
httpRequest = (HttpWebRequest)WebRequest.CreateDefault(new Uri(url));
}
else
{
httpRequest = (HttpWebRequest)WebRequest.Create(url);
}
httpRequest.Method = method;
if (0 < bodys.Length)
{
byte[] data = Encoding.UTF8.GetBytes(bodys);
using (Stream stream = httpRequest.GetRequestStream())
{
stream.Write(data, 0, data.Length);
}
}
try
{
httpResponse = (HttpWebResponse)httpRequest.GetResponse();
}
catch (WebException ex)
{
httpResponse = (HttpWebResponse)ex.Response;
}
Console.WriteLine(httpResponse.StatusCode);
Console.WriteLine(httpResponse.Method);
Console.WriteLine(httpResponse.Headers);
Stream st = httpResponse.GetResponseStream();
StreamReader reader = new StreamReader(st, Encoding.GetEncoding("utf-8"));
Console.WriteLine(reader.ReadToEnd());
Console.WriteLine("\n");
}
public static bool CheckValidationResult(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors)
{
return true;
}