I have a slow query problem with the RT REST2 API. So basically, I have a script to read the user data from the
/REST/2.0/user/id route, and for some users the request goes for too long, and I get a timeout from the web server ( 500 ERROR ). But, the problem as I’ve discover from the logs, is with this query from db
SELECT main.* FROM Transactions main WHERE (main.ObjectId = 'USER_ID') AND (main.ObjectType = 'RT::User') ORDER BY main.id DESC; . This issues is only for some users, not all the users.
If I acces the same user data from the web interface with this route (
/Admin/Users/Modify.html?id=USER_ID ) , the request is complete successfully.
I have a solution in mind: is it possible to filter the fields I get from the API response ? In this script, I only need the
Name of the user from the JSON that the API returns, and if I only get the
Name I guess the query to the
Transactions table will not be executed anymore. I’ve read the REST2 API docs from the metacpan.org but I had no success filtering the JSON fields with this specific API route.
Or maybe someone could help me with the slow queries from the