Link Here
|
50 |
|
50 |
|
51 |
Adds a Link header to the response message $c carries, following RFC5988, including |
51 |
Adds a Link header to the response message $c carries, following RFC5988, including |
52 |
the following relation types: 'prev', 'next', 'first' and 'last'. |
52 |
the following relation types: 'prev', 'next', 'first' and 'last'. |
53 |
It also adds X-Total-Count, containing the total results count. |
53 |
It also adds X-Total-Count containing the total results count, and X-Base-Total-Count containing the total of the non-filtered results count. |
54 |
|
54 |
|
55 |
If page size is omitted, it defaults to the value of the RESTdefaultPageSize syspref. |
55 |
If page size is omitted, it defaults to the value of the RESTdefaultPageSize syspref. |
56 |
|
56 |
|
Link Here
|
61 |
my ( $c, $args ) = @_; |
61 |
my ( $c, $args ) = @_; |
62 |
|
62 |
|
63 |
my $total = $args->{total}; |
63 |
my $total = $args->{total}; |
|
|
64 |
my $base_total = $args->{base_total}; |
64 |
my $req_page = $args->{params}->{_page} // 1; |
65 |
my $req_page = $args->{params}->{_page} // 1; |
65 |
my $per_page = $args->{params}->{_per_page} // |
66 |
my $per_page = $args->{params}->{_per_page} // |
66 |
C4::Context->preference('RESTdefaultPageSize') // 20; |
67 |
C4::Context->preference('RESTdefaultPageSize') // 20; |
Link Here
|
114 |
|
115 |
|
115 |
# Add X-Total-Count header |
116 |
# Add X-Total-Count header |
116 |
$c->res->headers->add( 'X-Total-Count' => $total ); |
117 |
$c->res->headers->add( 'X-Total-Count' => $total ); |
|
|
118 |
$c->res->headers->add( 'X-Base-Total-Count' => $base_total ); |
117 |
return $c; |
119 |
return $c; |
118 |
} |
120 |
} |
119 |
); |
121 |
); |