Sign inSign up

abdennour/dummy-rest-api-example

By abdennour

•Updated about 5 years ago

Lightweight REST API for Demos - 12MB Only !!

Image
0

2.6K

abdennour/dummy-rest-api-example repository overview

⁠Dummy Rest API Example

Simple REST API service for mentees to practice API testing. The image is the build of

⁠Usage

 docker run  -d -p 8080:8080 -e  ADMIN_PASSWORD=pass123 abdennour/dummy-rest-api-example

Then check API Docs under: http://localhost:8080/coasters⁠

⁠API Docs

⁠Requirements

To be able to show the desired features of curl this REST API must match a few requirements:

  • GET /coasters returns list of coasters as JSON
  • GET /coasters/{id} returns details of specific coaster as JSON
  • POST /coasters accepts a new coaster to be added
  • POST /coasters returns status 415 if content is not application/json
  • GET /admin requires basic auth
  • GET /coasters/random redirects (Status 302) to a random coaster
⁠Data Types

A coaster object should look like this:

{
  "id": "someid",
  "name": "name of the coaster",
  "inPark": "the amusement park the ride is in",
  "manufacturer": "name of the manufacturer",
  "height": 27,
}

⁠Usage Example

# Add
curl -X POST -d '{"id": "a1234", "name": "name 1234", "inPark": "park 1234", "manufacturer": "man 1234", "height": 12}' http://localhost:8080/coasters -H "content-type: application/json"

# List
curl http://localhost:8080/coasters

⁠Source Code

Build of https://github.com/abdennour/go-rollercoaster-api⁠

Tag summary

Content type

Image

Digest

Size

12.3 MB

Last updated

about 5 years ago

docker pull abdennour/dummy-rest-api-example