Built-in API utilities
ShipWithDjango comes with several pre-built API utilities to help you quickly get started with building and managing APIs. These utilities are designed to handle common tasks such as user authentication, token management, and retrieving user profile information, ensuring that you have a solid foundation for your API from the start.
API Structure
The API functionality in ShipWithDjango is located in the api
folder in the root of your project. This folder contains everything you need to get started with creating and managing API endpoints, including serializers, views, and URLs.
User Authentication and Token Management
ShipWithDjango provides built-in endpoints for user authentication using JSON Web Tokens (JWT). The API includes endpoints that allow users to obtain Bearer tokens and refresh tokens, which are essential for securely managing user sessions in your API.
Token Obtain Pair Endpoint: This endpoint allows users to authenticate and receive a pair of tokens: an access token (Bearer token) and a refresh token. The access token is used for authenticating API requests, while the refresh token is used to obtain a new access token when the old one expires. You can find the endpoint at
/api/token/
Token Refresh Endpoint: This endpoint allows users to refresh their access token using the refresh token. This is crucial for maintaining user sessions without requiring them to re-authenticate frequently. You can find the endpoint at
/api/token/refresh/
User Profile Endpoint
ShipWithDjango also includes an endpoint that allows authenticated users to retrieve their own profile information. This is useful for creating user dashboards, account management pages, or any feature that requires displaying user-specific data.
User Profile Retrieval: The user profile endpoint returns detailed information about the authenticated user, including their email, name, date of registration, and any associated subscription or billing information. This ensures that you can easily access and display the necessary user data in your application.
You can find the endpoint at /users/me/
Last updated