Hi
I’ve created a collection called “tenants” and configured the List, Get and Update actions. I’m trying to configure a JS Action in a table that calls the Update action, but I cannot get it to work.
When I try using the " API request template" snippet that works fine:
// Replace url/method/params/data as needed
const response = await ctx.api.request({
url: 'users:list',
method: 'get',
params: {
pageSize: 10,
},
});
ctx.message.success(ctx.t('Request finished'));
console.log(ctx.t('Response data:'), response?.data);
Log output:
{"level":"info","message":"parseJsonTemplate.parsed","extra":{"id":{"$ne":1}},"meta":{"id":{"$ne":1}},"module":"users","submodule":"list","method":"","app":"main","reqId":"5a2bc7b3-f325-495d-971b-0682303131df","dataSourceKey":"main","timestamp":"2026-02-02 17:59:17"}
{"level":"info","message":"response /api/users:list?pageSize=10","method":"GET","path":"/api/users:list?pageSize=10","res":{"status":200},"action":{"actionName":"list","resourceName":"users","params":{"pageSize":"10","resourceName":"users","actionName":"list","values":{}}},"userId":1,"username":"nocobase","status":200,"cost":379,"app":"main","reqId":"5a2bc7b3-f325-495d-971b-0682303131df","bodySize":699,"timestamp":"2026-02-02 17:59:17"}
However, switching to my “tenants:list” fails:
const response = await ctx.api.request({
url: 'tenants:list',
method: 'get',
params: {
pageSize: 10,
},
});
ctx.message.success(ctx.t('Request finished'));
console.log(ctx.t('Response data:'), response?.data);
Logs:
{"level":"info","message":"request GET /api/tenants:list?pageSize=10","method":"GET","path":"/api/tenants:list?pageSize=10","req":{"header":{"x-role":"root","x-hostname":"localhost","x-timezone":"+01:00","x-locale":"en-US","x-authenticator":"basic"}},"app":"main","reqId":"cf6910ad-ebe5-46b7-a725-dcd421676017","timestamp":"2026-02-02 17:56:34"}
{"level":"warn","message":"response /api/tenants:list?pageSize=10","method":"GET","path":"/api/tenants:list?pageSize=10","action":{},"status":404,"cost":1,"app":"main","reqId":"cf6910ad-ebe5-46b7-a725-dcd421676017","timestamp":"2026-02-02 17:56:34"}
Why are custom collections failing? Is there a different way to go about calling endpoints defined in REST API Collections?
Any help appreciated,
Kevin
