Allow filtering related records on V8 API

Currently it is not possible to filter records or specify fields when using {{suitecrm.url}}/Api/V8/module/{moduleName}/{id}/relationships/{linkFieldName}

this leads to overfetching which could be avoided by honouring the filter and fields parameters used by {{suitecrm.url}}/Api/V8/module/{moduleName}/{id} or {{suitecrm.url}}/Api/V8/module/{moduleName}
I have an incentive to make this change to reduce the amount of requests made to the V8 API, and so I will most likely solve this myself and share

That’s great. You can also code your own custom endpoint and handle the request however you like. That’s always an option too.

I appreciate that is an option however, the benefits of being able to use 1 or 2 common endpoints over n many is an opportunity hard to turn down.

I personally think its wildly under utilised in many plugins, modules, and products which work with the CRM.

It’s already rather powerful but with a few tweaks it can be very powerful :mechanical_arm:

1 Like

According to the Api code you can set a filter parameter and it will be used (its fairly simple but available).

Mark

From the time of writing back in June 2025 it was not possible to use filters on relationships api requests.

I got around the limitation by creating 2 additional API filters IN and NOT IN (might rename to NIN)
back around the same time and by making 2 API calls instead of 1.

make the first API call to get the ID’s of the records related to a record
then the second API call is to get the actual records and gives you the ability to filter them

The in operator is also used to make sure that a record that has already been fetched does not get refetched.

You will have to add them to the CRM yourself as they have not been included in SuiteCRM by salesagillity or whoever is running the repo these days.

2 Likes

That’s a good PR. thank you for submitting it. :star:

This is a helpful discussion. From our experience with similar setups, paying attention to the default configuration options makes a significant difference in long-term maintainability. Happy to share more specifics if helpful.