Skip to content

API Documentation

Dominic O'Donnell edited this page Oct 28, 2024 · 7 revisions

This is a document relating to the various API routes that currently exist.

Web API Routes

Get Health:

Request: GET https://localhost:7101/api/health
200 Response:

OK
Product API Routes

Get Product:

Request: GET https://localhost:7101/api/Product/13453b49-1e14-4e00-1131-08dcf762d41e
200 Response:

{
  "id": "13453b49-1e14-4e00-1131-08dcf762d41e",
  "name": "Hello World!",
  "translations": {
    "names": [
      {
        "id": "3fbc8ee5-e16e-4028-d48f-08dcf762d41f",
        "languageCode": "en-US",
        "key": "Name",
        "value": "Hello World!"
      },
      {
        "id": "3f02b0f7-7683-4ca0-d490-08dcf762d41f",
        "languageCode": "es-MX",
        "key": "Name",
        "value": "¡Hola mundo!"
      },
      {
        "id": "4248d03f-8b6e-4b48-d491-08dcf762d41f",
        "languageCode": "de",
        "key": "Name",
        "value": "Hallo Welt!"
      }
    ]
  }
}

GetAll Products:

Request: GET https://localhost:7101/api/Product
200 Response:

[
  {
    "id": "13453b49-1e14-4e00-1131-08dcf762d41e",
    "name": "Hello World!",
    "translations": {
      "names": [
        {
          "id": "3fbc8ee5-e16e-4028-d48f-08dcf762d41f",
          "languageCode": "en-US",
          "key": "Name",
          "value": "Hello World!"
        },
        {
          "id": "3f02b0f7-7683-4ca0-d490-08dcf762d41f",
          "languageCode": "es-MX",
          "key": "Name",
          "value": "¡Hola mundo!"
        },
        {
          "id": "4248d03f-8b6e-4b48-d491-08dcf762d41f",
          "languageCode": "de",
          "key": "Name",
          "value": "Hallo Welt!"
        }
      ]
    }
  }
]

Create Product:

Request: POST https://localhost:7101/api/Product

{
  "name": "Hello World!"
}

201 Response:
"de721bce-b44e-41d9-1da5-08dcf76961b9"

Update Product:

Request: PUT https://localhost:7101/api/Product

{
  "id": "ba9278ee-90c3-47a7-8931-08dcf766a206",
  "name": "Hello World - Changed"
}

204 Response.

Delete Product:

Request: DELETE https://localhost:7101/api/Product/13453b49-1e14-4e00-1131-08dcf762d41e
204 Response.

Language API Routes

GetAll Languages:

Request: GET https://localhost:7101/api/Language
200 Response:

[
  {
    "code": "es-MX",
    "isDefault": false,
    "id": "42fa4285-8a91-43c9-cec3-08dcf762c4b5"
  },
  {
    "code": "de",
    "isDefault": false,
    "id": "97561937-8de9-4ed8-cec4-08dcf762c4b5"
  },
  {
    "code": "en-US",
    "isDefault": true,
    "id": "1bc7d4f7-436f-4794-b264-bb1663ca6671"
  }
]

Create Language:

Request: POST https://localhost:7101/api/Language

{
  "code": "de"
}

201 Response:
"1bc7d4f7-436f-4794-b264-bb1663ca6671"

SetDefault Language:

Request: PUT https://localhost:7101/api/Language/SetDefault/1bc7d4f7-436f-4794-b264-bb1663ca6671
204 Response.

Delete Language:

Request: DELETE https://localhost:7101/api/Language/13453b49-1e14-4e00-1131-08dcf762d41e
204 Response.