RT 5.0.5 changed the REST API in a way, that only superusers can see the “pages” and “total” fields on a search request via the REST API.
my $field_result = $self->expand_field($item, $field);
$result->{$field} = $field_result if defined $field_result;
}
}
}
push @results, $result;
}
my %results = (
count => scalar(@results) + 0,
total => $collection->CurrentUserCanSeeAll ? ( $collection->CountAll + 0 ) : undef,
per_page => $collection->RowsPerPage + 0,
page => ($collection->FirstRow / $collection->RowsPerPage) + 1,
items => \@results,
);
my $uri = $self->request->uri;
my @query_form = $uri->query_form;
# find page and if it is set, delete it and its value.
for my $i (0..$#query_form) {
if ($query_form[$i] eq 'page') {
Example:
/REST/2.0/ticket/TICKET_ID /history
If called with a priviledged user, “total” and “pages” are both null. When called with a superuser account the correct numbers are returned.
I guess it’s because the SeeAll call on searches requires SuperUser rights (SearchBuilder.pm, sorry, can only post 2 links in total over here)
I will also open a bug report on rt.bestpractical.com for this, but in my experience this is not read by the developers so I will try it over here.
A shame this wasn’t exposed as either a configuration option or an extra “SeeAPITotals” right so that RT admins could choose whether to expose this data to their REST users or not. I can imagine this is potentially going to cause a few issues with API users who purposely don’t run the API with super user rights (for good reasons!).