Skip to content
This repository was archived by the owner on Aug 3, 2020. It is now read-only.

ProductController: POST

Philipp Heim edited this page Jun 4, 2020 · 2 revisions

Für einen POST-Request übergibt man der API ID´s für Properties, Categories und ProductsAtLocations. Beispiel für das erstellen eines Produktes (POST: /api/product):

Payload des POST-Requests:

{
  "name": "DokuTest",
  "price": 333,
  "sku": "333",
  "properties": [
    {
      "id": 1
    }
  ],
  "categories": [
    {
      "id": 1
    }
  ],
  "productsAtLocations": [
    {
      "locationId": 1,
      "quantity": 333
    }
  ]
}

Bei erfolgreichem Request sendet der Server folgenden Response:

HTTP: 201 Created

Response Body:

{
 "id": 23,
 "name": "DokuTest",
 "price": 333.0,
 "sku": "333",
 "createdAt": "2020-06-04T19:51:11.085351Z"
}

Response Header:

Unter location kann die erstellte Ressource abgefragt werden.

content-length: 95
content-type: application/json; charset=utf-8
date: Sun, 31 May 2020 17:16:20 GMT
location: https://localhost:5001/api/Product/23
server: Kestrel

Clone this wiki locally