跳到正文

URL下载链溯源查询

接口说明

根据url获取当前下载链接md5列表、父页面链接列表、子页面链接列表。

推荐应用场景

用于后台管理和风控系统

请求地址

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

请求方法

POST

请求参数

参数名类型位置是否必填示例值说明
queryobjectbody是
{
  "keywords": [
    {
      "field": "url",
      "value": "https%3a%2f%2ficm.foton.com.cn%2ffile%2fgroup1%2fM00%2f00%2f12%2fCmQDG1szICGAI1YjAAXVYj3kvfU670.jpg"
    },
    {
      "field": "decode",
      "value": "true"
    }
  ]
}
用文件下载路径
query.keywordsArray(object)body是
[
  {
    "field": "url",
    "value": "https%3a%2f%2ficm.foton.com.cn%2ffile%2fgroup1%2fM00%2f00%2f12%2fCmQDG1szICGAI1YjAAXVYj3kvfU670.jpg"
  },
  {
    "field": "decode",
    "value": "true"
  }
]
查询条件,所有请求参数的子级结构
query.keywords.[0].fieldstringbody是url查询条件的字段名,目前支持:url
query.keywords.[0].valuestringbody是https%3a%2f%2ficm.foton.com.cn%2ffile%2fgroup1%2fM00%2f00%2f12%2fCmQDG1szICGAI1YjAAXVYj3kvfU670.jpg查询条件的字段值,为单个URL
query.keywords.[1].fieldstringbody否decode表示url参数经过url encode处理,需要接口进行decode处理,传任意值就为true
query.keywords.[1].valuestringbody否truetrue表示接口需要进行decode,false表示不需要

响应参数

名称类型示例值描述
codestring0响应状态码
dataArray(object)
{
  "dl_curl": [
    "https://icm.foton.com.cn"
  ],
  "dl_md5": [],
  "dl_purl": [
    "https://icm.foton.com.cn"
  ]
}
响应具体信息
data.dl_curlArray(string)
[
  "https://icm.foton.com.cn"
]
子页面链接
data.dl_purlArray(string)
[
  "https://icm.foton.com.cn"
]
父页面链接
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/download_info"
BODY='{"query":{"keywords":[{"field":"url","value":"https://icm.foton.com.cn/file/group1/M00/00/12/CmQDG1szICGAI1YjAAXVYj3kvfU670.jpg"}]}}'

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": {
        "dl_curl": [
            "https://icm.foton.com.cn"
        ],
        "dl_md5": [],
        "dl_purl": [
            "https://icm.foton.com.cn"
        ]
    },
    "msg": "ok",
    "status": 0
}

业务异常响应

{
    "code": "GS00301",
    "msg": "param missing"
}