Skip to end of metadata
Go to start of metadata

By default, API Builder generates the following API endpoints for models:

  • GET /api/endpoints/<model_name> : Return all objects (the first 1000 records).
  • GET /api/endpoints/<model_name>/query : Return all objects that satisfy a query.
  • GET /api/endpoints/<model_name>/:id : Return a specific object by id
  • GET /api/endpoints/<model_name>/distinct : Find distinct objects
  • GET /api/endpoints/<model_name>/count : Count objects
  • PUT /api/endpoints/<model_name>/:id : Update a specific user by id
  • PUT /api/endpoints/<model_name>/findAndModify : Find and modify an object
  • POST /api/endpoints/<model_name> : Create a new object
  • POST /api/endpoints/<model_name>/upsert : Create or update an object
  • DELETE /api/endpoints/<model_name>/:id : Delete a specific object by id
  • DELETE /api/endpoints/<model_name> : Delete all objects

To disable API Builder from generating these endpoints, set the Model's autogen property to false when defining the model. You will need to create API Builder APIs to access the model.

Example:

The following model is disabled from generating pre-defined endpoints. An API endpoint needs to be defined to access the model data as shown below. 

modes/employee.js

The example below implements the GET /api/<employee>/:id endpoint that would normally be generated by API Builder.

apis/employeeFindOne.js