REST API or RESTful API
b2evolution’s REST API will allow to query, add, modify and delete Posts, Comments, Users and other objects of a b2evolution installation through the HTTP protocol (notably the GET / PUT / POST / DELETE methods).
Responses are returned in JSON format.
The first version supports:
General Error Codes
|Error code||HTTP response||Message|
|wrong_route||404||Module is not defined|
|unknown_module||404||Unknown module "<requested_module_name>"|
Note: some of the common error messages are translated to the user locale.
Micro Troubleshooting FAQ
100% of users who said "It doesn’t work, I have a 404 error." have not properly set up or updated their .htaccess File.
If you have an urgent need for additional end-points or methods, please let us know in the comments below or in the forums: http://forums.b2evolution.net/b2evolution-rest-api
- GET /api/v1/collections This lists the collections depending on their Show in Front-office list setting. Response is an array of Collections having each the following properties: Collection properties Name Type Description id integer Collection…
- GET|POST /api/v1/collections//posts? This is the API equivalent of disp = posts. See: URL Parameters. Note: It doesn’t support param types, because it keeps only content post types, and excludes pages, intros, sidebar…
- GET|POST /api/v1/collections//items? See: URL Parameters.
- GET /api/v1/collections//posts/ This is the API equivalent of disp = single. Post properties in the Response Name Type Description id integer Post ID datestart datetime Date of start publishing urltitle string Slug type string…
- GET /api/v1/collections//items/ This is the equivalent of API end-point "Retrieve a Post" to get an item with any type.
- GET /api/v1/collections//search/ This is the API equivalent of disp = search. Possible request params Name Type Description Default page integer Page number 1 per_page integer Count pages per page 10 kind string…
- GET /api/v1/users This lists the users as API equivalent of disp = users. Response is an array of the following properties: Name Type Description found integer Number of found users page integer Current page page_size integer Number users per…
- GET /api/v1/users/ This is the API equivalent of disp = user.
- POST /api/v1/users This is API end-point to create a user like admins/moderators can do this from back-office Creating a New User
- POST /api/v1/users/ This is API end-point to update a user like admins/moderators can do this from back-office Editing an User Account.
- DELETE /api/v1/users/ This is API end-point to delete a user like admins/moderators can do this from back-office Users.
- When you make a REST API call from one webserver to another, you may add HTTP username (or email address) and passwords to your RESTful HTTP requests. b2evolution will check the provided username (or email address) and password to allow privileges on…
- If you are already logged in to b2evolution in a web browser, you will have a session cookie and you can use this cookie to obtain privileges when calling the REST API. This is particularly useful when you use the REST API in a browser, for example in a…