This document provides information on how to use the MCAP API, including available endpoints and how to make requests.
This guide will walk you through setting up Docker to build and run a Docker image for our project.
First, ensure that Docker Desktop is installed on your machine. You can download it from the official Docker website:
Docker Desktop is available for macOS, Windows, and Linux distributions.
Before building the Docker image, ensure that you have an .env
file containing the necessary environment variables. The .env
file should look something like this:
AWS_REGION=your-aws-region
AWS_S3_RUN_BUCKET=your-aws-s3-run-bucket
AWS_ACCESS_KEY=your-aws-access-key
AWS_SECRET_KEY=your-aws-secret-key
To build the Docker image using the .env
file, run the following command:
docker build \
--build-arg AWS_REGION=$(grep AWS_REGION .env | cut -d '=' -f2) \
--build-arg AWS_S3_RUN_BUCKET=$(grep AWS_S3_RUN_BUCKET .env | cut -d '=' -f2) \
--build-arg AWS_ACCESS_KEY=$(grep AWS_ACCESS_KEY .env | cut -d '=' -f2) \
--build-arg AWS_SECRET_KEY=$(grep AWS_SECRET_KEY .env | cut -d '=' -f2) \
-t mockserver-hytech .
This command will:
- Extract environment variables from the
.env
file. - Build a Docker image named
mockserver-hytech
.
Once the image is built, you can run it directly:
docker run -p 8081:8080 mockserver-hytech
You can also save the Docker image as a .tar
file for distribution:
docker save -o mockserver-hytech.tar mockserver-hytech
To load the Docker image from the .tar
file, use:
docker load -i mockserver-hytech.tar
After loading the image, you can run it using the same docker run
command:
docker run -p 8081:8080 mockserver-hytech
This endpoint allows you to retrieve signed URLs for files stored in AWS S3 buckets based on specific query parameters.
URL:
http://localhost:8080/api/v2/mcap/get
Method:
GET
Query Parameters:
location
(string): The location related to the event (e.g.,atlanta
).date
(string): The date of the event inMM/DD/YY
format (e.g.,9/24/24
).notes
(string): Additional notes about the event (e.g.,car ran fast
). Note that spaces should be URL-encoded as%20
.event_type
(string): The type of event (e.g.,endurance
).start_date
(string): Only return events occurring on or after this date, inMM-DD-YYYY
format (e.g.,09-01-2024
).end_date
(string): Only return events occurring on or before this date, inMM-DD-YYYY
format (e.g.,09-30-2024
).
Example Request:
curl -X GET "http://localhost:8080/api/v2/mcap/get?location=atlanta&date=9/24/24¬es=car%20ran%20fast&event_type=endurance"
This returns a json of the signed URLS of the mcap files with matching parameters, sorted by date.
URL:
http://localhost:8080/api/v2/mcap/upload
Method:
POST
Query Parameters:
TBD
(TBD): Lorem ipsum dolor (e.g.,TBD
).
Example Request:
curl -X GET "http://localhost:3000/api/v2/mcap/upload"