External API calls
Using the API client
The Gadget API client package is a powerful tool that allows your external frontend to communicate with the Gadget backend. It is auto-generated based on the models you create in your application. This API is publicly accessible and supports reading and writing groups of related records. It also includes permission controls and allows for custom problem-specific endpoints.
You only need to install the API client package if you choose not to use the Gadget hosted frontend
Gadget provides an API client package that supports both Javascript and Typescript. Import the client, use it in browser and/or server-side JavaScript environments like node.js.
The API uses GraphQL over HTTPS, supporting various client options, including Gadget's JavaScript client for automatic authentication.
Raw requests to the GraphQL endpoint
openai-screenwriter-tutorial-v2 uses GraphQL as a high performance API query language. GraphQL gives developers a straightforward way of asking for specific data from the API across the whole graph of related models for an application.
You can interact with the GraphQL API through various methods other than using the API client if you prefer to do so, including utilizing the fetch function for direct API access, making requests from the command line using cURL, and more.
It's important to note that while you can make raw reads and writes, Gadget generally recommends client-side data access for your applications. This is because client-side data access is faster for the user, as their browser isn't making extra requests to a server-side process that then makes requests to a Gadget API.