diff --git a/Koha/REST/V1/Biblios.pm b/Koha/REST/V1/Biblios.pm index 794a968af8..4c1221c2ab 100644 --- a/Koha/REST/V1/Biblios.pm +++ b/Koha/REST/V1/Biblios.pm @@ -370,6 +370,10 @@ sub add_item { $item->store->discard_changes; + my $base_url = $c->req->url->to_string; + $base_url =~ s|/biblios/\d+||; + $c->res->headers->location( $base_url . '/' . $item->id ); + $c->render( status => 201, openapi => $c->objects->to_api($item), @@ -719,6 +723,8 @@ sub add { ); } + $c->res->headers->location( $c->req->url->to_string . '/' . $biblio_id ); + return $c->render( status => 200, openapi => { id => $biblio_id } diff --git a/Koha/REST/V1/Clubs/Holds.pm b/Koha/REST/V1/Clubs/Holds.pm index 851cc9358a..0643d4b7df 100644 --- a/Koha/REST/V1/Clubs/Holds.pm +++ b/Koha/REST/V1/Clubs/Holds.pm @@ -108,6 +108,8 @@ sub add { } ); + $c->res->headers->location( $c->req->url->to_string . '/' . $club_hold->id ); + return $c->render( status => 201, openapi => $c->objects->to_api($club_hold), diff --git a/Koha/REST/V1/Holds.pm b/Koha/REST/V1/Holds.pm index 121e68313e..685a3697c1 100644 --- a/Koha/REST/V1/Holds.pm +++ b/Koha/REST/V1/Holds.pm @@ -216,6 +216,8 @@ sub add { my $hold = Koha::Holds->find($hold_id); + $c->res->headers->location( $c->req->url->to_string . '/' . $hold_id ); + return $c->render( status => 201, openapi => $c->objects->to_api($hold), diff --git a/Koha/REST/V1/ILL/Batch/Statuses.pm b/Koha/REST/V1/ILL/Batch/Statuses.pm index 45612f5f8d..ac22b0ca1c 100644 --- a/Koha/REST/V1/ILL/Batch/Statuses.pm +++ b/Koha/REST/V1/ILL/Batch/Statuses.pm @@ -84,6 +84,7 @@ sub add { openapi => $return ); } else { + $c->res->headers->location( $c->req->url->to_string . '/' . $status->code ); return $c->render( status => 201, openapi => $status diff --git a/Koha/REST/V1/ImportBatchProfiles.pm b/Koha/REST/V1/ImportBatchProfiles.pm index c61b216690..51d43f4f0f 100644 --- a/Koha/REST/V1/ImportBatchProfiles.pm +++ b/Koha/REST/V1/ImportBatchProfiles.pm @@ -68,6 +68,7 @@ sub add { return try { my $profile = Koha::ImportBatchProfile->new_from_api( $body )->store; + $c->res->headers->location( $c->req->url->to_string . '/' . $profile->id ); return $c->render( status => 201, openapi => $c->objects->to_api($profile), diff --git a/Koha/REST/V1/TransferLimits.pm b/Koha/REST/V1/TransferLimits.pm index 8e8515621f..50799a887e 100644 --- a/Koha/REST/V1/TransferLimits.pm +++ b/Koha/REST/V1/TransferLimits.pm @@ -74,6 +74,8 @@ sub add { Koha::Exceptions::TransferLimit::Duplicate->throw(); } + $c->res->headers->location( $c->req->url->to_string . '/' . $transfer_limit->id ); + return $c->render( status => 201, openapi => $c->objects->to_api($transfer_limit),