This project is based on Nasa's Mars24 Sunclock. It provides a simple interface for converting UTC to Mars Sol Date and Martian Coordinated Time (MTC).
You need to have Docker and Docker compose in stalled on your local machine in order to try this project.
- Clone this repo
cd
to the cloned repository- Run
docker-compose up
- Run
docker exec -it app composer install
After running docker-compose up
, you can start sending requests. I tried to
make the interface as simple as possible, thus, POST verb was used instead of GET
to send the date string to be converted. The requests must be sent to
http://localhost/api/v1/mars/convert
.
The POST data must contain only one field called date
, filled with a string
representing the date you want to convert. Any other fields, if present, will
be ignored. The json must be formatted as follows:
{
"date": "Tuesday, 9 June 2020, 13:01:16 CEST"
}
curl --location --request POST 'http://localhost:8080/api/v1/mars/convert' \
--header 'Content-Type: application/json' \
--data-raw '{
"date": "Tuesday, 9 June 2020, 13:01:16 CEST"
}'
There are two possible errors (discounting 50x errors, : D)
Unknown date format
(400), whenDateTime
does not recognize the date stringMissing date field
(400), whendate
field is missing from POST data.