跳到正文

URL通信样本溯源查询

接口说明

接收一个 URL 作为输入,可选择添加decode字段,设为true表示url参数的值是经过 URLEncode (一种将 URL 中不允许出现的特殊字符(如空格、中文、标点符号等)转换为特定格式(% XX 形式)的编码方式,目的是确保这些特殊字符能在 URL 中正确传输。)处理的,设为false默认无效。查询该 URL 关联的所有通信样本的hash 值MD5 ,最终返回这些 MD5 的列表。通讯样本指与该网址发生过网络交互的文件。

请求地址

https://api.f.360.cn/urls/std/internal/v2/communicate_files

请求方法

POST

请求参数

参数名类型位置是否必填示例值说明
queryobjectbody是
{
  "keywords": [
    {
      "field": "url",
      "value": "https://baidu.com"
    }
  ]
}
查询条件,所有请求参数的父级结构
query.keywordsArray(object)body是
[
  {
    "field": "url",
    "value": "https://baidu.com"
  }
]
查询条件,所有请求参数的子级结构
query.keywords.[0].fieldstringbody是url查询条件的字段名,支持的字段有:url
query.keywords.[0].valuestringbody是https://baidu.com查询条件的字段值,为单个域URL
query.keywords.[1].fieldstringbody否decode查询条件的字段名,支持的字段有:decode
query.keywords.[1].valuestringbody否code传任意值就为true,表示url参数的值是 URLEncode 处理过的

响应参数

名称类型示例值描述
codestring0响应状态码
dataArray(object)
data.md5stringa61f004afc8b81741c7dde7e72fb1202样本文件的hash,长度32
msgstringok响应状态信息

请求示例

支持cUrl、Python、Java、PHP、Go语言的请求,示例如下

#!/usr/bin/env bash
set -euo pipefail

APPID=""  # apikey
SECRET=""  # salt
URL="https://api.f.360.cn/urls/std/internal/v2/communicate_files"
BODY='{"query":{"keywords":[{"field":"url","value":"https://baidu.com"}]}}'

NONCE=$(printf '%08d' $((RANDOM % 100000000)))
TIMESTAMP=$(date +%s)
BODY_MD5=$(printf '%s' "$BODY" | openssl dgst -md5 -hex | awk '{print $NF}')
SIGNATURE=$(printf '%s' "${BODY_MD5}${APPID}${NONCE}${TIMESTAMP}${SECRET}" | openssl dgst -md5 -hex | awk '{print $NF}')
SIGNATURE=${SIGNATURE:16}

curl --location --request POST "$URL" \
  --header "Content-Type: application/json" \
  --header "X-360-Key: ${APPID}" \
  --header "X-360-Nonce: ${NONCE}" \
  --header "X-360-Timestamp: ${TIMESTAMP}" \
  --header "X-360-Signature: ${SIGNATURE}" \
  --data "${BODY}"

响应示例

业务正常响应

{
    "_oid": 1,
    "code": "0",
    "data": [
        {
            "md5": "fe3c75194b2b21e3f89b9f6470c1ad85"
        },
        {
            "md5": "97a3f307936a1bb4acef0ecb396f86d7"
        }
    ],
    "msg": "ok",
    "status": 0
}

业务异常响应

{
    "code": "GS00302",
    "msg": "current uri works business now, please try again later"
}