diff --git a/Koha/REST/V1/Cities.pm b/Koha/REST/V1/Cities.pm index 222f7c0015..793880c813 100644 --- a/Koha/REST/V1/Cities.pm +++ b/Koha/REST/V1/Cities.pm @@ -78,7 +78,11 @@ sub add { return try { my $city = Koha::City->new( _to_model( $c->validation->param('body') ) ); $city->store; - return $c->render( status => 200, openapi => $city->to_api ); + $c->res->headers->location( $c->req->url->to_string . '/' . $city->cityid ); + return $c->render( + status => 201, + openapi => $city->to_api + ); } catch { if ( $_->isa('DBIx::Class::Exception') ) { diff --git a/api/v1/swagger/paths/cities.json b/api/v1/swagger/paths/cities.json index 5779a48651..77ee394af4 100644 --- a/api/v1/swagger/paths/cities.json +++ b/api/v1/swagger/paths/cities.json @@ -84,7 +84,7 @@ "application/json" ], "responses": { - "200": { + "201": { "description": "City added", "schema": { "$ref": "../definitions.json#/city"