Scento 是一家香水电商网站,商城背后是一个经过核验的数据库,收录 1,623 款香水:完整的香调金字塔、14 个香调家族、品牌、气质描述和相似度数据。这个数据库以公开 REST API 的形式暴露在 https://www.scento.com/api/perfume/v1,无需 API key、无需注册,通过普通 HTTPS 返回 JSON。下面用真实响应逐个说明各端点。

完整参考见 OpenAPI 文档 https://www.scento.com/api/perfume/v1/openapi.json,Scento 开发者页面上还有一份更易读的版本。

1. 统一响应信封,处处一致

每个端点都返回相同的结构,能让客户端代码保持简单:

{
  "folio": "perfume-search",
  "lede": "582 entries in Scento’s verified perfume database match “vanilla”; showing 1–10.",
  "detail": { "...": "the actual payload" },
  "scento_page": { "label": "Vanilla 28 on Scento", "url": "https://www.scento.com/perfumes/vanilla-28-kayali" },
  "further_reading": [],
  "cite": "Scento Perfume API, scento.com",
  "continuation": "cGVyZnVtZS1zZWFyY2h8MTFqMG9xa3wxMA"
}

folio 标明文档种类,lede 是结果的一句话摘要(在聊天界面和快速调试时很顺手),detail 承载实际载荷。continuation 用来在长结果集里翻页:把它的值作为 ?continuation=... 传回去即可。

2. 搜索

主力端点是 GET /perfumes?q=...,对香水做全文检索:

curl -s "https://www.scento.com/api/perfume/v1/perfumes?q=vanilla"

detail.matches 里每一条长这样:

{
  "kind": "perfume",
  "name": "Vanilla 28",
  "house": "Kayali",
  "family": "Velvet Sweet",
  "page": "https://www.scento.com/perfumes/vanilla-28-kayali"
}

单独查 “vanilla” 能命中 582 款香水,从 Kayali 的 Vanilla 28 到 Juliette Has a Gun 的 Vanilla Vibes。通用的 GET /search?q=... 端点会一次检索所有文档种类(香水、原料、品牌),需要锁定种类时可以加 kind 过滤。

3. 单款香水

GET /perfumes/{perfume} 按 slug 返回完整档案:

curl -s "https://www.scento.com/api/perfume/v1/perfumes/vanilla-28-kayali"
{
  "folio": "perfume-portrait",
  "detail": {
    "name": "Vanilla 28",
    "house": "Kayali",
    "concentration": "eau de parfum",
    "family": "Velvet Sweet",
    "notes": ["Vanilla", "Tonka Bean", "Amberwood", "Musk", "Brown Sugar"],
    "character": "Vanilla orchid and brown sugar lead a deep, sweet blend with tonka absolute, amber woods and a soft layer of musk.",
    "character_words": ["sweet", "warm", "amber", "musky"],
    "wears": { "seasons": ["autumn", "winter"], "hours": ["evening", "night"] },
    "signature_materials": ["Vanilla", "Tonka Bean", "Brown Sugar"]
  }
}

character_words 和 wears 是归一化字段,在做筛选或构建分面时比直接展示文字描述更好用。

4. 对比两款香水

GET /contrast?perfumes=a,b 把两款香水并排比较。下面是一段用原生 fetch 写的可运行 JavaScript 示例:

const base = "https://www.scento.com/api/perfume/v1";

async function contrast(a, b) {
  const res = await fetch(`${base}/contrast?perfumes=${a},${b}`);
  const { lede, detail } = await res.json();
  console.log(lede);
  console.log("Shared notes:", detail.shared_materials.join(", "));
}

await contrast("vanilla-28-kayali", "angels-share-by-kilian");

输出:

Vanilla 28 and Angels' Share share tonka bean, but part ways on character and season.
Shared notes: Tonka Bean

detail 对象还带有逐维度对比(house、family、top、heart、base、character),正好是对比视图需要的数据。

5. 查找相似香水

GET /perfumes/{perfume}/neighbours 返回结构相近的香水,并给出每条匹配的解释:

{
  "lede": "193 perfumes share structure with Angels' Share by Kilian Paris; the closest is Portrait Revival, sharing cinnamon, tonka bean and oakwood.",
  "detail": {
    "total": 193,
    "neighbours": [
      {
        "name": "Portrait Revival",
        "house": "Afnan",
        "family": "Velvet Sweet",
        "shared": ["Cinnamon", "Tonka Bean", "Oakwood", "Praline", "Sandalwood"],
        "difference": "Adds honey and saffron to a similar frame."
      }
    ]
  }
}

加上 same_house=true 可以把结果限定在单一品牌内,适合做「喜欢 X 的话,同一品牌还有……」这类功能。

6. 原料与品牌数据

香调本身也是一等文档。GET /materials/{material} 返回别名(“oudh”、“agarwood”、“aoud”……)、这种原料的气味、搭配对象,以及哪些香水以它为主角。要找同时含多种原料的香水,用 GET /materials/match —— 下面这段 Python 只用标准库:

import json
import urllib.request

url = "https://www.scento.com/api/perfume/v1/materials/match?materials=vanilla,oud,tobacco&tier=base"
with urllib.request.urlopen(url) as res:
    data = json.load(res)

print(data["lede"])
for p in data["detail"]["perfumes"][:3]:
    print(f'- {p["name"]} by {p["house"]} ({p["family"]})')

输出:

2 perfumes in Scento's verified perfume database contain vanilla, oud and tobacco in the base, Voyage Titan pour Homme first.
- Voyage Titan pour Homme by Armaf (Amber & Resin)
- Alexandria Orientale by Xerjoff (Wood & Root)

tier 参数(top、heart、base、any)按香调金字塔的位置过滤,family 把范围收窄到 14 个香调家族之一。品牌同理:GET /houses/{house} 返回国家、创立年份、风格描述和该品牌的招牌香水。

7. 错误与本地化

非法输入会返回一个干净的 400,响应体是机器可读的:

{ "error": { "code": "invalid_input", "message": "\"tier\" must be one of: top, heart, base, any." } }

每个端点都接受 lang 参数以返回本地化响应,同一个查询可以服务多个语言区域。

8. 还有这些端点

除了上面的端点:GET /families 给出带数量的 14 家族树,GET /edits/{occasion} 按场合返回精选清单,GET /wardrobe 根据喜欢和回避的原料生成建议,GET /lexicon/{term} 和 GET /journal 覆盖香水术语与编辑内容。这些都在 OpenAPI 文件里有文档。

如果你的工具链支持 Model Context Protocol,同一个数据库还以 MCP server 的形式暴露在 https://www.scento.com/mcp,提供十几个只读工具,同样不需要密钥。


觉得这篇端点梳理有用,欢迎点赞、点个「在看」。想看更多运维与云原生实战内容,欢迎关注我。