Skip to content

Latest commit

 

History

History
146 lines (112 loc) · 2.63 KB

File metadata and controls

146 lines (112 loc) · 2.63 KB

euri-test-api

Fake Online REST API for Testing and Prototyping

Copyright (c) 2018 - 2021 Euricom nv.

Licensed under the MIT license. v 1.1.0


GraphQL API

Open /graphql to view the graphQL playground


REST API

System

# reset all data
DELETE /api/system

Tasks

POST /api/tasks
{
  "desc": "By some beer"
}

PATCH /api/tasks
{
  "completed": true
}

DELETE /api/tasks/122

Users

POST /api/users
{
  "firstName": "peter",
  "lastName": "cosemans",
  "age": 52,
  "email": "peter.cosemans@gmail.com",
  "role": "admin"
}

PUT /api/users/12
{
  "firstName": "peter",
  "lastName": "cosemans",
  "age": 52,
  "email": "peter.cosemans@gmail.com",
  "role": "admin"
}

DELETE /api/users/12

Products

# create a new product
POST /api/products
{
  "title": "my new product",
  "price": 9.99,
  "stocked": true,
  "desc": "just some text",
  "image": "https://dummyimage.com/300x300.jpg"
}

# Update an existing product
PUT /api/products/12
{
  "title": "my new product",
  "price": 9.99,
  "stocked": true,
  "desc": "just some text",
  "image": "https://dummyimage.com/300x300.jpg"
}

# Remove the product
DELETE /api/products/12

Basket

# Get the basket with key
# If there are more the 5 items in the basket the request will throw an internal server error
GET /api/basket/{yourKey}
# Add product to basket
# If the product already exist in the basket the quantity is added
# Product not found: 404 error
# Product not in stock: 409 error

POST /api/basket/{yourKey}/product/1
{
  "quantity": 2
}

# Update quantity for product
# When quantity is '0' the product is removed
# When the product is not available in the basket the product is added
# Product not found: 404 error
# Product not in stock: 409 error

PATCH /api/basket/{yourKey}/product/1
{
  "quantity": 10
}

# Empty the basket
DELETE /api/basket/{yourKey}

# Remove the product from the basket
DELETE /api/basket/{yourKey}/product/46