Last active
March 29, 2024 19:37
-
-
Save frahugo/21a47b99003e306c88489f35befb98a7 to your computer and use it in GitHub Desktop.
CFB Api
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"openapi": "3.1.0", | |
"info": { | |
"version": "1.0", | |
"title": "api", | |
"summary": "API for bagging machines", | |
"description": "API to use to interact with the Canada First Bricks MOC application. \nThis API is meant to provide data to a bagging machine.", | |
"contact": { | |
"name": "Hugo Frappier", | |
"url": "", | |
"email": "[email protected]" | |
} | |
}, | |
"servers": [ | |
{ | |
"url": "http://localhost:3000/api/v1", | |
"description": "For local development" | |
}, | |
{ | |
"url": "https://api.canadafirstbricks.com/api/v1", | |
"description": "For production use" | |
} | |
], | |
"paths": { | |
"/manifests/{manifest_number}": { | |
"get": { | |
"tags": [ | |
"manifest" | |
], | |
"summary": "Get manifest by number", | |
"description": "Get the manifest for a list of parts and their lots.\n\nFor testing purposes, you can use these numbers for some scenarios:\n\n- TEST0001: List of 1 part with 5 lots\n- TEST0005: List of 5 parts with 1 lot each\n- TEST0100: List of 1 parts, with 100 lots\n", | |
"operationId": "get-manifests-manifest_number", | |
"parameters": [ | |
{ | |
"name": "manifest_number", | |
"in": "path", | |
"required": true, | |
"schema": { | |
"type": "string" | |
} | |
} | |
], | |
"responses": { | |
"200": { | |
"$ref": "#/components/responses/ManifestResponse" | |
}, | |
"401": { | |
"description": "Unauthorized" | |
}, | |
"404": { | |
"description": "Manifest Not Found" | |
}, | |
"500": { | |
"description": "Internal Server Error" | |
} | |
}, | |
"security": [ | |
{ | |
"apiKey_1": [] | |
} | |
], | |
"servers": [ | |
{ | |
"url": "http://localhost:3000/api/v1", | |
"description": "For local development" | |
}, | |
{ | |
"url": "https://api.canadafirstbricks.com/api/v1", | |
"description": "For production use" | |
} | |
] | |
}, | |
"patch": { | |
"tags": [ | |
"manifest" | |
], | |
"summary": "Provide actual quantities for lots", | |
"description": "Endpoint for reporting the actual quantities put in bags, and extra quantities, if any.\n\nFor testing purposes, you can use these manifest numbers:\n\n- TEST200: Returns 200 OK\n- TEST401: Returns 401 Unauthorized\n- TEST404: Returns 404 Not Found\n- TEST500: Returns 500 Internal Server Error", | |
"operationId": "patch-manifests-manifest_number", | |
"parameters": [ | |
{ | |
"name": "manifest_number", | |
"in": "path", | |
"required": true, | |
"schema": { | |
"type": "string" | |
} | |
} | |
], | |
"requestBody": { | |
"$ref": "#/components/requestBodies/BaggingResult" | |
}, | |
"responses": { | |
"200": { | |
"description": "OK" | |
}, | |
"401": { | |
"description": "Unauthorized" | |
}, | |
"404": { | |
"description": "Manifest Not Found" | |
}, | |
"500": { | |
"description": "Internal Server Error" | |
} | |
}, | |
"security": [ | |
{ | |
"apiKey_1": [] | |
} | |
], | |
"servers": [ | |
{ | |
"url": "http://localhost:3000/api/v1", | |
"description": "For local development" | |
}, | |
{ | |
"url": "https://api.canadafirstbricks.com/api/v1", | |
"description": "For production use" | |
} | |
] | |
} | |
}, | |
"/part_colors/{part_number}": { | |
"get": { | |
"tags": [ | |
"catalog" | |
], | |
"summary": "Part colors", | |
"description": "Returns a list of all colors used by Canada First Bricks for the given part.", | |
"operationId": "get-part_colors", | |
"parameters": [ | |
{ | |
"name": "part_number", | |
"in": "path", | |
"required": true, | |
"schema": { | |
"type": "string" | |
} | |
} | |
], | |
"responses": { | |
"200": { | |
"$ref": "#/components/responses/ColorResponse" | |
}, | |
"401": { | |
"description": "Unauthorized" | |
}, | |
"404": { | |
"description": "Part Number Not Found" | |
}, | |
"500": { | |
"description": "Internal Server Error" | |
} | |
}, | |
"security": [ | |
{ | |
"apiKey_1": [] | |
} | |
], | |
"servers": [ | |
{ | |
"url": "http://localhost:3000/api/v1", | |
"description": "For local development" | |
}, | |
{ | |
"url": "https://api.canadafirstbricks.com/api/v1", | |
"description": "For production use" | |
} | |
] | |
} | |
} | |
}, | |
"tags": [ | |
{ | |
"name": "manifest", | |
"description": "Everything about manifests" | |
}, | |
{ | |
"name": "catalog", | |
"description": "Everything about catalog" | |
} | |
], | |
"components": { | |
"requestBodies": { | |
"BaggingResult": { | |
"description": "Include the list of lots, with the quantities put in bags. \n\nExtra parts can be supplied for parts not put into bags.", | |
"content": { | |
"application/json": { | |
"schema": { | |
"type": "object", | |
"properties": { | |
"data": { | |
"type": "object", | |
"properties": { | |
"lots": { | |
"type": "array", | |
"items": { | |
"$ref": "#/components/schemas/Lot" | |
} | |
}, | |
"extras": { | |
"type": "array", | |
"items": { | |
"$ref": "#/components/schemas/Extra" | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"securitySchemes": { | |
"apiKey_1": { | |
"type": "apiKey", | |
"description": "Contact Canada First Bricks to get an API key.", | |
"name": "apiKey", | |
"in": "header" | |
} | |
}, | |
"responses": { | |
"ManifestResponse": { | |
"description": "Manifest that contains parts and their lots.", | |
"content": { | |
"application/json": { | |
"schema": { | |
"type": "object", | |
"properties": { | |
"data": { | |
"$ref": "#/components/schemas/Manifest" | |
} | |
} | |
} | |
} | |
} | |
}, | |
"ColorResponse": { | |
"description": "List of colors", | |
"content": { | |
"application/json": { | |
"schema": { | |
"type": "object", | |
"properties": { | |
"data": { | |
"type": "array", | |
"items": { | |
"$ref": "#/components/schemas/Color" | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"schemas": { | |
"Lot": { | |
"type": "object", | |
"title": "Lot", | |
"properties": { | |
"id": { | |
"type": "string", | |
"description": " Unique identifier for the lot. Internally, this maps to the pre-production inventory lot ID. " | |
}, | |
"moc": { | |
"type": "string", | |
"description": "Name of the MOC" | |
}, | |
"quantity": { | |
"type": "integer", | |
"description": "Quantity in bag" | |
}, | |
"bag_number": { | |
"type": "string", | |
"description": "Bag number" | |
} | |
}, | |
"examples": [ | |
{ | |
"id": "c19aed0c-d79c-4102-a6c6-e7a226892ea8", | |
"moc": "BB006 Pocket Sphere - Classic 240215", | |
"quantity": 100, | |
"bag_number": "1" | |
}, | |
{ | |
"id": "2120a9c4-8b22-4c71-a144-f0d685697dcc", | |
"moc": "BB135 Park Sphere w_ Extras 240125", | |
"quantity": 50, | |
"bag_number": "1.1" | |
} | |
] | |
}, | |
"Extra": { | |
"type": "object", | |
"title": "Extra", | |
"properties": { | |
"part_number": { | |
"type": "string", | |
"description": "Part number, i.e. 3069b" | |
}, | |
"color_number": { | |
"type": "integer", | |
"description": "Color number, i.e. 11" | |
}, | |
"quantity": { | |
"type": "integer", | |
"description": "Quantity in extra" | |
} | |
} | |
}, | |
"Manifest": { | |
"type": "object", | |
"title": "Manifest", | |
"properties": { | |
"id": { | |
"type": "string", | |
"readOnly": true | |
}, | |
"number": { | |
"type": "string", | |
"description": "Unique number for the manifest. \r\n\r\nInternally, this maps to the ID of one of these: \r\n\r\n- stock part run\r\n- Bricklink order\r\n- LEGO order\r\n- picking run\r\n- pick list\r\n", | |
"readOnly": true | |
}, | |
"type": { | |
"type": "string", | |
"enum": [ | |
"stock_part_run", | |
"bricklink_order", | |
"lego_order", | |
"cfb_picking_run", | |
"cfb_pick_list" | |
], | |
"readOnly": true | |
}, | |
"parts": { | |
"type": "array", | |
"items": { | |
"$ref": "#/components/schemas/Part" | |
} | |
} | |
}, | |
"examples": [ | |
{ | |
"id": "a389fb92-7640-400f-9971-28070ec1382c", | |
"number": "SPR12345", | |
"type": "stock_part_run", | |
"parts": [ | |
{ | |
"id": "4c0e3ea2-6ded-4341-9a9c-738a9c48c357", | |
"number": "3004", | |
"name": "a389fb92-7640-400f-9971-28070ec1382c", | |
"color": "White", | |
"total_quantity": 150, | |
"lots": [ | |
{ | |
"id": "c19aed0c-d79c-4102-a6c6-e7a226892ea8", | |
"moc": "BB006 Pocket Sphere - Classic 240215", | |
"quantity": 100, | |
"bag_number": "1" | |
}, | |
{ | |
"id": "2120a9c4-8b22-4c71-a144-f0d685697dcc", | |
"moc": "BB135 Park Sphere w_ Extras 240125", | |
"quantity": 50, | |
"bag_number": "1.1" | |
} | |
] | |
} | |
] | |
}, | |
{ | |
"id": "a389fb92-7640-400f-9971-28070ec1382c", | |
"number": "BL12345678", | |
"type": "bricklink_order", | |
"parts": [ | |
{ | |
"id": "4c0e3ea2-6ded-4341-9a9c-738a9c48c357", | |
"number": "3004", | |
"name": "a389fb92-7640-400f-9971-28070ec1382c", | |
"color": "White", | |
"total_quantity": 150, | |
"lots": [ | |
{ | |
"id": "c19aed0c-d79c-4102-a6c6-e7a226892ea8", | |
"moc": "BB006 Pocket Sphere - Classic 240215", | |
"quantity": 100, | |
"bag_number": "1" | |
}, | |
{ | |
"id": "2120a9c4-8b22-4c71-a144-f0d685697dcc", | |
"moc": "BB135 Park Sphere w_ Extras 240125", | |
"quantity": 50, | |
"bag_number": "1.1" | |
} | |
] | |
} | |
] | |
} | |
] | |
}, | |
"Part": { | |
"type": "object", | |
"title": "Part", | |
"properties": { | |
"id": { | |
"type": "string", | |
"description": "Unique identifier for a part and color in inventory. Internally, this maps to the inventory item." | |
}, | |
"number": { | |
"type": "string", | |
"description": "Bricklink part number, i.e 3069b." | |
}, | |
"name": { | |
"type": "string", | |
"description": "Bricklink part name, i.e. Minifigure, Weapon Sword, Double Blade with Bar Holder (Valious)\r\n\r\nThe name may includes HTML entities, i.e. é" | |
}, | |
"color": { | |
"type": "string", | |
"description": "Bricklink color name" | |
}, | |
"total_quantity": { | |
"type": "integer", | |
"description": "Total quantity in lots" | |
}, | |
"lots": { | |
"type": "array", | |
"items": { | |
"$ref": "#/components/schemas/Lot" | |
} | |
} | |
}, | |
"examples": [ | |
{ | |
"id": "4c0e3ea2-6ded-4341-9a9c-738a9c48c357", | |
"number": "3004", | |
"name": "a389fb92-7640-400f-9971-28070ec1382c", | |
"color": "White", | |
"total_quantity": 150, | |
"lots": [ | |
{ | |
"id": "c19aed0c-d79c-4102-a6c6-e7a226892ea8", | |
"moc": "BB006 Pocket Sphere - Classic 240215", | |
"quantity": 100, | |
"bag_number": "1" | |
}, | |
{ | |
"id": "2120a9c4-8b22-4c71-a144-f0d685697dcc", | |
"moc": "BB135 Park Sphere w_ Extras 240125", | |
"quantity": 50, | |
"bag_number": "1.1" | |
} | |
] | |
} | |
] | |
}, | |
"Color": { | |
"type": "object", | |
"title": "Color", | |
"properties": { | |
"id": { | |
"type": "string" | |
}, | |
"number": { | |
"type": "integer" | |
}, | |
"name": { | |
"type": "string" | |
} | |
}, | |
"examples": [ | |
{ | |
"id": "b0d39a02-5ff5-440d-b55e-b779e50c8ea8", | |
"number": 11, | |
"name": "Black" | |
}, | |
{ | |
"id": "c8a06ccf-ffe2-4ea1-8b83-1c6f7fad0620", | |
"number": 1, | |
"name": "White" | |
} | |
] | |
} | |
} | |
}, | |
"security": [ | |
{ | |
"apiKey_1": [] | |
} | |
], | |
"x-internal": true | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment