Querying related list via REST API in custom module fails

Querying related list via REST API in custom module fails

I have a couple of related modules with API names "foo" and "bar".

now there is a relation between the two, bar has a lookup field pointing to foo.

trying to query the related list of foo record id 1234 via REST fails:

/crm/v2.1/foo/12345/bar/ /crm/v2.1/foo/1234/bar/5678

...getting:
{
"code": "INVALID_DATA",
"details": {
"resource_path_index": 2
},
"message": "the relation name given seems to be invalid",
"status": "error"
}
any idea please?