hashicorp-demoapp / product-api-go

Products API written in Go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Define API endpoints for packer-plugin-hashicups

sylviamoss opened this issue · comments

commented

The API should have the following functionality for the packer-plugins-hashicups. The packer-plugins-hashicups will be used to teach practitioners how to create new Packer plugins and hack existing providers.

The plugins' main idea is to create customized coffees with different ingredient quantities from the ones available in the "menu". For example a Packer Spiced Latte with 50ml of espresso instead of 40ml.

JWT Token

Any endpoint that needs auth must have this header: Authorization: Bearer <token>. It will be a JWT token containing the user_id, username, and the token expiration date.

Endpoints

POST /coffees - needs auth

  • Request Body: {'id': "", "name": "'', "teaser": "", "description": "" }
  • Returns success message
  • Description:
    • Creates a custom coffee type

POST /coffees/{id:[0-9]+}/ingredients - needs auth

  • Request Body: {"coffee_id": "", "ingredient_id": '"", "quantity": "", "unit": "" }
  • Returns a JWT token
  • Description:
    • Creates a coffee ingredient with a custom quantity