FORMAT: 1A HOST: [your-site]/rest
The REST API plugin by FutureActivities provides easy to use API endpoints for any Craft 3 installation. No configuration required, just enable the plugin and the endpoints are immediately available.
You can optionally exclude certain fields and sections from the API to avoid exposing data.
Get a collection of entries.
-
Parameters
- filter (array) - Optional filter results by fields. Supports any value you can do with an element query
- perpage (number) - The number of entries to return per page
- page (number) - The current pages
- search (string) - Optional search data as defined in the Craft CMS documentation
-
Response 200 (application/json)
-
Headers
X-Pagination-Total-Count: XX X-Pagination-Page-Count: XX X-Pagination-Current-Page: X X-Pagination-Per-Page: X
-
Body
[ { id: 0, title: 'Lorem Ipsum', slug: 'lorem-ipsum', postDate: '2018-12-25 00:00:00', parentId: false, descendants: [], fields: [ 'your-custom-field': '123' ] } ]
-
Get a specific entry.
-
Parameters
- expand (string) - Comma separated list of Element fields to expand. If not set, element IDs are returned in the response.
-
Response 200 (application/json)
-
Body
{ id: 0, title: 'Lorem Ipsum', slug: 'lorem-ipsum', postDate: '2018-12-25 00:00:00', parentId: false, descendants: [], fields: [ 'your-custom-field': '123' ] }
-
Get a collection of categories.
-
Parameters
- filter (array) - Optional filter results by fields. Supports any value you can do with an element query
- perpage (number) - The number of entries to return per page
- page (number) - The current pages
- search (string) - Optional search data as defined in the Craft CMS documentation
-
Response 200 (application/json)
-
Body
[ { id: 0, title: 'Lorem Ipsum', slug: 'lorem-ipsum', parentId: false, descendants: [], fields: [ 'your-custom-field': '123' ] } ]
-
Get a specific category.
-
Parameters
- expand (string) - Comma separated list of Element fields to expand. If not set, element IDs are returned in the response.
-
Response 200 (application/json)
-
Body
{ id: 0, title: 'Lorem Ipsum', slug: 'lorem-ipsum', parentId: false, descendants: [], fields: [ 'your-custom-field': '123' ] }
-
Get a collection of globals.
-
Parameters
- perpage (number) - The number of entries to return per page
- page (number) - The current pages
- search (string) - Optional search data as defined in the Craft CMS documentation
-
Response 200 (application/json)
-
Headers
X-Pagination-Total-Count: XX X-Pagination-Page-Count: XX X-Pagination-Current-Page: X X-Pagination-Per-Page: X
-
Body
[ { id: 0, title: 'Lorem Ipsum', slug: 'lorem-ipsum', parentId: false, descendants: [], fields: [ 'your-custom-field': '123' ] } ]
-
Get a specific global.
-
Parameters
- expand (string) - Comma separated list of Element fields to expand. If not set, element IDs are returned in the response.
-
Response 200 (application/json)
-
Body
{ id: 0, title: 'Lorem Ipsum', slug: 'lorem-ipsum', parentId: false, descendants: [], fields: [ 'your-custom-field': '123' ] }
-
Get a collection of assets.
-
Response 200 (application/json)
-
Body
[ { id: 0, title: 'An Image', slug: 'an-image', fields: [ 'your-custom-field': '123' ], url: 'XXX' } ]
-
Get a specific tag.
-
Parameters
- expand (string) - Comma separated list of Element fields to expand. If not set, element IDs are returned in the response.
- imageTransform (string) - A Craft image transform handle to apply.
-
Response 200 (application/json)
-
Body
{ id: 0, title: 'An Image', slug: 'an-image', fields: [ 'your-custom-field': '123' ], url: 'XXX' }
-
Get a collection of tags.
-
Response 200 (application/json)
-
Body
{ }
-
Get a specific tag.
-
Parameters
- expand (string) - Comma separated list of Element fields to expand. If not set, element IDs are returned in the response.
-
Response 200 (application/json)
-
Body
{ id: 0, title: 'Lorem Ipsum', slug: 'lorem-ipsum', fields: [ 'your-custom-field': '123' ] }
-
Login a user and generate an access token.
-
Attributes
- username (string) - The username or email of the Craft user
- password (string) - The users password
-
Request (application/x-www-form-urlencoded)
-
Response 200 (application/json)
-
Body
{ "token": "[token]" }
-
Verify authentication token is valid.
-
Attributes
- verifyToken (string) - The user authentication token
-
Request (application/x-www-form-urlencoded)
-
Response 200 (application/json)
-
Body
{ true }
-
Get a list of users.
-
Request
-
Headers
Authorization: "Bearer [token]"
-
-
Response 200 (application/json)
-
Body
[ { "username": "user", "photoId": null, "firstName": "First", "lastName": "Last", "email": "user@example.com", "lastLoginDate": "2018-12-04T01:52:52-08:00", "invalidLoginCount": null, "lastInvalidLoginDate": null, ... }, { ... }, ... ]
-
Create a new user.
-
Request (application/x-www-form-urlencoded)
-
Body
{ "customer": { "firstName": "", "lastName": "", "email": "", ... }, "password": "" }
-
-
Response 200 (application/json)
-
Body
{ "success": true }
-
Get details about the current user.
-
Response 200 (application/json)
-
Body
{ "username": "user", "photoId": null, "firstName": "First", "lastName": "Last", "email": "user@example.com", "lastLoginDate": "2018-12-04T01:52:52-08:00", "invalidLoginCount": null, "lastInvalidLoginDate": null, ... }
-
Get a users account.
-
Request (application/json)
-
Headers
Authorization: "Bearer [token]"
-
-
Response 200 (application/json)
-
Body
{ "username": "user", "photoId": null, "firstName": "First", "lastName": "Last", "email": "user@example.com", "lastLoginDate": "2018-12-04T01:52:52-08:00", "invalidLoginCount": null, "lastInvalidLoginDate": null, ... }
-
Update a users account.
-
Request (application/json)
-
Headers
Authorization: "Bearer [token]"
-
Body
{ "customer": { "firstName": "", "lastName": "", "email": "" }, "password": "" }
-
-
Response 200 (application/json)
-
Body
{ "success": true }
-
Generate the password reset link.
-
Request (application/x-www-form-urlencoded)
-
Body
{ "username": "admin" }
-
-
Response 200 (application/json)
-
Body
{ true }
-
Reset the user password
-
Request (application/x-www-form-urlencoded)
-
Body
{ "code": "LJ0FcBCNKcuMd-2WgCrIz213nF4PFASD", "id": "dfd449f8-89ee-43d5-9c9a-347a6cdc7632", "newPassword": "new-password-123" }
-
-
Response 200 (application/json)
-
Body
{ true }
-
Returns a URIs associated element type and ID.
-
Response 200 (application/json)
-
Body
{ "id": 0 "type": "entry", "handle": "blog" }
-
This plugin will automatically support multi-sites.