You need to enable JavaScript to run this app.
导航

接口说明

最近更新时间2023.04.10 19:14:15

首次发布时间2021.12.16 18:01:18

1. 对接简介

1分钟了解业务风险识别产品对接流程:

image

整体对接方案流程如下
1)客户端嵌入设备安全SDK,SDK生成设备标识。
2)业务服务端在注册、领券等场景调用业务风险服务。
3)根据返回值对用户进行处置。

设备安全SDK产品介绍:设备安全SDK-产品文档,设备安全SDK提供移动端安全检测能力,不独立提供接口服务,集成在风险识别服务中使用和检测设备安全风险,风险识别产品开通后,登录并访问控制台页面可下载SDK及查看开发接入文档。

2. 基本信息

请求地址:https://open.volcengineapi.com
请求协议:HTTPS
字符集:UTF-8
Content-Type: application/json

调用方式

为保证接口调用安全,调用风险识别服务提供的每个API时,都需要提供签名认证信息,服务调用有如下两种方式。

注意:鉴权时会把签名生成的时间戳与当前时间进行比较,如果相差超过2分钟会鉴权失败,这是为了防止重放攻击,请保持服务器时钟的准确。

火山引擎为用户封装了带签名算法的SDK,可以在如下地址获取:https://github.com/volcengine,目前支持Go、Java、PHP、Python。

使用SDK可以减少大量接入成本,并长期提供维护和升级,支持错误重试等适用于业务本地服务端执行的能力。

Go

获取地址:https://github.com/volcengine/volc-sdk-golang

版本说明:支持go 1.13.1及以上版本,如不支持,请联系火山引擎反作弊平台

import (
   "github.com/volcengine/volc-sdk-golang/service/businessSecurity"
)

const (
   Ak = "" // fill in your access key
   Sk = "" // fill in your secret key
)

func init() {
   businessSecurity.DefaultInstance.Client.SetAccessKey(AK)
   businessSecurity.DefaultInstance.Client.SetSecretKey(Sk)
}

func RiskDetection(appId int64, service string, parameters string) (*businessSecurity.RiskDetectionResponse, error) {
   return businessSecurity.DefaultInstance.RiskDetection(&businessSecurity.RiskDetectionRequest{
      AppID:      appId,
      Service:    service,
      Parameters: parameters,
   })
}

Python

获取地址:https://github.com/volcengine/volc-sdk-python

版本说明:支持Python2.7及以上版本,如不支持,请联系火山引擎反作弊平台

from volcengine.business_security.RiskDetectionService import RiskDetectService
if __name__ == '__main__':
    riskDetector = RiskDetectService()
    # call below method if you dont set ak and sk in ~/.volc/config
    riskDetector.set_ak('ak') # fill in your access key
    riskDetector.set_sk('sk') # fill in your secret key

    params = dict()
    req = {
         'AppId': 0, # fill in your app id
         'Service': "", # fill in the adblock service to be called
         'Parameters': '{}' # fill in the parameters with json
    }
    resp = riskDetector.risk_detect(params, req)

PHP

获取地址:https://github.com/volcengine/volc-sdk-php
版本说明:支持PHP7.0及以上版本,如不支持,请联系火山引擎反作弊平台

<?php
require('../../vendor/autoload.php');

use Volc\Service\BusisnessSecurity;
$client = BusisnessSecurity::getInstance();

// call below method if you dont set ak and sk in ~/.volc/config
$client->setAccessKey("ak");
$client->setSecretKey("sk");

// fill in your app id , ad block service and parameters
$response = $client->RiskDetection(214209, "chat", "{\"uid\":123411, \"operate_time\":1609818934, \"chat_text\":\"[l]304509020交流经验的\"}");
echo $response;

Java

获取地址:https://github.com/volcengine/volc-sdk-java
版本说明:支持JDK8及以上版本,如不支持,请联系火山引擎反作弊平台

package com.volcengine.example.businessSecurity;

import com.alibaba.fastjson.JSON;
import com.volcengine.model.request.RiskDetectionRequest;
import com.volcengine.model.response.RiskDetectioResponse;
import com.volcengine.service.businessSecurity.BusinessSecurityServiceImpl;
import com.volcengine.service.businessSecurity;

public class RiskDetectionDemo {
    public static void main(String[] args) {
        BusinessSecurityService businessSecurityService = BusinessSecurityServiceImpl.getInstance();
        // call below method if you dont set ak and sk in ~/.volc/config

        businessSecurityService.setAccessKey("ak");
        businessSecurityService.setSecretKey("sk");
        // risk detection
        try {
            RiskDetectionRequest riskDetectionRequest = new RiskDetectionRequest();
            riskDetectionRequest.setLimit(3);

            RiskDetectionResponse riskDetectionResponse = businessSecurityService.RiskDetection(riskDetectionRequest);
            System.out.println(JSON.toJSONString(riskDetectionResponse));
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

AppId(应用ID)获取方式

火山引擎账户注册后,在火山引擎控制台的应用管理可创建新应用,或者选取已有应用将应用ID在公共请求参数章节中的AppId字段使用。

如创建应用过程中报错显示“Duplicated AppNameZh”,说明此前接入过其他火山引擎服务,可联系我方协助获取应用ID。

密钥获取方式

完成火山引擎账户注册后,在火山引擎控制台点击右上角秘钥管理可以获取鉴权信息。

image

详情可参考:
火山引擎控制台-访问密钥(Access Key)