Skip to content

DummyData API provides instant mock data in English, French, and Portuguese. Customizable data size and ID-based retrieval ensure your development environment matches real-world scenarios.

Notifications You must be signed in to change notification settings

marceloxhenrique/DummyData-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DummyData image

DummyData API

JAVA_BADGE SPRING_BOOT THYMELEAF_BADGE JUNIT_BADGE SWAGGER_BADGE DOCKER GITHUBACTIONS

Getting Started - CI/CD Pipeline - API Endpoints - Contribute

DummyData API is a flexible and easy-to-use API designed to provide developers with realistic mock data for testing and prototyping applications. With support for multiple languages (English, French and Portuguese) and customizable data sets, DummyData API helps developers simulate real-world data environments.

🚀 Getting started

Prerequisites

  • Java 17.0.10
  • Maven
  • Git

Cloning

First, clone the repository:

git clone [email protected]:marceloxhenrique/DummyData-API.git

Navigate to the project directory

cd <your-project-name>

Install the project

mvn install

Setup application.properties

spring.application.name=dummydata
spring.datasource.url=jdbc:h2:mem:testdb
spring.datasource.driver-class-name=org.h2.Driver
spring.datasource.username=sa
spring.datasource.password=password
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
spring.messages.basename=messages
spring.messages.encoding=UTF-8
spring.data.web.pageable.max-page-size=999999999

Running the application

The app run on port 8080 by default.

mvn spring-boot:run

📦 CI/CD Pipeline

CI / CD pipeline using GitHub Actions.

Workflows

  • Run Tests on push to Dev branch:

    This workflow is triggered on every push to the dev branch. It runs the tests to ensure that the code is working as expected. The tests are run using JDK 17 and Maven.

  • Deploy App on pull request to Main branch:

    This workflow is triggered when a pull request is made to the main branch. It builds the project using Maven, creates a Docker image, and pushes the image to Docker Hub. Additionally, it triggers the deployment on Render, which deploys the application using the newly built Docker image version.

📍 API Endpoints

List of endpoints availables ​

route description
GET /api/users retrieve 100 users user
GET /api/users/1 retrieve a specific user by id user
GET /api/comments retrieve 100 comments comment
GET /api/comment/1 retrieve a specific comment by id comment
GET /api/images retrieve 100 images image
GET /api/images/1 retrieve a specific image by id image

User

{
  "id": 1,
  "username": "markbradley",
  "firstName": "Mark",
  "lastName": "Bradley",
  "birthDate": "1995-05-15",
  "phone": "+1 202 555 1234",
  "email": "[email protected]",
  "address": {
    "country": "United States of America",
    "state": "California",
    "city": "Los Angeles",
    "street": "123 Elm Street",
    "postalCode": "90001"
  },
  "role": "User"
} ... more 99 users

Comment

{
  "id": 1,
  "userId": 1,
  "title": "Great Team Meeting!",
  "body": "I really enjoyed our team meeting today. The new project ideas were fantastic, and I appreciate everyone's input.",
  "createdAt": "2024-09-01T10:45:23"
} ... more 99 comments

Image

{
  "id": 1,
  "userId": 1,
  "url": "https://picsum.photos/900",
  "width": 900,
  "height": 900,
  "title": "Captured Moment"
} ... more 99 images

You can customize your requests using the following parameters:

Size: Use the size parameter to specify the number of records you want to retrieve, ranging from 1 to 100.

Lang: Use the lang parameter to choose the language of the data:

  • en - for English
  • fr - for French
  • pt - for Portuguese (Brazilian)

Example:

route description
GET /api/users?size=2 retrieve 2 users user
GET /api/users?lang=fr retrieve 100 users in French user
GET /api/users?lang=fr&size=2 retrieve 2 users in French comment

2 Users

[
  {
    "id": 1,
    "username": "markbradley",
    "firstName": "Mark",
    "lastName": "Bradley",
    "birthDate": "1995-05-15",
    "phone": "+1 202 555 1234",
    "email": "[email protected]",
    "address": {
      "country": "United States of America",
      "state": "California",
      "city": "Los Angeles",
      "street": "123 Elm Street",
      "postalCode": "90001"
    },
    "role": "User"
  },
  {
    "id": 2,
    "username": "janefoster",
    "firstName": "Jane",
    "lastName": "Foster",
    "birthDate": "1991-08-22",
    "phone": "+1 305 555 5678",
    "email": "[email protected]",
    "address": {
      "country": "United States of America",
      "state": "Florida",
      "city": "Miami",
      "street": "456 Maple Avenue",
      "postalCode": "33101"
    },
    "role": "Admin"
  }
]

100 Users in French

{
    "id": 1,
    "username": "jeandupont",
    "firstName": "Jean",
    "lastName": "Dupont",
    "birthDate": "1995-05-15",
    "phone": "+33 1 23 45 67 89",
    "email": "[email protected]",
    "address": {
      "country": "France",
      "state": "Île-de-France",
      "city": "Paris",
      "street": "123 Rue de la Paix",
      "postalCode": "75001"
    },
    "role": "Utilisateur"
  } ... more 99 users in French

2 Users in French

[
  {
    "id": 1,
    "username": "jeandupont",
    "firstName": "Jean",
    "lastName": "Dupont",
    "birthDate": "1995-05-15",
    "phone": "+33 1 23 45 67 89",
    "email": "[email protected]",
    "address": {
      "country": "France",
      "state": "Île-de-France",
      "city": "Paris",
      "street": "123 Rue de la Paix",
      "postalCode": "75001"
    },
    "role": "Utilisateur"
  },
  {
    "id": 2,
    "username": "mariedurand",
    "firstName": "Marie",
    "lastName": "Durand",
    "birthDate": "1991-08-22",
    "phone": "+33 4 56 78 90 12",
    "email": "[email protected]",
    "address": {
      "country": "France",
      "state": "Provence-Alpes-Côte d'Azur",
      "city": "Marseille",
      "street": "456 Avenue du Prado",
      "postalCode": "13008"
    },
    "role": "Administrateur"
  }
]

📫 Contribute

If you want to contribute, clone this repo, create your work branch and get your hands dirty!

  1. git clone [email protected]:marceloxhenrique/DummyData-API.git
  2. git checkout -b feature/NAME
  3. Follow commit patterns

  4. Open a Pull Request explaining the problem solved or feature made, if exists, append screenshot of visual modifications and wait for the review!

📄 API documentation

http://localhost:8080/swagger-ui/index.html
DummyData_API_Documentation_Image

About

DummyData API provides instant mock data in English, French, and Portuguese. Customizable data size and ID-based retrieval ensure your development environment matches real-world scenarios.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published