图片在线检测

接口地址

https://as.dun.163yun.com/v3/image/check

接口描述

该接口同步返回内容安全服务实时反垃圾引擎检测结果,产品根据图片分类结果,做图片初步过滤。由于网络环境及图片本身大小的影响(建议产品对图片进行压缩后,再过反垃圾检测),部分图片可能出现下载超时情况,该部分数据会返回检测失败,请重新检测。机器离线检测后,可能会有部分不确定的数据需要人工进一步确认。离线检测结果及人工确认结果需产品自行定期调用图片离线检测结果获取

图片限制

◆ 目前支持的图片文件格式有:jpg, png, bmp, gif, webp, tiff;

◆ 支持图片大小:单张<10M;

◆ 图片尺寸大小:不小于 50px*50px;

◆ gif图长图说明:易盾自动将gif图长图截帧过检,最多5张,gif图长图均按照实际截图张数进行计费;

◆ 长图定义:长宽比大于5的图片

请求参数

公共参数已省略,详细见 请求公共参数

参数名称类型是否必选最大长度描述
imagesString(json数组)Y32张或10MBimages为json数组,支持批量检测
accountStringN128用户唯一标识,如果无需登录则为空
ipStringN32用户 IP 地址
versionStringY4接口版本v3.2

images参数结构说明

字段名称类型是否必选最大长度描述
nameStringY1024图片名称(或图片标识), 该字段为回调信号字段,产品可以根据业务情况自行设计,如json结构、或者为图片url均可
typeNumberY4类型,分别为1:图片URL,2:图片BASE64值
dataStringY32张或者10MB图片内容,如type=1,则该值为图片URL,如type=2,则该值为图片BASE64值。图片URL检测单次请求最多支持32张,图片BASE64值检测单次请求大小限制为最多10MB
callbackUrlStringN256离线结果回调通知到客户的URL。主动回调数据接口超时时间设置为2s,为了保证顺利接收数据,需保证接收接口性能稳定并且保证幂等性。

响应结果

响应字段如下,响应通用字段已省略,详细见 响应通用字段

result 数组数据结构

参数名称类型描述
nameString图片名称(或图片标识)
taskIdString本次请求数据标识,可以根据该标识查询数据最新结果
statusNumber图片检测状态码,定义为:0:检测成功,610:图片下载失败,620:图片格式错误,630:其它
labelsjson数组分类信息
detailsjson对象其他信息

labels 数据结构

参数名称类型描述
labelNumber分类信息,100:色情,110:性感,200:广告,210:二维码,300:暴恐,400:违禁,500:涉政
levelNumber分类级别,0:正常,1:不确定,2:确定
rateNumber分数

details 内容

参数名称类型描述
ocrTextStringOCR文本信息返回,此功能需开启OCR服务,如需开启请联系专属商务
flagNamesString旗帜名称
qrcodeContentString二维码内容
faceNamesString人脸名称

请求示例

    /** 产品密钥ID,产品标识 */
    private final static String SECRETID = "your_secret_id";
    /** 产品私有密钥,服务端生成签名信息使用,请严格保管,避免泄露 */
    private final static String SECRETKEY = "your_secret_key";
    /** 业务ID,易盾根据产品业务特点分配 */
    private final static String BUSINESSID = "your_business_id";
    /** 易盾内容安全服务图片在线检测接口地址 */
    private final static String API_URL = "https://as.dun.163yun.com/v3/image/check";
    /** 实例化HttpClient,发送http请求使用,可根据需要自行调参 */
    private static HttpClient httpClient = HttpClient4Utils.createHttpClient(100, 20, 10000, 2000, 2000);

    /**
     *
     * @param args
     * @throws Exception
     */
    public static void main(String[] args) throws Exception {
        Map<String, String> params = new HashMap<String, String>();
        // 1.设置公共参数
        params.put("secretId", SECRETID);
        params.put("businessId", BUSINESSID);
        params.put("version", "v3.2");
        params.put("timestamp", String.valueOf(System.currentTimeMillis()));
        params.put("nonce", String.valueOf(new Random().nextInt()));

        // 2.设置私有参数
        JsonArray jsonArray = new JsonArray();
        // 传图片url进行检测,name结构产品自行设计,用于唯一定位该图片数据
        JsonObject image1 = new JsonObject();
        image1.addProperty("name", "http://p1.music.126.net/lEQvXzoC17AFKa6yrf-ldA==/1412872446212751.jpg");
        image1.addProperty("type", 1);
        image1.addProperty("data", "http://p1.music.126.net/lEQvXzoC17AFKa6yrf-ldA==/1412872446212751.jpg");
        jsonArray.add(image1);

        // 传图片base64编码进行检测,name结构产品自行设计,用于唯一定位该图片数据
        JsonObject image2 = new JsonObject();
        image2.addProperty("name", "{\"imageId\": 33451123, \"contentId\": 78978}");
        image2.addProperty("type", 2);
        image2.addProperty("data","iVBORw0KGgoAAAANSUhEUgAAASwAAAEsCAIAAAD2HxkiAAAYNElEQVR4nO2dP3vivNKHnfc6FWmhZVvTAk9J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N92VxeXna73az2+Dh5feYSFyhSxBrJE5Kw1dlla0mS67+I/w0zK8XY8qxQv2ytnuVgyV7nltQvAxwOh0Xa5UL9srV4ZalV1us1bYYeLFsDoPXU6oR0SlOUjxXNASiFtIXVqgvb10xRGLeENcn2FIVtaO0GhZWp1Qlp04s6GUGXryCkLaxWXdh+yD36TwlTJc1awppE2ElgY5KgGsoJElNTKQRIRwFwDJwQAMdgTGiyurB9jAk9o0m+0BKMCT0PY0KMCTEmzAPpKACOQTpqsrqwfaSjntH8QmhJY9NR7bK17XZbW16h4XA4SIqF3Ho6JZvNRtnCfr83YkmYeCHj7O8bUnIh274+eet0Or7vl+pUFnYtYb/fjz+lWC1IKC309E54fX2tN+LroPzI7inBXr6+7+vvWaPRiP6m6mKxoFcC1hBjMCYEwDFwwk/YHhM2hxaNCa0O1ZowJoQTfsL2FEVzaNEUhdWZA0xRAADghJ9BOioUsiAdlQMn/ATSUaGQBemoHDghAI6BEwLgGDjhJzAmFApZMCaUAyf8BMaEQiELxoRyzk7yCgOgRSASAuAYOCEAjoETAuAYOCEAjoETAuAYOCEAjoETAuAYOCEAjoETAuCY/wc8SC3r28PmnQAAAABJRU5ErkJggg==");

        jsonArray.add(image2);

        params.put("images", jsonArray.toString());
       // params.put("account", "java@163.com");
       // params.put("ip", "123.115.77.137");

        // 3.生成签名信息
        String signature = SignatureUtils.genSignature(SECRETKEY, params);
        params.put("signature", signature);

        // 4.发送HTTP请求,这里使用的是HttpClient工具包,产品可自行选择自己熟悉的工具包发送请求
        String response = HttpClient4Utils.sendPost(httpClient, API_URL, params, Consts.UTF_8);

        // 5.解析接口返回值
        JsonObject resultObject = new JsonParser().parse

(response).getAsJsonObject();
        int code = resultObject.get("code").getAsInt();
        String msg = resultObject.get("msg").getAsString();
        if (code == 200) {
            JsonArray resultArray = resultObject.getAsJsonArray("result");
            for (JsonElement jsonElement : resultArray) {
                JsonObject jObject = jsonElement.getAsJsonObject();
                String name = jObject.get("name").getAsString();
                String taskId = jObject.get("taskId").getAsString();
                JsonArray labelArray = jObject.get("labels").getAsJsonArray();
                System.out.println(String.format("taskId=%s,name=%s,labels:", taskId, name));
                int maxLevel = -1;
                // 产品需根据自身需求,自行解析处理,本示例只是简单判断分类级别
                for (JsonElement labelElement : labelArray) {
                    JsonObject lObject = labelElement.getAsJsonObject();
                    int label = lObject.get("label").getAsInt();
                    int level = lObject.get("level").getAsInt();
                    double rate = lObject.get("rate").getAsDouble();
                    System.out.println(String.format("label:%s, level=%s, rate=%s", label, level, rate));
                    maxLevel = level > maxLevel ? level : maxLevel;
                }
                switch (maxLevel) {
                    case 0:
                        System.out.println("#图片检测机器检测结果:最高等级为\"正常\"\n");
                        break;
                    case 1:
                        System.out.println("#图片检测机器检测结果:最高等级为\"嫌疑\"\n");
                        break;
                    case 2:
                        System.out.println("#图片检测机器检测结果:最高等级为\"确定\"\n");
                        break;
                    default:
                        break;
                }
            }
        } else {
            System.out.println(String.format("ERROR: code=%s, msg=%s", 

code, msg));
        }

    }

#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""内容安全图片检测在线检测接口python示例代码
接口文档: http://dun.163.com/api.html
python版本:python2.7
运行:
    1. 修改 SECRET_ID,SECRET_KEY,BUSINESS_ID 为对应申请到的值
    2. $ python image_check_api_demo.py
"""
__author__ = 'yidun-dev'
__date__ = '2016/3/10'
__version__ = '0.1-dev'

import hashlib
import time
import random
import urllib
import urllib2
import json

class ImageCheckAPIDemo(object):
    """图片在线检测接口示例代码"""
    API_URL = "https://as.dun.163yun.com/v3/image/check"
    VERSION = "v3.2"

    def __init__(self, secret_id, secret_key, business_id):
        """
        Args:
            secret_id (str) 产品密钥ID,产品标识
            secret_key (str) 产品私有密钥,服务端生成签名信息使用
            business_id (str) 业务ID,易盾根据产品业务特点分配
        """
        self.secret_id = secret_id
        self.secret_key = secret_key
        self.business_id = business_id

    def gen_signature(self, params=None):
        """生成签名信息
        Args:
            params (object) 请求参数
        Returns:
            参数签名md5值
        """
        buff = ""
        for k in sorted(params.keys()):
            buff += str(k)+ str(params[k])
        buff += self.secret_key
        return hashlib.md5(buff).hexdigest()

    def check(self, params):
        """请求易盾接口
        Args:
            params (object) 请求参数
        Returns:
            请求结果,json格式
        """
        params["secretId"] = self.secret_id
        params["businessId"] = self.business_id
        params["version"] = self.VERSION
        params["timestamp"] = int(time.time() * 1000)
        params["nonce"] = int(random.random()*100000000)
        params["signature"] = self.gen_signature(params)

        # print json.dumps(params)
        try:
            params = urllib.urlencode(params)
            request = urllib2.Request(self.API_URL, params)
            content = urllib2.urlopen(request, timeout=10).read()
            # print content
            # content = "{\"code\":200,\"msg\":\"ok\",\"timestamp\":1453793733515,\"nonce\":1524585,\"signature\":\"630afd9e389e68418bb10bc6d6522330\",\"result\":[{\"image\":\"http://img1.cache.netease.com/xxx1.jpg\",\"labels\":[]},{\"image\":\"http://img1.cache.netease.com/xxx2.jpg\",\"labels\":[{\"label\":100,\"level\":2,\"rate\":0.99},{\"label\":200,\"level\":1,\"rate\":0.5}]},{\"image\":\"http://img1.cache.netease.com/xxx3.jpg\",\"labels\":[{\"label\":200,\"level\":1,\"rate\":0.5}]}]}";
            return json.loads(content)
        except Exception, ex:
            print "调用API接口失败:", str(ex)

if __name__ == "__main__":
    """示例代码入口"""
    SECRET_ID = "your_secret_id" # 产品密钥ID,产品标识
    SECRET_KEY = "your_secret_key" # 产品私有密钥,服务端生成签名信息使用,请严格保管,避免泄露
    BUSINESS_ID = "your_business_id" # 业务ID,云安全根据产品业务特点分配
    image_check_api = ImageCheckAPIDemo(SECRET_ID, SECRET_KEY, BUSINESS_ID)

    images = []
    imageurl = {
        "name":"http://p1.music.126.net/lEQvXzoC17AFKa6yrf-ldA==/1412872446212751.jpg",
        "type":1,
        "data":"http://p1.music.126.net/lEQvXzoC17AFKa6yrf-ldA==/1412872446212751.jpg"
    }
    imagebase64 = {
        "name":"{\"imageId\": 33451123, \"contentId\": 78978}",
        "type":2,
        "data":"iVBORw0KGgoAAAANSUhEUgAAASwAAAEsCAI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VakVvH0Yb6Xlet9ul9xeT20mQyq6zv2Z8Pot+d3pZXMTj4yN92VxeXna73az2+Dh5feYSFyhSxBrJE5Kw1dlla0mS67+I/w0zK8XY8qxQv2ytnuVgyV7nltQvAxwOh0Xa5UL9srV4ZalV1us1bYYeLFsDoPXU6oR0SlOUjxXNASiFtIXVqgvb10xRGLeENcn2FIVtaO0GhZWp1Qlp04s6GUGXryCkLaxWXdh+yD36TwlTJc1awppE2ElgY5KgGsoJElNTKQRIRwFwDJwQAMdgTGiyurB9jAk9o0m+0BKMCT0PY0KMCTEmzAPpKACOQTpqsrqwfaSjntH8QmhJY9NR7bK17XZbW16h4XA4SIqF3Ho6JZvNRtnCfr83YkmYeCHj7O8bUnIh274+eet0Or7vl+pUFnYtYb/fjz+lWC1IKC309E54fX2tN+LroPzI7inBXr6+7+vvWaPRiP6m6mKxoFcC1hBjMCYEwDFwwk/YHhM2hxaNCa0O1ZowJoQTfsL2FEVzaNEUhdWZA0xRAADghJ9BOioUsiAdlQMn/ATSUaGQBemoHDghAI6BEwLgGDjhJzAmFApZMCaUAyf8BMaEQiELxoRyzk7yCgOgRSASAuAYOCEAjoETAuAYOCEAjoETAuAYOCEAjoETAuAYOCEAjoETAuCY/wc8SC3r28PmnQAAAABJRU5ErkJggg=="
    }
    images.append(imageurl)
    images.append(imagebase64)
    # print json.dumps(images)
    params = {
        "images": json.dumps(images)
        # "account": "python@163.com",
        # "ip": "123.115.77.137"
    }
    ret = image_check_api.check(params)
    if ret["code"] == 200:
        results = ret["result"]
        for result in results:
            print "taskId=%s,name=%s,labels:" %(result["taskId"],result["name"])
            maxLevel = -1
            for labelObj in result["labels"]:
                label = labelObj["label"]
                level = labelObj["level"]
                rate  = labelObj["rate"]
                print "label:%s, level=%s, rate=%s" %(label, level, rate)
                maxLevel =level if level > maxLevel else maxLevel
            if maxLevel==0:
                print "#图片机器检测结果:最高等级为\"正常\"\n"
            elif maxLevel==1:
                print "#图片机器检测结果:最高等级为\"嫌疑\"\n"
            elif maxLevel==2:
                print "#图片机器检测结果:最高等级为\"确定\"\n"

    else:
        print "ERROR: ret.code=%s, ret.msg=%s" % (ret["code"], ret["msg"])
<?php
/** 产品密钥ID,产品标识 */
define("SECRETID", "your_secret_id");
/** 产品私有密钥,服务端生成签名信息使用,请严格保管,避免泄露 */
define("SECRETKEY", "your_secret_key");
/** 业务ID,易盾根据产品业务特点分配 */
define("BUSINESSID", "your_business_id");
/** 易盾内容安全服务图片在线检测接口地址 */
define("API_URL", "https://as.dun.163yun.com/v3/image/check");
/** api version */
define("VERSION", "v3.2");
/** API timeout*/
define("API_TIMEOUT", 10);
/** php内部使用的字符串编码 */
define("INTERNAL_STRING_CHARSET", "auto");

/**
 * 计算参数签名
 * $params 请求参数
 * $secretKey secretKey
 */
function gen_signature($secretKey, $params){
    ksort($params);
    $buff="";
    foreach($params as $key=>$value){
        if($value !== null) {
           $buff .=$key;
           $buff .=$value;
        }
    }
    $buff .= $secretKey;
    return md5($buff);
}

/**
 * 将输入数据的编码统一转换成utf8
 * @params 输入的参数
 */
function toUtf8($params){
    $utf8s = array();
    foreach ($params as $key => $value) {
        $utf8s[$key] = is_string($value) ? mb_convert_encoding($value, "utf8", INTERNAL_STRING_CHARSET) : $value;
    }
    return $utf8s;
}

/**
 * 易盾请求接口简单封装
 * $params 请求参数
 */
function check($params){
    $params["secretId"] = SECRETID;
    $params["businessId"] = BUSINESSID;
    $params["version"] = VERSION;
    $params["timestamp"] = sprintf("%d", round(microtime(true)*1000));// time in milliseconds
    $params["nonce"] = sprintf("%d", rand()); // random int

    $params = toUtf8($params);
    $params["signature"] = gen_signature(SECRETKEY, $params);
    // var_dump($params);

    $options = array(
        "http" => array(
            "header"  => "Content-type: application/x-www-form-urlencoded\r\n",
            "method"  => "POST",
            "timeout" => API_TIMEOUT, // read timeout in seconds
            "content" => http_build_query($params),
        ),
    );
    $context  = stream_context_create($options);
    $result = file_get_contents(API_URL, false, $context);
    // var_dump($result);
    if($result === FALSE){
        return array("code"=>500, "msg"=>"file_get_contents failed.");
    }else{
        return json_decode($result, true);
    }
}

// 简单测试
function main(){
    echo "mb_internal_encoding=".mb_internal_encoding()."\n";
    $images = array();
    array_push($images, array(// type=1表示传图片url检查
        "name" => "http://p1.music.126.net/lEQvXzoC17AFKa6yrf-ldA==/1412872446212751.jpg",
        "type" => 1,
        "data" => "http://p1.music.126.net/lEQvXzoC17AFKa6yrf-ldA==/1412872446212751.jpg",
    ));
    array_push($images, array( // type=2表示传图片base64编码进行检查
        "name" => "{\"imageId\": 33451123, \"contentId\": 78978}",
        "type" => 2,
        "data" => "iVBORw0KGgoAAAANSUhEUgAAASwAAAEsCAIAAAD2HxkiAAAYNElEQVR4nO2dP3vivNKHnfc6FWmhZVvTAk9JvkPSLikfsvUpSZ18hpAtl7TJdyBlYFvThpa0UK7fwtf6OP4zM/ZIlk1+d5HLOytpRsbjGVmyfBaGoQcAcMf/uTYAgK8OnBAAx8AJAXAMnBAAx8AJAXAMnBAAx8AJAXAMnBAAx8AJAXBNSOLauvpYLBb0qWBZr9c12Pnw8FCDnUoVEhaLRQ2nqyHQpwKREADHwAkBcAycUErYkuS8LXaCGDghAI6BE0o5OztzbYKIttgJYuCEUtqS5rXFThADJwTAMXBCABwDJwTAMXBCKW154NEWO0HMf5T1f/365fu+EVOscn19vd1urarwff/t7U3ZCGvn/f39z58/NSoOh4OmesR0OqXtnM/nV1dXGhW+7//69UvTQj1st9vr62tNC1on9H1/NBpFd98wDM/OzpJ/ozL653VRgxrh+fk5qyW2PLdNNsKcn5+Px2NWC02n06EL7Ha73W6n1KInCILfv38TBT4+PpQqOp2O/nzWgD710Dqhl7juUx4YX81Jb0y6aylhblflQmFHNG1KHBWALBgTAuAYA5EwFbXodDQ+LiXUp6PyjlRORxEGQTWQjqYrIh0FNYNImO4IIiGoGUTCdEVEQlAziITpjiASgppBJExXRCQENYMpCgAcYyAS0jw9Pb2+vtrW0oStu3a73f39vb4RusD3798nk4lShd7O29vb/X5PFFAaKeTm5sa2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m5sbpZ13d3e73Y5ood/vR414VZe8HI9HiZ10m7e3t/v9nlD0/v5Oa+l2u1FHihTtdjvturaQhK2OLQ/NbnkoUUQL2S8KS9Bvzaj/Uq/+C7gS2OtzNpvZthPpKACOgRMC4JhTc0LnUxSS9jVTFOHf0QgxnaBHaCdBWGk6IVdoVZEcpZ0Ep+aEuSel2i+aEgqnKCTt51ZP/cZFJSMziqobuSbkdhJUm06wOsegnHhQ2klwak4IQOs4NSdEOiq0xIidBEhH5ZyaEyIdFVpixE4CpKNyTs0JAWgdcEIAHGN92dpkMomPw7yVStn/ZUsS2BsTBkHw+vpK1H1/fxe2nzuKI7Kd5N/VakVvH0Yb6Xlet9ul9xeT20mQyq6zv2Z8Pot+d3pZXMTj4yN92VxeXna73az2+Dh5feYSFyhSxBrJE5Kw1dlla0mS67+I/w0zK8XY8qxQv2ytnuVgyV7nltQvAxwOh0Xa5UL9srV4ZalV1us1bYYeLFsDoPXU6oR0SlOUjxXNASiFtIXVqgvb10xRGLeENcn2FIVtaO0GhZWp1Qlp04s6GUGXryCkLaxWXdh+yD36TwlTJc1awppE2ElgY5KgGsoJElNTKQRIRwFwDJwQAMdgTGiyurB9jAk9o0m+0BKMCT0PY0KMCTEmzAPpKACOQTpqsrqwfaSjntH8QmhJY9NR7bK17XZbW16h4XA4SIqF3Ho6JZvNRtnCfr83YkmYeCHj7O8bUnIh274+eet0Or7vl+pUFnYtYb/fjz+lWC1IKC309E54fX2tN+LroPzI7inBXr6+7+vvWaPRiP6m6mKxoFcC1hBjMCYEwDFwwk/YHhM2hxaNCa0O1ZowJoQTfsL2FEVzaNEUhdWZA0xRAADghJ9BOioUsiAdlQMn/ATSUaGQBemoHDghAI6BEwLgGDjhJzAmFApZMCaUAyf8BMaEQiELxoRyzk7yCgOgRSASAuAYOCEAjoETAuAYOCEAjoETAuAYOCEAjoETAuAYOCEAjoETAuCY/wc8SC3r28PmnQAAAABJRU5ErkJggg=="
    ));
    $params = array(
        "images"=>json_encode($images)
        // "account"=>"php@163.com",
        // "ip"=>"123.115.77.137"
    );
    var_dump($params);

    $ret = check($params);
    var_dump($ret);
    if ($ret["code"] == 200) {
        $result = $ret["result"];
        // var_dump($array);
        foreach($result as $index => $image_ret){
            $name = $image_ret["name"];
            $taskId = $image_ret["taskId"];
            $labelArray = $image_ret["labels"];
            echo "taskId={$taskId},name={$name},labels:\n";
            $maxLevel=-1;
            foreach($image_ret["labels"] as $index=>$label){
                echo "label:{$label["label"]}, level={$label["level"]}, rate={$label["rate"]}\n";
            $maxLevel=$label["level"]>$maxLevel?$label["level"]:$maxLevel;
            }
            if($maxLevel==0){
            echo "#图片机器检测结果:最高等级为:正常\n";
            }else if($maxLevel==1){
            echo "#图片机器检测结果:最高等级为:嫌疑\n";
            }else if($maxLevel==2){
            echo "#图片机器检测结果:最高等级为:确定\n";
            }
        }
    }else{
        var_dump($ret);
    }
}
main();
?>
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Net.Http;

namespace Com.Netease.Is.Antispam.Demo
{
    class ImageCheckApiDemo
    {
        public static void imageCheck()
        {
            /** 产品密钥ID,产品标识 */
            String secretId = "your_secret_id";
            /** 产品私有密钥,服务端生成签名信息使用,请严格保管,避免泄露 */
            String secretKey = "your_secret_key";
            /** 业务ID,易盾根据产品业务特点分配 */
            String businessId = "your_business_id";
            /** 易盾内容安全服务图片在线检测接口地址 */
            String apiUrl = "https://as.dun.163yun.com/v3/image/check";
            Dictionary<String, String> parameters = new Dictionary<String, String>();

            long curr = (long)(DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalMilliseconds;
            String time = curr.ToString();

            // 1.设置公共参数
            parameters.Add("secretId", secretId);
            parameters.Add("businessId", businessId);
            parameters.Add("version", "v3.2");
            parameters.Add("timestamp", time);
            parameters.Add("nonce", new Random().Next().ToString());

            // 2.设置私有参数
            JArray jarray = new JArray();
            JObject image1 = new JObject();
            image1.Add("name", "http://p1.music.126.net/lEQvXzoC17AFKa6yrf-ldA==/1412872446212751.jpg");
            image1.Add("type", 1);
            image1.Add("data", "http://p1.music.126.net/lEQvXzoC17AFKa6yrf-ldA==/1412872446212751.jpg");
            jarray.Add(image1);

            JObject image2 = new JObject();
            image2.Add("name", "{\"imageId\": 33451123, \"contentId\": 78978}");
            image2.Add("type", 2);
            image2.Add("data", "iVBORw0KGgoAAAANSUhEUgAAASwAAAEsCAIAAAD2HxkiAAAYNElEQVR4nO2dP3vivNKHnfc6FWmhZVvTAk9JvkPSLikfsvUpSZ18hpAtl7TJdyBlYFvThpa0UK7fwtf6OP4zM/ZIlk1+d5HLOytpRsbjGVmyfBaGoQcAcMf/uTYAgK8OnBAAx8AJAXAMnBAAx8AJAXAMnBAAx8AJAXAMnBAAx8AJAXBNSOLauvpYLBb0qWBZr9c12Pnw8FCDnUoVEhaLRQ2nqyHQpwKREADHwAkBcAycUErYkuS8LXaCGDghAI6BE0o5OztzbYKIttgJYuCEUtqS5rXFThADJwTAMXBCABwDJwTAMXBCKW154NEWO0HMf5T1f/365fu+EVOscn19vd1urarwff/t7U3ZCGvn/f39z58/NSoOh4OmesR0OqXtnM/nV1dXGhW+7//69UvTQj1st9vr62tNC1on9H1/NBpFd98wDM/OzpJ/ozL653VRgxrh+fk5qyW2PLdNNsKcn5+Px2NWC02n06EL7Ha73W6n1KInCILfv38TBT4+PpQqOp2O/nzWgD710Dqhl7juUx4YX81Jb0y6aylhblflQmFHNG1KHBWALBgTAuAYA5EwFbXodDQ+LiXUp6PyjlRORxEGQTWQjqYrIh0FNYNImO4IIiGoGUTCdEVEQlAziITpjiASgppBJExXRCQENYMpCgAcYyAS0jw9Pb2+vtrW0oStu3a73f39vb4RusD3798nk4lShd7O29vb/X5PFFAaKeTm5sa2islkMp1O7erI3YMthq3+9vb258+fqHB0kPwbhuFsNrPbAc/zPO/PXyLVKcIwHI1GdAuLxYKoHneHAFseloK9bw6HQ7YRQyeVYjab0TbozyfSUQAcAycEwDFmnDDODVJ/60kY6iH8PI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hTc0LnUxSS9jVTFOHf0QgxnaBHaCdBWGk6IVdoVZEcpZ0Ep+aEuSel2i+aEgqnKCTt51ZP/cZFJSMziqobuSbkdhJUm06wOsegnHhQ2klwak4IQOs4NSdEOiq0xIidBEhH5ZyaEyIdFVpixE4CpKNyTs0JAWgdcEIAHGN92dpkMomPw7yVStn/ZUsS2BsTBkHw+vpK1H1/fxe2nzuKI7Kd5N/VakVvH0Yb6Xlet9ul9xeT20mQyq6zv2Z8Pot+d3pZXMTj4yN92VxeXna73az2+Dh5feYSFyhSxBrJE5Kw1dlla0mS67+I/w0zK8XY8qxQv2ytnuVgyV7nltQvAxwOh0Xa5UL9srV4ZalV1us1bYYeLFsDoPXU6oR0SlOUjxXNASiFtIXVqgvb10xRGLeENcn2FIVtaO0GhZWp1Qlp04s6GUGXryCkLaxWXdh+yD36TwlTJc1awppE2ElgY5KgGsoJElNTKQRIRwFwDJwQAMdgTGiyurB9jAk9o0m+0BKMCT0PY0KMCTEmzAPpKACOQTpqsrqwfaSjntH8QmhJY9NR7bK17XZbW16h4XA4SIqF3Ho6JZvNRtnCfr83YkmYeCHj7O8bUnIh274+eet0Or7vl+pUFnYtYb/fjz+lWC1IKC309E54fX2tN+LroPzI7inBXr6+7+vvWaPRiP6m6mKxoFcC1hBjMCYEwDFwwk/YHhM2hxaNCa0O1ZowJoQTfsL2FEVzaNEUhdWZA0xRAADghJ9BOioUsiAdlQMn/ATSUaGQBemoHDghAI6BEwLgGDjhJzAmFApZMCaUAyf8BMaEQiELxoRyzk7yCgOgRSASAuAYOCEAjoETAuAYOCEAjoETAuAYOCEAjoETAuAYOCEAjoETAuCY/wc8SC3r28PmnQAAAABJRU5ErkJggg==");
            jarray.Add(image2);

            parameters.Add("images", jarray.ToString());
            // parameters.Add("account", "csharp@163.com");
            // parameters.Add("ip", "123.115.77.137");

            // 3.生成签名信息
            String signature = Utils.genSignature(secretKey, parameters);
            parameters.Add("signature", signature);

            // 4.发送HTTP请求
            HttpClient client = Utils.makeHttpClient();
            String result = Utils.doPost(client, apiUrl, parameters, 1000);
            if(result != null)
            {
                JObject ret = JObject.Parse(result);
                int code = ret.GetValue("code").ToObject<Int32>();
                String msg = ret.GetValue("msg").ToObject<String>();
                if (code == 200)
                {
                    JArray array = (JArray)ret.SelectToken("result");
                    foreach (var item in array)
                    {
                        JObject tmp = (JObject)item;
                        String name = tmp.GetValue("name").ToObject<String>();
                        String taskId = tmp.GetValue("taskId").ToObject<String>();
                        JArray labels = (JArray)tmp.SelectToken("labels");
                        Console.WriteLine(String.Format("taskId={0},name={1},labels:", taskId, name));
                        int maxLevel = -1;
                        // 产品需根据自身需求,自行解析处理,本示例只是简单判断分类级别
                        foreach (var lable in labels)
                        {
                            JObject lableData = (JObject)lable;
                            int label = lableData.GetValue("label").ToObject<Int32>();
                            int level = lableData.GetValue("level").ToObject<Int32>();
                            double rate = lableData.GetValue("rate").ToObject<Double>();
                            Console.WriteLine(String.Format("label:{0}, level={1}, rate={2}", label, level, rate));
                            maxLevel = level > maxLevel ? level : maxLevel;
                        }

                        switch (maxLevel) {
                            case 0:
                                Console.WriteLine("#图片机器检测结果:最高等级为\"正常\"\n");
                                break;
                            case 1:
                                 Console.WriteLine("#图片机器检测结果:最高等级为\"嫌疑\"\n");
                                break;
                            case 2:
                                Console.WriteLine("#图片机器检测结果:最高等级为\"确定\"\n");
                                break;
                            default:
                                break;
                        }
                    }
                }
                else
                {
                    Console.WriteLine(String.Format("ERROR: code={0}, msg={1}", code, msg));
                }
            }
            else
            {
                Console.WriteLine("Request failed!");
            }
        }
    }
}
var utils=require("./utils");
//产品密钥ID,产品标识
var secretId="your_secret_id";
// 产品私有密钥,服务端生成签名信息使用,请严格保管,避免泄露
var secretKey="your_secret_key";
// 业务ID,易盾根据产品业务特点分配
var businessId="your_business_id";
// 易盾内容安全服务图片在线检测接口地址
var apiurl="https://as.dun.163yun.com/v3/image/check";
//请求参数
var post_data = {
    // 1.设置公有有参数
    secretId:secretId,
    businessId:businessId,
    version:"v3.2",
    timestamp:new Date().getTime(),
    nonce:utils.noncer(),
    // 2.1设置私有参数
    // account:"nodejs@163.com",
    // ip:"123.115.77.137"
};
// 2.2请求图片参数
var images=[{
        name:"http://p1.music.126.net/lEQvXzoC17AFKa6yrf-ldA==/1412872446212751.jpg",
        type:1,
        data:"http://p1.music.126.net/lEQvXzoC17AFKa6yrf-ldA==/1412872446212751.jpg"
    },{
        name:"{\"imageId\": 33451123, \"contentId\": 78978}",
        type:2,
        data:"iVBORw0KGgoAAAANSUhEUgAAASwAAAEsCAIAAAD2HxkiAAAYNElEQVR4nO2dP3vivNKHnfc6FWmhZVvTAk9JvkPSLikfsvUpSZ18hpAtl7TJdyBlYFvThpa0UK7fwtf6OP4zM/ZIlk1+d5HLOytpRsbjGVmyfBaGoQcAcMf/uTYAgK8OnBAAx8AJAXAMnBAAx8AJAXAMnBAAx8AJAXAMnBAAx8AJAXBNSOLauvpYLBb0qWBZr9c12Pnw8FCDnUoVEhaLRQ2nqyHQpwKREADHwAkBcAycUErYkuS8LXaCGDghAI6BE0o5OztzbYKIttgJYuCEUtqS5rXFThADJwTAMXBCABwDJwTAMXBCKW154NEWO0HMf5T1f/365fu+EVOscn19vd1urarwff/t7U3ZCGvn/f39z58/NSoOh4OmesR0OqXtnM/nV1dXGhW+7//69UvTQj1st9vr62tNC1on9H1/NBpFd98wDM/OzpJ/ozL653VRgxrh+fk5qyW2PLdNNsKcn5+Px2NWC02n06EL7Ha73W6n1KInCILfv38TBT4+PpQqOp2O/nzWgD710Dqhl7juUx4YX81Jb0y6aylhblflQmFHNG1KHBWALBgTAuAYA5EwFbXodDQ+LiXUp6PyjlRORxEGQTWQjqYrIh0FNYNImO4IIiGoGUTCdEVEQlAziITpjiASgppBJExXRCQENYMpCgAcYyAS0jw9Pb2+vtrW0oStu3a73f39vb4RusD3798nk4lShd7O29vb/X5PFFAaKeTm5sa2islkMp1O7erI3YMthq3+9vb258+fqHB0kPwbhuFsNrPbAc/zPO/PXyLVKcIwHI1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HihTtdjvturaQhK2OLQ/NbnkoUUQL2S8KS9Bvzaj/Uq/+C7gS2OtzNpvZthPpKACOgRMC4JhTc0LnUxSS9jVTFOHf0QgxnaBHaCdBWGk6IVdoVZEcpZ0Ep+aEuSel2i+aEgqnKCTt51ZP/cZFJSMziqobuSbkdhJUm06wOsegnHhQ2klwak4IQOs4NSdEOiq0xIidBEhH5ZyaEyIdFVpixE4CpKNyTs0JAWgdcEIAHGN92dpkMomPw7yVStn/ZUsS2BsTBkHw+vpK1H1/fxe2nzuKI7Kd5N/VakVvH0Yb6Xlet9ul9xeT20mQyq6zv2Z8Pot+d3pZXMTj4yN92VxeXna73az2+Dh5feYSFyhSxBrJE5Kw1dlla0mS67+I/w0zK8XY8qxQv2ytnuVgyV7nltQvAxwOh0Xa5UL9srV4ZalV1us1bYYeLFsDoPXU6oR0SlOUjxXNASiFtIXVqgvb10xRGLeENcn2FIVtaO0GhZWp1Qlp04s6GUGXryCkLaxWXdh+yD36TwlTJc1awppE2ElgY5KgGsoJElNTKQRIRwFwDJwQAMdgTGiyurB9jAk9o0m+0BKMCT0PY0KMCTEmzAPpKACOQTpqsrqwfaSjntH8QmhJY9NR7bK17XZbW16h4XA4SIqF3Ho6JZvNRtnCfr83YkmYeCHj7O8bUnIh274+eet0Or7vl+pUFnYtYb/fjz+lWC1IKC309E54fX2tN+LroPzI7inBXr6+7+vvWaPRiP6m6mKxoFcC1hBjMCYEwDFwwk/YHhM2hxaNCa0O1ZowJoQTfsL2FEVzaNEUhdWZA0xRAADghJ9BOioUsiAdlQMn/ATSUaGQBemoHDghAI6BEwLgGDjhJzAmFApZMCaUAyf8BMaEQiELxoRyzk7yCgOgRSASAuAYOCEAjoETAuAYOCEAjoETAuAYOCEAjoETAuAYOCEAjoETAuCY/wc8SC3r28PmnQAAAABJRU5ErkJggg=="
    }];
post_data.images=JSON.stringify(images);
var signature=utils.genSignature(secretKey,post_data);
post_data.signature=signature;
//http请求结果
var responseCallback=function(responseData){
    var data = JSON.parse(responseData);
    var code=data.code;
    var msg=data.msg;
    if(code==200){
        var result=data.result;
        for(var i=0;i<result.length;i++){
            var obj=result[i];
            var name=obj.name;
            var taskId=obj.taskId;
            var labelsArray=obj.labels;
            console.log("taskId="+taskId+",name="+name+",labels:");
            var  maxLevel = -1;
            // 产品需根据自身需求,自行解析处理,本示例只是简单判断分类级别
            for(var k=0;k<labelsArray.length;k++){
                var labelObj=labelsArray[k];
                var label=labelObj.label;
                var level=labelObj.level;
                var rate=labelObj.rate;
                console.log("lable:"+label+",level:"+level+",rate:"+rate);
                maxLevel = level > maxLevel ? level : maxLevel;
            }
             switch (maxLevel) {
            case 0:
                console.log("#图片机器检测结果:最高等级为\"正常\"\n");
                break;
            case 1:
                console.log("#图片机器检测结果:最高等级为\"嫌疑\"\n");
                break;
            case 2:
                console.log("#图片机器检测结果:最高等级为\"确定\"\n");
                break;
            default:
                break;
                }

        }
    }else{
         console.log('ERROR:code=' + code+',msg='+msg);
    }

}
utils.sendHttpRequest(apiurl,"POST",post_data,responseCallback);

响应示例

输出结果:

注:分类信息,100:色情,110:性感,200:广告,210:二维码,300:暴恐,400:违禁,500:涉政

{
    "code": 200,
    "msg": "ok",
    "result": [
        {
            "taskId": "8e0b9306cec744aeb7467486adfa96e2",
            "status": 0,
            "name": "http://xxx.net/xxx1.jpg",
            "labels": [//所有分类level都为正常,故图片正常
                {
                    "label": 100,
                    "level": 0,
                    "rate": 0.0
                },
                {
                    "label": 110,
                    "level": 0,
                    "rate": 0.0
                },
                {
                    "label": 200,
                    "level": 0,
                    "rate": 0.0
                },
                {
                    "label": 210,
                    "level": 0,
                    "rate": 0.0
                },
                {
                    "label": 300,
                    "level": 0,
                    "rate": 0.0
                },
                {
                    "label": 400,
                    "level": 0,
                    "rate": 0.0
                },
                {
                    "label": 500,
                    "level": 0,
                    "rate": 0.0
                }
            ],
            "details": {
                "ocrText": [],
		"flagNames": []
            }
        },
        {
            "taskId": "t79b293083b840ffa208d5d9394f2376",
            "status": 0,
            "name": "http://xxx.net/xxx2.jpg",
            "labels": [//命中二维码分类
                {
                    "label": 210,
                    "level": 2,
                    "rate": 0.9999
                },
                {
                    "label": 100,
                    "level": 0,
                    "rate": 0.0
                },
                {
                    "label": 110,
                    "level": 0,
                    "rate": 0.0
                },
                {
                    "label": 200,
                    "level": 0,
                    "rate": 0.0
                },
                {
                    "label": 300,
                    "level": 0,
                    "rate": 0.0
                },
                {
                    "label": 400,
                    "level": 0,
                    "rate": 0.0
                },
                {
                    "label": 500,
                    "level": 0,
                    "rate": 0.0
                }
            ],
            "details": {
			"ocrText": [],
			"flagNames": []
            }
        }
    ]
}

``
95163223