This API project is written using Django Rest Framework.
MongoDB is the main database. Additionally, Elasticsearch serves as a query search engine.
Goal? Easily search for the latest news!
Open endpoints require no Authentication.
- Swagger Documentation :
GET /api/v1/
- User Register :
POST /api/v1/user/register/
- User Login :
POST /api/v1/user/login/
Closed endpoints require a valid Token to be included in the header of the
request. A Token can be acquired from the User Login
view above.
Each endpoint displays News information:
- Show all news :
GET /api/v1/news/
- Search news :
GET /api/v1/news/?search=<phrase>
- see all news
http://127.0.0.1:5000/api/v1/news/
- add
search_fields
title and description, see all of the news containing theRobert Lewandowski
phrase
http://127.0.0.1:5000/api/v1/news/?search=Robert%20Lewandowski
- find news containing the
Lewandowski
phrase in their titles
http://127.0.0.1:5000/api/v1/news/?search=title|Lewandowski
- see all of the polish news containing the
Lewandowski
phrase
http://127.0.0.1:5000/api/v1/news/?search=lewandowski&language=pl
Admin endpoints require an admin account and a valid Token included in the header of the
request. A Token can be acquired from the User Login
view above.
Endpoints for News administration (MongoDB):
- Admin news :
GET/POST/DELETE/PATCH/PUT /admin/api/news/