[WordPress] 外掛分享: Copypress Rest API

首頁外掛目錄 › Copypress Rest API
WordPress 外掛 Copypress Rest API 的封面圖片
⚠ 此外掛已下架 — 不再更新維護,建議勿安裝。
90+
安裝啟用
尚無評分
335 天前
最後更新
問題解決
WordPress 6.4+ PHP 7.3+ v1.2 上架:2025-04-07

內容簡介

總結:「COPYPRESS REST API 外掛擴展了 WordPress REST API,提供自訂端點來管理文章、分類、標籤、文章類型以及分類法。」

問題與答案:

1. COPYPRESS REST API 外掛提供了哪些功能?
- 可以透過 REST API 創建、更新和刪除文章。
- 可以擷取分類、標籤、文章類型和分類法。
- 支援 CORS(跨源資源共享),允許從不同來源進行 API 請求。
- 可以透過 URL 附加圖像到文章中。

2. 可以透過哪些端點進行操作?
- POST /copypress-api/v1/posts:創建一篇新文章。
- PUT /copypress-api/v1/posts/{id}:更新現有文章。
- DELETE /copypress-api/v1/posts/{id}:刪除文章。
- GET /copypress-api/v1/categories:獲取所有分類。
- GET /copypress-api/v1/tags:獲取所有標籤。
- GET /copypress-api/v1/post-types:獲取所有公共文章類型。
- GET /copypress-api/v1/get-taxonomies/{post_type}:獲取與特定文章類型相關的所有分類法和標籤。

3. COPYPRESS REST API 外掛支援哪些 HTTP 方法和標頭?
- 允許的方法:GET、POST、PUT、DELETE。
- 允許的標頭:Content-Type、X-Custom-Header、x-csrf-token、Authorization。

4. 該外掛的使用方式是什麼?
- 啟用外掛後,可以使用自訂 API 路由與文章、分類、標籤、文章類型和分類法進行互動。可以從任何可以與 REST API 互動的外部應用程式或客戶端對相應端點進行請求。

外掛標籤

開發者團隊

⬇ 下載最新版 (v1.2) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「Copypress Rest API」→ 直接安裝(推薦)
📦 歷史版本下載

原文外掛簡介

The COPYPRESS REST API plugin extends the WordPress REST API with custom endpoints for managing posts, categories, tags, post types, and taxonomies.
Features

Create, update, and delete posts via REST API.
Fetch categories, tags, post types, and taxonomies.
Supports CORS (Cross-Origin Resource Sharing) for making API requests from different origins.
Allows attaching images to posts via URLs.

Endpoints

/copypress-api/v1/login – Login with username and password to get a JWT token.

Request Body:
username (string): WordPress username
password (string): WordPress password

POST /copypress-api/v1/posts – Create a new post.

Request Body:

title (string): The title of the post.
content (string): The content of the post.
excerpt (string, optional): The excerpt of the post.
category (int, optional): The category ID of the post.
tags (string, optional): Comma-separated list of tag slugs.
image (string, optional): URL of an image to be set as the post’s featured image.
post_type (string, optional): The post type (default: post).
author_id (int, optional): The ID of the post author (default: current user).
post_status (string): Post publish status.

Response: Success message, HTTP status code, and created post object.

PUT /copypress-api/v1/posts/{id} – Update an existing post.

Request Body: Same as POST endpoint.
Response: Success message, HTTP status code, and updated post object.

DELETE /copypress-api/v1/posts/{id} – Delete a post.

Response: Success message and HTTP status code.

GET /copypress-api/v1/categories – Get all categories.

Response: Category ID, name, and slug.

GET /copypress-api/v1/tags – Get all tags.

Response: Tag ID, name, and slug.

GET /copypress-api/v1/post-types – Get all public post types.

Response: Post type name and label.

GET /copypress-api/v1/get-taxonomies/{post_type} – Get all taxonomies (categories and tags) associated with a specific post type.

Response: List of categories (hierarchical taxonomies) and tags (non-hierarchical taxonomies).

CORS Support
This plugin allows cross-origin requests for all the REST API endpoints, enabling requests from different domains.
Allowed Methods:

GET, POST, PUT, DELETE

Allowed Headers:

Content-Type, X-Custom-Header, x-csrf-token, Authorization

Allowed Origin:

* (Any domain)

Usage
Once the plugin is activated, the custom API routes are available for interaction with posts, categories, tags, post types, and taxonomies. You can make requests to the respective endpoints from any external application or client that can interact with REST APIs. To create or update posts, a valid JWT token must be provided in the Authorization header as:
Authorization: Bearer YOUR_TOKEN_HERE
License
This plugin is licensed under the GPLv2 license.

延伸相關外掛

文章
Filter
Mastodon