-
APIv2 for Developers
The Vanilla APIv2 Vanilla’s APIv2 offers a powerful, yet simple way of creating RESTful API endpoints in your application. With version 2 of the API we consider Vanilla to be an “API first” framework where you write your API first and then think about the resulting HTML. This offers several benefits: An API is easier to…
-
Documenting Endpoints
All available API v2 endpoints must appear on the API v2 page in the Vanilla dashboard. Addons augmenting Vanilla’s API v2 capabilities must include valid OpenAPI v3 documentation to describe those changes. You should write your endpoint's OpenAPI specification before you write the endpoint itself. This would also be a…
-
Writing API Endpoints
Controller Endpoints When writing an API controller class, each method represents an endpoint. How to define those endpoint names and parameters is covered in the resource routing guide. This guide concerns writing the contents of a method. The Controller Base Class Although controllers don’t need to inherit from any…
-
Resource Routing
RESTful Resource Routing to Controller Methods This section tells you how to name your controller objects and methods so that they can be accessed by API requests. By default, all of your controllers are accessed from the /api/v2/ base path. After that, the rest of the path and the HTTP method determines what method gets…
-
Authenticating API Calls
When making calls to the API you’ll need to pass an access token in order to authenticate as a user. Vanilla has core support for access tokens, with the following features: Access tokens can be issued, verified, and revoked with the AccessTokenModel An access token submitted in the Authorization header will authenticate…
-
Unified Record Format
For the sake of consistency and ease of consuming its endpoints, usage of common field names is recommended. Common Fields name: A title for the resource (e.g. a discussion’s title). body: The primary text content of a resource (e.g. a comment’s text). format: Field specifying what format body is in. insertUserID: Unique…