Routes that fetch Roper question data, editor preview markup, public expand hits, and dataset catalog associations.
Base path: /wp-json/prc-api/v3/
Sources: src/roper-item/class-roper-item.php and includes/inspector-sidebar-panel/class-inspector-sidebar-panel.php
Auth summary
Item, editor-preview, and expand use permission_callback __return_true (public). Server-side API credentials stay in includes/class-roper-api.php. Expand writes _roper_expand_count only when a survey-question post already exists.
GET /roper/dataset/{id}/questions requires edit_post on that dataset and manage_options.
Route index
| Method | Path | Purpose |
|---|---|---|
GET | /roper/item | Question / response payload for a Roper id |
GET | /roper/editor-preview | Editor preview HTML for a question layout |
POST | /roper/expand | Increment the expand count on the matching catalog post |
GET | /roper/dataset/{id}/questions | Survey questions tagged with the dataset’s datasets term |
Query parameter
Item and editor-preview callbacks read the Roper question identifier from request param id. Expand reads id from the JSON body.
Query parameters
-
idstring required -
Roper question id. Special value roper-results-preview returns sample preview data on the editor-preview route and is ignored on expand.
No fields match this filter.
GET /roper/item
Returns data from request_roper_data( $id ). Without id, responds with a 400 error payload (No id set). This route does not increment expand counts.
GET /roper/editor-preview
Builds editor preview markup for the given id and layout. id=roper-results-preview uses sample question text instead of a live API fetch. This route does not increment expand counts.
POST /roper/expand
Called from the public Roper Item expand button. Resolves the catalog row through Survey_Question_Store::record_expand(). A miss returns 200 with recorded: false and count: 0. It never creates a post.
/wp-json/prc-api/v3/roper/expand
Content-Type application/json{
"id": "f046c1f1-d03f-4ebb-bcd8-aafe44e2e01a"
}
{
"recorded": true,
"count": 1
}GET /roper/dataset/{id}/questions
Editor-only list for Dataset Options. Resolves the related datasets term (Term Data Store, then get_the_terms()). Returns up to 50 published survey-question posts, plus total and all_url for the classic wp-admin list filtered by that term.
/wp-json/prc-api/v3/roper/dataset/123/questions
Accept application/jsonAuthorization Bearer $WP_ACCESS_TOKEN
{
"total": 1,
"all_url": "https://example.com/wp-admin/edit.php?post_type=survey-question&datasets=american-trends-panel-wave-1",
"questions": [
{
"id": 456,
"title": "Do you approve?",
"completeness": "stub",
"edit_url": "https://example.com/wp-admin/post.php?post=456&action=edit"
}
]
}A non-dataset id returns 404. Missing edit_post or manage_options returns 401/403. An unmatched term returns total: 0 and an empty questions array.