View | Details | Raw Unified | Return to bug 23859
Collapse All | Expand All

(-)a/Koha/REST/V1/Cities.pm (-1 / +5 lines)
Lines 78-84 sub add { Link Here
78
    return try {
78
    return try {
79
        my $city = Koha::City->new( _to_model( $c->validation->param('body') ) );
79
        my $city = Koha::City->new( _to_model( $c->validation->param('body') ) );
80
        $city->store;
80
        $city->store;
81
        return $c->render( status => 200, openapi => $city->to_api );
81
        $c->res->headers->location( $c->req->url->to_string . '/' . $city->cityid );
82
        return $c->render(
83
            status  => 201,
84
            openapi => $city->to_api
85
        );
82
    }
86
    }
83
    catch {
87
    catch {
84
        if ( $_->isa('DBIx::Class::Exception') ) {
88
        if ( $_->isa('DBIx::Class::Exception') ) {
(-)a/api/v1/swagger/paths/cities.json (-2 / +1 lines)
Lines 84-90 Link Here
84
        "application/json"
84
        "application/json"
85
      ],
85
      ],
86
      "responses": {
86
      "responses": {
87
        "200": {
87
        "201": {
88
          "description": "City added",
88
          "description": "City added",
89
          "schema": {
89
          "schema": {
90
            "$ref": "../definitions.json#/city"
90
            "$ref": "../definitions.json#/city"
91
- 

Return to bug 23859