Subject: | Asset search via REST2.0 only works AFTER doing a search on web UI |
Date: | Tue, 6 Nov 2018 14:32:54 +0100 |
To: | bug-RT-Extension-REST2 [...] rt.cpan.org |
From: | Mariusz Gronczewski <mgronczewski [...] efigence.com> |
I believe it might be related to https://rt.cpan.org/Public/Bug/Display.html?id=123261
tested on stable RT from debian packages and from source running from fastcgi, I've set amount of workers to 1 to make repeating it simpler. Only rest2 and token plugins are installed.
REST2.0 search API only starts working AFTER manually doing search via web UI
When searching via REST2.0 API results are always empty at first (catalog have exactly one asset):
POST {{server_url}}/REST/2.0/assets
Accept: */*
Cache-Control: no-cache
Authorization: token {{token}}
[{ "field" : "id", "operator" : ">=", "value" : 0 }]
HTTP/1.1 200 OK
Server: nginx/1.10.3
Date: Tue, 06 Nov 2018 13:27:42 GMT
Content-Type: application/json; charset="utf-8"
Content-Length: 87
Connection: keep-alive
{
"page": 1,
"count": 0,
"items": [],
"per_page": 20,
"total": 0
}
but making request to "normal" search "fixes" it:
GET {{server_url}}/Asset/Search/index.html?Catalog=1&Status=&Name=&%21Name=&Description=&%21Description=&Role.Owner=&%21Role.Owner=&Role.HeldBy=&%21Role.HeldBy=&Role.Contact=&%21Role.Contact=&SearchAssets=Search&
Accept: */*
Cache-Control: no-cache
Referer: {{server_url}}
Authorization: token {{token}}
HTTP/1.1 200 OK
Server: nginx/1.10.3
Content-Type: text/html; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Set-Cookie: RT_SID_dev-rt.non.3dart.com.80=699da318b9410dfdd1ebe95fed3e3088; path=/; HttpOnly
Date: Tue, 06 Nov 2018 13:28:28 GMT
Cache-control: no-cache
Pragma: no-cache
X-Frame-Options: DENY
<!DOCTYPE html>
<html lang="en">
<head>
<title>Found 1 asset</title>
---- snip ----
after that REST2.0 returns search (same request as first correctly):
HTTP/1.1 200 OK
Server: nginx/1.10.3
Date: Tue, 06 Nov 2018 13:29:28 GMT
Content-Type: application/json; charset="utf-8"
Content-Length: 220
Connection: keep-alive
{
"total": 1,
"per_page": 20,
"items": [
{
"id": "1",
"_url": "http://dev-rt.non.3dart.com/REST/2.0/asset/1",
"type": "asset"
}
],
"count": 1,
"page": 1
}
--
Mariusz Gronczewski, Administrator
Efigence S. A.
ul. Wołoska 9a, 02-583 Warszawa
T: [+48] 22 380 13 13
F: [+48] 22 380 13 14
E: mariusz.gronczewski@efigence.com <mailto:mariusz.gronczewski@efigence.com>