title | language_tabs | language_clients | toc_footers | includes | search | highlight_theme | headingLevel | ||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
bartender v1.0.0 |
|
|
true |
atom-one-dark |
2 |
Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.
API that keeps track of products
Base URLs:
Email: Thomas van de Weerd License: GNU General Public License v3.0 or later
- HTTP Authentication, scheme: bearer
API Health
Code samples
GET /health
Get whether or not the API is currently healthy
Example responses
OK
{
"healthy": true,
"checks": {
"memory": {
"status": "up",
"used": 300,
"max": 512
},
"response-time": {
"50": 7,
"90": 12,
"95": 14,
"average": 8
}
},
"dependencies": {
"database": {
"name": "Postgre",
"healthy": true,
"latency": 3
},
"external-api": {
"name": "Some API",
"healthy": true,
"latency": 20
}
}
}
Service Unavailable
{
"healthy": true,
"checks": {
"memory": {
"status": "up",
"used": 300,
"max": 512
},
"response-time": {
"50": 7,
"90": 12,
"95": 14,
"average": 8
}
},
"dependencies": {
"database": {
"name": "Postgre",
"healthy": true,
"latency": 3
},
"external-api": {
"name": "Some API",
"healthy": true,
"latency": 20
}
}
}
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | Health |
503 | Service Unavailable | Service Unavailable | Health |
Code samples
GET /health/ready
A basic ping-pong to check if the server is able to receive requests and respond to them
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | None |
Handles products
Code samples
GET /product/{gtin}
Checks if the GTIN exists in the database, returns the matching product if it does, otherwise returns a 404 Not Found
Name | In | Type | Required | Description |
---|---|---|---|---|
gtin | path | string | true | GTIN of the product we want to request |
Example responses
Found product by GTIN
{
"gtin": "8716700027200",
"name": "Grolsch Pilsener krat",
"description": "Grolsch Premium pilsner is vol van smaak met een aangename bitterheid en een rijke afdronk. Het wordt gebrouwen met twee soorten hop. Dit geeft Grolsch Premium pilsner haar unieke karakter.",
"category": "beer",
"images": [
{
"height": 800,
"width": 800,
"url": "https://static.ah.nl/dam/product/AHI_43545239383734363237?revLabel=1&rendition=800x800_JPG_Q90&fileType=binary"
}
],
"brand": "Grolsch",
"quantity": {
"value": 300,
"unit": "ml",
"amount": 24,
"total": 7200
},
"attributes": {
"alcohol_percentage": 5,
"contains_alcohol": true,
"": "string"
}
}
Could not find product by GTIN
{
"code": 404,
"message": "Was not able to find product for GTIN 8716700027200"
}
Unexpected error
{
"code": 500,
"message": "Something went wrong"
}
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Found product by GTIN | Product |
404 | Not Found | Could not find product by GTIN | Error |
default | Default | Unexpected error | Error |
Code samples
PATCH /product/{gtin}
Change some data about a product
Body parameter
{
"gtin": "8716700027200",
"name": "Grolsch Pilsener krat",
"description": "Grolsch Premium pilsner is vol van smaak met een aangename bitterheid en een rijke afdronk. Het wordt gebrouwen met twee soorten hop. Dit geeft Grolsch Premium pilsner haar unieke karakter.",
"category": "beer",
"images": [
{
"height": 800,
"width": 800,
"url": "https://static.ah.nl/dam/product/AHI_43545239383734363237?revLabel=1&rendition=800x800_JPG_Q90&fileType=binary"
}
],
"brand": "Grolsch",
"quantity": {
"value": 300,
"unit": "ml",
"amount": 24,
"total": 7200
},
"attributes": {
"alcohol_percentage": 5,
"contains_alcohol": true,
"": "string"
}
}
Name | In | Type | Required | Description |
---|---|---|---|---|
gtin | path | string | true | GTIN of the product we want to request |
body | body | ProductProperties | false | none |
Example responses
OK
{
"gtin": "8716700027200",
"name": "Grolsch Pilsener krat",
"description": "Grolsch Premium pilsner is vol van smaak met een aangename bitterheid en een rijke afdronk. Het wordt gebrouwen met twee soorten hop. Dit geeft Grolsch Premium pilsner haar unieke karakter.",
"category": "beer",
"images": [
{
"height": 800,
"width": 800,
"url": "https://static.ah.nl/dam/product/AHI_43545239383734363237?revLabel=1&rendition=800x800_JPG_Q90&fileType=binary"
}
],
"brand": "Grolsch",
"quantity": {
"value": 300,
"unit": "ml",
"amount": 24,
"total": 7200
},
"attributes": {
"alcohol_percentage": 5,
"contains_alcohol": true,
"": "string"
}
}
Not Found
{
"code": 404,
"message": "Could not find product with GTIN 8716700027200"
}
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | Product |
404 | Not Found | Not Found | Error |
Code samples
DELETE /product/{gtin}
Remove a product from the database
Name | In | Type | Required | Description |
---|---|---|---|---|
gtin | path | string | true | GTIN of the product we want to request |
Status | Meaning | Description | Schema |
---|---|---|---|
204 | No Content | No Content | None |
Code samples
POST /product/search
Tries to find the product matching all the data you give. Will start by checking GTIN, then validating the rest of the data that should not change like quantity. In case it can not find it by GTIN, it will try to find a very close match by using the name and quantity. This match needs to be above a certain treshold for it to be returned.
Body parameter
{
"gtin": "8716700027200",
"name": "Grolsch Pilsener krat",
"description": "Grolsch Premium pilsner is vol van smaak met een aangename bitterheid en een rijke afdronk. Het wordt gebrouwen met twee soorten hop. Dit geeft Grolsch Premium pilsner haar unieke karakter.",
"category": "beer",
"images": [
{
"height": 800,
"width": 800,
"url": "https://static.ah.nl/dam/product/AHI_43545239383734363237?revLabel=1&rendition=800x800_JPG_Q90&fileType=binary"
}
],
"brand": "Grolsch",
"quantity": {
"value": 300,
"unit": "ml",
"amount": 24,
"total": 7200
},
"attributes": {
"alcohol_percentage": 5,
"contains_alcohol": true,
"": "string"
}
}
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | ProductProperties | false | The partial data you have about the item you want to find. |
Example responses
Not Found
{
"code": 404,
"message": "Was not able to find a matching product"
}
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | Inline |
404 | Not Found | Not Found | Error |
Status Code 200
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
anonymous | [allOf] | false | none | none |
allOf
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
» anonymous | ProductProperties | false | none | none |
»» gtin | string | false | none | none |
»» name | string | false | none | none |
»» description | string | false | none | none |
»» category | string | false | none | none |
»» brand | string | false | none | none |
»» images | [Image] | false | none | none |
»»» height | integer(int32) | true | none | none |
»»» width | integer(int32) | true | none | none |
»»» url | string | true | none | none |
»» quantity | ProductQuantity | false | none | none |
»»» value | integer(int64) | true | none | none |
»»» unit | string | true | none | none |
»»» amount | integer(int64) | true | none | none |
»»» total | integer(int64) | true | none | none |
»» attributes | ProductAttributes | false | none | none |
»»» anonymous | string | false | none | none |
and
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
» anonymous | ProductRequiredProperties | false | none | none |
Code samples
GET /product
Get all products stored in the database
Example responses
OK
[
{
"gtin": "8716700027200",
"name": "Grolsch Pilsener krat",
"description": "Grolsch Premium pilsner is vol van smaak met een aangename bitterheid en een rijke afdronk. Het wordt gebrouwen met twee soorten hop. Dit geeft Grolsch Premium pilsner haar unieke karakter.",
"category": "beer",
"images": [
{
"height": 800,
"width": 800,
"url": "https://static.ah.nl/dam/product/AHI_43545239383734363237?revLabel=1&rendition=800x800_JPG_Q90&fileType=binary"
}
],
"brand": "Grolsch",
"quantity": {
"value": 300,
"unit": "ml",
"amount": 24,
"total": 7200
},
"attributes": {
"alcohol_percentage": 5,
"contains_alcohol": true,
"": "string"
}
}
]
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | Inline |
Status Code 200
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
anonymous | [allOf] | false | none | none |
allOf
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
» anonymous | ProductProperties | false | none | none |
»» gtin | string | false | none | none |
»» name | string | false | none | none |
»» description | string | false | none | none |
»» category | string | false | none | none |
»» brand | string | false | none | none |
»» images | [Image] | false | none | none |
»»» height | integer(int32) | true | none | none |
»»» width | integer(int32) | true | none | none |
»»» url | string | true | none | none |
»» quantity | ProductQuantity | false | none | none |
»»» value | integer(int64) | true | none | none |
»»» unit | string | true | none | none |
»»» amount | integer(int64) | true | none | none |
»»» total | integer(int64) | true | none | none |
»» attributes | ProductAttributes | false | none | none |
»»» anonymous | string | false | none | none |
and
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
» anonymous | ProductRequiredProperties | false | none | none |
Code samples
POST /product
Add a product to the database
Body parameter
{
"gtin": "8716700027200",
"name": "Grolsch Pilsener krat",
"description": "Grolsch Premium pilsner is vol van smaak met een aangename bitterheid en een rijke afdronk. Het wordt gebrouwen met twee soorten hop. Dit geeft Grolsch Premium pilsner haar unieke karakter.",
"category": "beer",
"images": [
{
"height": 800,
"width": 800,
"url": "https://static.ah.nl/dam/product/AHI_43545239383734363237?revLabel=1&rendition=800x800_JPG_Q90&fileType=binary"
}
],
"brand": "Grolsch",
"quantity": {
"value": 300,
"unit": "ml",
"amount": 24,
"total": 7200
},
"attributes": {
"alcohol_percentage": 5,
"contains_alcohol": true,
"": "string"
}
}
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | Product | false | none |
Example responses
OK
{
"gtin": "8716700027200",
"name": "Grolsch Pilsener krat",
"description": "Grolsch Premium pilsner is vol van smaak met een aangename bitterheid en een rijke afdronk. Het wordt gebrouwen met twee soorten hop. Dit geeft Grolsch Premium pilsner haar unieke karakter.",
"category": "beer",
"images": [
{
"height": 800,
"width": 800,
"url": "https://static.ah.nl/dam/product/AHI_43545239383734363237?revLabel=1&rendition=800x800_JPG_Q90&fileType=binary"
}
],
"brand": "Grolsch",
"quantity": {
"value": 300,
"unit": "ml",
"amount": 24,
"total": 7200
},
"attributes": {
"alcohol_percentage": 5,
"contains_alcohol": true,
"": "string"
}
}
Already exists
{
"code": 409,
"message": "Resource already exists"
}
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK | Product |
409 | Conflict | Already exists | Error |
{
"gtin": "8716700027200",
"name": "Grolsch Pilsener krat",
"description": "Grolsch Premium pilsner is vol van smaak met een aangename bitterheid en een rijke afdronk. Het wordt gebrouwen met twee soorten hop. Dit geeft Grolsch Premium pilsner haar unieke karakter.",
"category": "beer",
"images": [
{
"height": 800,
"width": 800,
"url": "https://static.ah.nl/dam/product/AHI_43545239383734363237?revLabel=1&rendition=800x800_JPG_Q90&fileType=binary"
}
],
"brand": "Grolsch",
"quantity": {
"value": 300,
"unit": "ml",
"amount": 24,
"total": 7200
},
"attributes": {
"alcohol_percentage": 5,
"contains_alcohol": true,
"": "string"
}
}
allOf
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
anonymous | ProductProperties | false | none | none |
and
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
anonymous | ProductRequiredProperties | false | none | none |
{
"gtin": "8716700027200",
"name": "Grolsch Pilsener krat",
"description": "Grolsch Premium pilsner is vol van smaak met een aangename bitterheid en een rijke afdronk. Het wordt gebrouwen met twee soorten hop. Dit geeft Grolsch Premium pilsner haar unieke karakter.",
"category": "beer",
"images": [
{
"height": 800,
"width": 800,
"url": "https://static.ah.nl/dam/product/AHI_43545239383734363237?revLabel=1&rendition=800x800_JPG_Q90&fileType=binary"
}
],
"brand": "Grolsch",
"quantity": {
"value": 300,
"unit": "ml",
"amount": 24,
"total": 7200
},
"attributes": {
"alcohol_percentage": 5,
"contains_alcohol": true,
"": "string"
}
}
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
gtin | string | false | none | none |
name | string | false | none | none |
description | string | false | none | none |
category | string | false | none | none |
brand | string | false | none | none |
images | [Image] | false | none | none |
quantity | ProductQuantity | false | none | none |
attributes | ProductAttributes | false | none | none |
{}
None
{
"alcohol_percentage": 5,
"contains_alcohol": true,
"": "string"
}
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
anonymous | string | false | none | none |
{
"value": 300,
"unit": "ml",
"amount": 24,
"total": 7200
}
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
value | integer(int64) | true | none | none |
unit | string | true | none | none |
amount | integer(int64) | true | none | none |
total | integer(int64) | true | none | none |
{
"height": 300,
"width": 200,
"url": "https://picsum.photos/200/300"
}
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
height | integer(int32) | true | none | none |
width | integer(int32) | true | none | none |
url | string | true | none | none |
{
"code": 500,
"message": "Something went wrong"
}
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
code | integer(int32) | true | none | none |
message | string | true | none | none |
{
"healthy": true,
"checks": {
"memory": {
"status": "up",
"used": 300,
"max": 512
},
"response-time": {
"50": 7,
"90": 12,
"95": 14,
"average": 8
}
},
"dependencies": {
"database": {
"name": "Postgre",
"healthy": true,
"latency": 3
}
}
}
The current health of the api
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
healthy | boolean | false | none | none |
checks | object | false | none | none |
» memory | object | false | none | none |
»» status | string | false | none | none |
»» used | integer | false | none | none |
»» max | integer | false | none | none |
» response-time | object | false | none | none |
»» 50 | integer | false | none | none |
»» 90 | integer | false | none | none |
»» 95 | integer | false | none | none |
»» average | integer | false | none | none |
dependencies | object | false | none | none |
» anonymous | HealthDependency | false | none | none |
Property | Value |
---|---|
status | up |
status | partial |
status | down |
{
"name": "string",
"latency": 0,
"healthy": true
}
HealthDependency
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
name | string | true | none | none |
latency | integer | true | none | none |
healthy | boolean | true | none | none |