REST API - GravityKit/GravityView GitHub Wiki
GravityView 2.0 rolls out a new simple but powerful REST API that allows read-only access to Views and Entries.
There are 4 endpoints in the /wp-json/gravityview/v1/
namespace:
/views
Returns a list of all the views available to the current user along with the needed fields to render their layouts and some additional information. Form/View administrators can access the connected form, View settings, etc.
/views/$id
Same as /views
but for one specific View.
/views/$id/entries.json
Returns all the entries under the select View. Available in .json
and .html
format (template used will be the current View template, but can be overridden as needed under a REST context). Only directory-mode entry fields will be included. Extra fields can be added via the gravityview/rest/entry/fields
filter.
The structure returned is quite simple - a key-value object with ID -> value.
/views/$id/entries/$id.json
The same as entries.json
, but only single-mode entry fields will be included. The same filter gravityview/rest/entry/fields
can be used to alter this behavior.
.html
format instead of .json
will return HTML code instead. Useful for lazy-loading pagination, etc.