This a Spring Boot REST API web service that is used for the Fluent English web applications.
- Java and Spring Boot using Maven
- Postman for API tests.
- Unit test in java, using Junit5 and Mockito
- CI and unit test with Github Actions
Intregation test for API using Postman. Copy this link of the collection and run it on Postman.
GET /vocabularies
Returns a list of vocabularies.
Optional query parameters:
- category: phrasal-verb
GET /vocabularies/:vocabularyId
Retrieve detailed information about a vocabulary.
POST /users/:userId/vocabularies
Allows you to submit a new vocabulary. Requires authentication.
The request body needs to be in JSON format and include the following properties:
name
- String - Requireddefinition
- String - Requiredfavorite
- Boolean - Optional
Example
POST /users/:userId/vocabularies
Authorization: Bearer <YOUR TOKEN>
{
"name": Hello,
"definition": "Greeting"
"favorite": "true"
}
The response body will contain the vocabulary with Id.
GET /users/:userId/vocabularies
Allows you to view all vocabularies. Requires authentication.
Optional query parameters:
- category: phrasal-verb
- favorite: true or false
GET /users/:userId/vocabularies/:vocabularyId
Allows you to view an existing vocabulary. Requires authentication.
PUT /users/:userId/vocabularies/:vocabularyId
Update an existing vocabulary. Requires authentication.
The request body needs to be in JSON format and allows you to update the following properties:
name
- String - Requireddefinition
- String - Requiredfavorite
- Boolean - Optional
Example
PUT /users/12/vocabularies/123
Authorization: Bearer <YOUR TOKEN>
{
"name": Hello,
"definition": "Greeting"
"favorite": "true"
}
DELETE /users/:userId/vocabularies/:vocabularyId
Delete an existing vocabulary. Requires authentication.
The request body needs to be empty.
Example
DELETE /users/12/vocabularies/123
Authorization: Bearer <YOUR TOKEN>
To submit or view your vocabulary, you need to register your API client.
POST /users/register
The request body needs to be in JSON format and include the following properties:
name
- Stringemail
- String
Example
{
"name": "Example Name",
"email": "Example@example.com"
}
The response body will contain the access token and your user ID.
Example
{
"accessToken": "OqumAgRkiCAOu8T6iziz",
"id": "22"
}