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

LocationController: PUT

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

Für einen PUT-Request übergibt man der API eine schon vorhandenen Standort mit den Änderungen.

Beispiel für das ändern eines Standortes (PUT: /api/location):

Response eines GET-Requests:

[
  {
    "id": 2,
    "name": "Filiale 2",
    "address": {
      "id": 2,
      "street": "Königsgasse 13",
      "zip": "77779",
      "city": "Berlin"
    }
  }
]

Nun möchten wir z.B. den Namen und die Addresse ändern. Die Property name und address.id wird geändert zu: "Filiale 1" und 2.

Payload des PUT-Requests:

[
  {
    "id": 1,
    "name": "Filiale 1",
    "address": {
      "id": 2
    }
  }
]

Bei erfolgreichem Request sendet der Server folgenden Response:

HTTP: 204 No Content