- Investigate given code.
- Develop API Endpoint of Campaign / Ad sets / Creatives data
.
├── src # Main source code directory
│ ├── base # Project's settings
│ ├── core # Core models
│ ├── data # Data Application
│ │ ├── data_creation.py # Creating dummy data
│ ├── manage.py
│ ├── db.sqlite3
├── .gitignore
├── README.md # Project Document
├── requirements.txt
- Use the provided SQLite database (db.sqlite3) for development.
- Campaigns contain Ad sets; Ad sets contain Creatives.
- Nested Data API Implementation:
- Update /api/data/campaigns/ which should return a list of campaigns with all nested Adsets & Creatives.
- Update /api/data/adsets/ to return a list of adsets with all nested Creatives.
- Prevent spaming API (Rate limit)
- Implement rate limiting based on IP address for the above endpoints.
- Limit each IP to a maximum of 10 requests per minute to the endpoints.
- Exceeding the limit should return a 429 status code with an appropriate warning message.
- (Optional) Base Authentication Change:
- Change the base authentication field from username to user_id on the base user model.
- Multiple solutions may be valid.
- Share your refactoring ideas.
- nesting api data by modify
serializers.py: referencing related_names in each models - prevent spaming by add
DEFAULT_THROTTLE_CLASSESandDEFAULT_THROTTLE_RATEStosettings.py - target of throtle for only user because each views only allowed authenticated user to access
- set
NUM_PROXIESto notNonefor enable checking xff - create a utils folder to store custom exception handler and create custome message for HTTP_429
- add path to new exception hanler to DRF
EXCEPTION_HANDLER
- nesting api data by modify
- Suggest performance optimization methods: add global pagination for exception handling