Skip to content

BrettskiPy/market-challenge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 

Repository files navigation

produce_image

The Supermarket API

The Supermarket API was designed for grocery store employees to manage and retrieve produce item data. This functionality is achieved through the use of a REST API. The specifications for this project are found here.

Produce item data fields

Data Field Description Data Type Data Sample
name A required case insensitive field that represents the official name of a produce item. string Lettuce
code A required case insensitive, sixteen character, alphanumeric field, with three hyphens between each set of 4 characters. This sequence represents a produce item's unique identification. string A12T-4GH7-QPL9-3N4M
unit_price A required field that represents the total price divided by the total units. float64 3.46

Example produce item in JSON:

{
    "name": "Lettuce",
    "code": "A12T-4GH7-QPL9-3N4M",
    "unit_price": 3.46
}

How do I use the market APIs?

API functionality is achieved by using the endpoints below. It is assumed you have a working connection to the market website or you are targeting the endpoints via an API tool such as postman.

GET

Endpoint Description Sample JSON Output
/produce/{name} Retrieval of a single produce item and its associated data
{
    "name": "Lettuce",
    "code": "A12T-4GH7-QPL9-3N4M",
    "unit_price": 3.46
}
/produce Retrieval of all the produce items and its associated data
[
    {
        "name": "Lettuce",
        "code": "A12T-4GH7-QPL9-3N4M",
        "unit_price": 3.46
    },
    {
        "name": "Peach",
        "code": "E5T6-9UI3-TH15-QR88",
        "unit_price": 2.99
    },
    {
        "name": "Green Pepper",
        "code": "YRT6-72AS-K736-L4AR",
        "unit_price": 0.79
    }
]

POST

Endpoint Description Sample JSON Input
/produce Adds a single produce item and its associated data.
[
    {
        "name": "Key Limes",
        "code": "A12T-4GH7-QPL9-3N4M",
        "unit_price": 3.46
    }
]
/produce Adds multiple produce items and its associated data.
[
    {
        "name": "Lettuce",
        "code": "A12T-4GH7-QPL9-3N4M",
        "unit_price": 3.46
    },
    {
        "name": "Peach",
        "code": "E5T6-9UI3-TH15-QR88",
        "unit_price": 2.99
    }
]

DELETE

Endpoint Description
/produce/{name} Deletes a single produce item and its associated data.

About

Go API interview challenge

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages