REST and GraphQL API
Amplication generates production-ready REST and GraphQL APIs with documentation and playgrounds for all your data models. Easily connect to your data with any HTTP client.
Amplication generates REST APIs that provide a way to interact with your data models. Generated APIs include authentication and authorization and follow strict RESTful conventions. Each generated REST API also comes with sorting, filtering, and pagination features.
The REST API is available at
/api at the root of your application.
Retrieve data in a specific order by applying sorting to your API requests. Sort data based on different fields in your data model.
Learn about sorting REST API requests.
Filter data based on specific criteria by using query parameters in your API requests. Combine multiple filters for more specific results.
Learn about filtering REST API requests.
Paginate API results to manage large datasets and provide a better user experience. Use the
take query parameters to control the number of results per page and the starting point.
Learn about paginating REST API requests.
For development purposes, you can use Swagger UI to execute requests against the API.
When you navigate directly to
/api you will see the swagger documentation of your API with a list of all resources and actions.
First, click on the Authorize button and enter the username and password. It will add the authorization header automatically.
Besides REST APIs, Amplication also generates a GraphQL API as an alternative way to help you interact with your data models. The GraphQL API also support sorting, filtering, pagination, and meta queries.
The GraphQL API is available at
/graphql at the root of your application.
Sort the retrieved data in a specific order by adding sorting arguments to your GraphQL queries. Control the sorting order based on fields defined in your data model.
Learn about sorting GraphQL API requests.
Filter data based on specific criteria by adding filter arguments to your GraphQL queries. Combine multiple filters for more precise results.
Learn about filtering GraphQL API requests.
Implement pagination in your GraphQL queries to handle large datasets and improve the user experience. Use the
take arguments to control the number of results and the starting point.
Learn about paginating GraphQL API requests.
Use meta queries to gather additional information about your data, such as the total number of records or the aggregation of certain fields.
Learn more about meta queries with your GraphQL API requests.
For development purposes, you can use the GraphQL Playground to execute queries and mutations against the API.
When you navigate directly to
/graphql you will see the GraphQL Playground provided by Apollo Server.
First, click on the HTTP HEADERS tab at the bottom of teh screen and add the authorization header in the following format:
"Authorization": "Basic YWRtaW46YWRtaW4="
The GraphQL Playground available at
/graphql is only available for development.
If you want to enable it for production, set the following two flags to true:
Amplication generates authentication mechanisms based on the NestJS/Passport library. It supports various authentication mechanisms like JWT-based authentication and custom authentication with Passport.
Learn more about authorizing your API requests.