-
Notifications
You must be signed in to change notification settings - Fork 0
API Design
Michael edited this page Dec 20, 2022
·
7 revisions
/api/:kind/:version/:domainName/:commandName
Examples:
/api/query/v1/items/getList
/api/query/v1/tags/getList
/api/command/v1/item/submit
/api/command/v1/item/suggestChange
/api/query/v1/items/getOne
Query
{
slug: string
}
Returns Item
:
{
"id": "0ab3fd6f-aa90-4b1f-a6b3-fdd17a3a3947",
"name": "Tesla Model 3",
"slug": "tesla-model-3",
"weight": {
"value": 1825,
"aditionalValue": 2000, /** Optional */
"isCa": false
/* In Gramm and 1e10 */
},
"source": "https://wikipedia.org/wiki/Tesla_Model_3", /** Optional */
"image": "daf4206b-c2f5-439c-b7be-d678f38f3185", /** URL to image Optional */
"tags": [{ // Other Issue
"name":"Tesla Model 3",
"slug":"tesla-model-3",
"count": 345
}],
"user": "arnorld doofenschmirtz"
}
/api/query/v1/items/getList
Query
{
page: number
limit: number
}
Returns Item
:
{
"total": 100,
"page": 0,
"itemsPerPage": 50,
"data": Items[]
}
Aktueller Mock im Frontend:
{
"/api/query/v1/items/getList": "/items",
"/api/query/v1/items/getList?page=:page&limit=:limit": "/items?_page=:page&_limit=:limit",
"/api/query/v1/items/getList?limit=:limit&page=:page": "/items?_limit=:limit&_page=:page",
"/api/query/v1/items/getList?page=:page": "/items?_page=:page",
"/api/query/v1/items/getList?limit=:limit": "/items?_limit=:limit",
"/api/query/v1/items/getOne?slug=:slug": "/items/:slug",
"/api/query/v1/tags/getList": "/tags",
"/api/query/v1/tags/getList?page=:page&limit=:limit": "/tags?_page=:page&_limit=:limit",
"/api/query/v1/tags/getList?limit=:limit&page=:page": "/tags?_limit=:limit&_page=:page",
"/api/query/v1/tags/getList?page=:page": "/tags?_page=:page",
"/api/query/v1/tags/getOne?slug=:slug": "/tags/:slug"
}