下载
导入到 Postman
- 打开 Postman,点击左上角的 Import。
- 拖拽 openapi.yaml 文件,或粘贴 URL:https://api.fs.ax/openapi.yaml
- Postman 将生成包含所有端点、参数和示例响应的完整集合。
- 将 Authorization 变量设置为您的 API 密钥,然后开始测试。
生成客户端
使用 OpenAPI Generator 为 50+ 种语言创建类型化客户端:
# Install the generator
npm install -g @openapitools/openapi-generator-cli
# Generate a TypeScript client
openapi-generator-cli generate \
-i https://api.fs.ax/openapi.yaml \
-g typescript-fetch \
-o ./fsax-client
# Generate a Python client
openapi-generator-cli generate \
-i https://api.fs.ax/openapi.yaml \
-g python \
-o ./fsax-python-client
# Generate a Go client
openapi-generator-cli generate \
-i https://api.fs.ax/openapi.yaml \
-g go \
-o ./fsax-go-client规范预览
以下是规范的片段:
openapi: "3.1.0"
info:
title: fs.ax API
version: "1.0.0"
description: URL shortener with built-in monetization
contact:
email: api@fs.ax
servers:
- url: https://api.fs.ax/v1
description: Production
paths:
/links:
post:
summary: Create a short link
operationId: createLink
tags: [Links]
security:
- bearerAuth: []
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/CreateLinkRequest"
responses:
"201":
description: Link created
content:
application/json:
schema:
$ref: "#/components/schemas/Link"始终保持最新。 该规范从我们的 Rust API 源代码自动生成,因此始终与线上 API 完全一致。
需要帮助?查阅 API 文档或发送邮件至 api@fs.ax。