Div Data Docs API
Exposes API for DivData help api
Install
This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.
Install straight from GitHub with WP-CLI:
wp plugin install https://github.com/ucsc/divdata-help/archive/refs/heads/main.zipThis WordPress plugin exposes DivData Help Docs via a custom REST API endpoint, allowing frontend applications to query posts based on the role and route metadata.
🔧 What It Does
-
Registers a custom REST API endpoint:
GET /wp-json/divdata/v1/posts?role=admin&route=people -
Returns published posts of the custom post type
divdata-help-docthat match the specified:role(custom field)route(custom field)
-
Designed for use with Vue components or other frontend tools that dynamically render help content.
📁 Getting Started (Local Dev Setup)
-
Clone the UCSC WordPress Dev environment:
git clone https://github.com/ucsc/wp-dev.ucsc.git cd wp-dev.ucsc -
Start the local WordPress instance and navigate to:
public/wp-content/plugins/ -
Clone this plugin into the
plugins/directory:git clone https://github.com/ucsc/divdata-help.git div-data-docs-api -
In the WordPress admin dashboard (
http://localhost/wp-admin):- Go to Plugins
- Activate Div Data Docs API
📝 Setup Requirements
To use this plugin, you must:
-
Register a custom post type called DivData Help Doc (
divdata-help-doc)
You can do this using ACF’s Post Types feature or manually via code. -
Add two custom fields to this post type:
role(e.g.,admin,student, etc.)route(e.g.,people,courses, etc.)
These fields can be created using ACF Field Groups.
Make sure your posts are:
- Published
- Assigned a valid
roleandroutevalue
📥 Example Request
GET /wp-json/divdata/v1/posts?role=admin&route=people
Response:
[
{
"id": 22,
"title": "How to manage people",
"content": "<p>Help article content here</p>",
"role": "admin",
"route": "people"
}
]
📌 Notes
- The post type should not be exposed to the default REST API (
show_in_restshould befalse). - This plugin does not include frontend rendering; it is purely an API backend for frontend apps.
- There is no authentication layer. Only published content is returned.
🧑💻 Author
Sammy Slug
UCSC Web Team
Releases
1 release.
These releases are tags only. The author does not attach a packaged zip, so there are no download counts to report.