contentful-api
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseContentful REST API Guide
Contentful REST API 指南
Language-agnostic guide for Contentful APIs using HTTP/curl.
基于HTTP/curl的Contentful APIs通用指南(与编程语言无关)。
Shared References
通用参考
- Authentication — Token types, auth headers, API base URLs (US/EU)
- HTTP Conventions — Version locking, rate limits, pagination, errors, locale structure
- 身份验证 — 令牌类型、身份验证标头、API基础URL(美国/欧洲)
- HTTP约定 — 版本锁定、速率限制、分页、错误处理、区域设置结构
Content Management API (CMA)
Content Management API (CMA)
Read/write API for managing content, content types, assets, and environments.
Start here: references/content-management/overview.md
- entries.md — CRUD, publish/unpublish, versioning, query parameters
- content-types.md — Define/update content models, field types, validations
- assets.md — Upload, process, publish media files
- environments.md — Create, clone, manage environments and aliases
用于管理内容、内容类型、资源和环境的读写API。
入门指南:references/content-management/overview.md
- entries.md — 增删改查(CRUD)、发布/取消发布、版本控制、查询参数
- content-types.md — 定义/更新内容模型、字段类型、验证规则
- assets.md — 上传、处理、发布媒体文件
- environments.md — 创建、克隆、管理环境及别名
Content Delivery API (CDA)
Content Delivery API (CDA)
Read-only API for fetching published content.
Start here: references/content-delivery/overview.md
- querying.md — Filters, search operators, pagination, ordering
- includes-links.md — Include parameter, link resolution
- localization.md — Locale parameter, fallback chains
- sync.md — Incremental content synchronization
用于获取已发布内容的只读API。
入门指南:references/content-delivery/overview.md
- querying.md — 过滤器、搜索运算符、分页、排序
- includes-links.md — 包含参数、链接解析
- localization.md — 区域设置参数、 fallback 链
- sync.md — 增量内容同步
Content Preview API
Content Preview API
Draft + published content via same CDA endpoints, different host/token.
Reference: references/content-preview/overview.md
通过与CDA相同的端点获取草稿+已发布内容,仅需使用不同的主机地址/令牌。
参考文档:references/content-preview/overview.md
Images API
Images API
On-the-fly image transformations via URL parameters. No authentication needed.
Reference: references/images/overview.md
通过URL参数实时转换图片。无需身份验证。
参考文档:references/images/overview.md
GraphQL API
GraphQL API
Query content via GraphQL with CDA tokens.
Reference: references/graphql/overview.md
使用CDA令牌通过GraphQL查询内容。
参考文档:references/graphql/overview.md
Quick Reference
快速参考
bash
undefinedbash
undefinedCMA: Create a draft entry
CMA: 创建草稿条目
curl -X POST https://api.contentful.com/spaces/{space_id}/environments/{env_id}/entries
-H "Authorization: Bearer {cma_token}"
-H "Content-Type: application/vnd.contentful.management.v1+json"
-H "X-Contentful-Content-Type: blogPost"
-d '{"fields":{"title":{"en-US":"Hello"}}}'
-H "Authorization: Bearer {cma_token}"
-H "Content-Type: application/vnd.contentful.management.v1+json"
-H "X-Contentful-Content-Type: blogPost"
-d '{"fields":{"title":{"en-US":"Hello"}}}'
curl -X POST https://api.contentful.com/spaces/{space_id}/environments/{env_id}/entries
-H "Authorization: Bearer {cma_token}"
-H "Content-Type: application/vnd.contentful.management.v1+json"
-H "X-Contentful-Content-Type: blogPost"
-d '{"fields":{"title":{"en-US":"Hello"}}}'
-H "Authorization: Bearer {cma_token}"
-H "Content-Type: application/vnd.contentful.management.v1+json"
-H "X-Contentful-Content-Type: blogPost"
-d '{"fields":{"title":{"en-US":"Hello"}}}'
Then publish: PUT .../entries/{id}/published with X-Contentful-Version header
然后发布:使用X-Contentful-Version标头发送PUT请求至.../entries/{id}/published
CDA: Fetch entries
CDA: 获取条目
curl "https://cdn.contentful.com/spaces/{space_id}/environments/{env_id}/entries?content_type=blogPost"
-H "Authorization: Bearer {cda_token}"
-H "Authorization: Bearer {cda_token}"
undefinedcurl "https://cdn.contentful.com/spaces/{space_id}/environments/{env_id}/entries?content_type=blogPost"
-H "Authorization: Bearer {cda_token}"
-H "Authorization: Bearer {cda_token}"
undefined