A MuleSoft API implementation that demonstrates MySQL database integration using Docker containers. This project shows how to build a Todo API with database connectivity in Anypoint Code Builder (ACB).
Important
Before using this project, you'll need to implement the API specification in your own Anypoint Platform organization.
The complete OpenAPI 3.0 specification is available in todo-task-api.yaml
. This project currently references an API specification from a specific organization. To use this project:
- Import the specification - Upload
todo-task-api.yaml
to your Anypoint Exchange - Update the reference - Modify the API reference in
src/main/mule/global.xml
andpom.xml
to point to your organization's API - Configure the project - Update the
api
attribute in theapikit:config
element with your organization's API details
The API specification defines:
- All available endpoints and their operations
- Request/response schemas for Task objects
- Query parameters for filtering tasks
- Error responses and status codes
- ✅ MySQL database running in Docker
- ✅ MuleSoft flows with database operations
- ✅ DataWeave transformations for SQL and JSON
- ✅ RESTful API endpoints
- ✅ VS Code integration with Container Tools and Database Client
- ✅ OpenAPI 3.0 specification
Method | Endpoint | Happy Path | Error Handling | Description |
---|---|---|---|---|
GET | /api/tasks |
✅ | Not Implemented | Get all tasks |
GET | /api/tasks/{taskId} |
✅ | Not Implemented | Get specific task |
POST | /api/tasks |
✅ | Not Implemented | Create new task |
PUT | /api/tasks/{taskId} |
✅ | Not Implemented | Update task |
DELETE | /api/tasks/{taskId} |
✅ | Not Implemented | Delete task |
- VS Code with extensions:
- Docker Desktop
Use the Container Tools extension in VS Code to click "Run All Services" on the docker-compose.yml
file.
version: '3'
services:
db:
image: mysql:latest
environment:
MYSQL_ROOT_PASSWORD: admin
MYSQL_DATABASE: mysqldb
MYSQL_USER: user
MYSQL_PASSWORD: password
ports:
- 3306:3306
volumes:
- db_data:/var/lib/mysql
volumes:
db_data:
Connect to MySQL using the Database Client extension:
- Host:
127.0.0.1
- Port:
3306
- User:
user
- Password:
password
- Database:
mysqldb
Run the SQL script to create the tasks table:
CREATE TABLE tasks(
id int NOT NULL PRIMARY KEY AUTO_INCREMENT,
title VARCHAR(255) NOT NULL,
description VARCHAR(255),
dueDate VARCHAR(255),
completed BOOLEAN NOT NULL
);
Start the Mule application in Anypoint Code Builder.
You can use the attached Postman Collection to run the 5 endpoints: To-Do API.postman_collection.json