API Documentation - bounswe/bounswe2024group11 GitHub Wiki
API documentation
Swagger documentation: http://138.68.97.90:8000/api/v1/swagger/
Authorization
Since most of the endpoints requires the sender to be authorized for methods, it is better to complete authorization steps before demonstrating any example API call. Steps below explains the authorization process inside the swagger page.
- Get the Access Token: Initially, /auth/login/ endpoint should be envoked with post request including the
usernameandpasswordin the body. A sample registered user will be used for demonstration in order to skip the registration process.

- You can see the "access" token highlighted above in the JSON response body.
- By clicking onto the Authorize button in the beginning of the page, on right, this access token can be used for authorization. In the textbox opening up,
Bearer <access_token>should be given as input.

- This window can be closed and all endpoints require authorization can be tried inside the Swagger Page.
Example API Call From Swagger
- After sending a get request to
/api/v1/forum-questionsendpoint, all of the forum questions are displayed. Answering feature for the forum question withid=3is demonstrated below. - Get the forum question with
id=3with sending GET request to/api/v1/forum-questions/3/.
- Write an example answer for the question in the POST request JSON body to the endpoint
/api/v1/forum-questions/3/answer/. - Notice that
answerendpoint is nested in the URL and theidof the forum-question should be provided in the URL aspk, stands for primary key.
- Response returned from the endpoint after the POST request sent.

- Newly created answer now can be seen by sending GET request to the same endpoint,
/api/v1/forum-questions/3/.
Body Examples
In order to view request body examples, click on the Example Value button indicated with red arrow.
In order to view response body and response code examples, click on Example Value button:
