I put together a gist that might help and I've highlighted the part of the code where the relatedItems are used:
I'm aware that the example uses the built in relatedItems and your question is about custom relations (e.g. a spouse relationship).
The essence is looking for what is returned by the rest api. In this case relatedItems is one of the fields returned.
Thank you @pigeonflight for the gist. Much appreciated.
Since custom dexterity type doesn't provide relatedItems by default. I think @tiberiuichim solution using custom siblings type might be the only solution.
It seems to provide a new GET endpoint that returns all objects that are in the same container as the current object. It uses a "trick" by depending on a special view called 'localtabs_view' to find all "siblings". I'm not sure that this is the same thing that you want.
It does provide a good pattern for how to create an endpoint in the backend. If your custom type has special relation fields you might need to create your own custom endpoint.
If your content type is just using standard relatedItems it is possible to enable the relatedItems behavior under: Site Setup > Content Types > "your content type" > Behaviors
Thanks @pbauer for integrating relations into plone api. The outgoing relations are always empty. Trying to figure out how to create a list sorted by relationship type
$ self.context
<Person at /Plone/persons/e-m>
$ incoming_relations = api.relation.get(target=self.context, as_dict=True)
$ incoming_relations
defaultdict(<class 'list'>,
{'interestedParty': [<z3c.relationfield.relation.RelationValue object at 0x7fc852269dd0 oid 0x2aae in <Connection at 7fc858e36e50>>],
'person': [<z3c.relationfield.relation.RelationValue object at 0x7fc85232a510 oid 0x2703 in <Connection at 7fc858e36e50>>,
<z3c.relationfield.relation.RelationValue object at 0x7fc85232a900 oid 0x27e5 in <Connection at 7fc858e36e50>>,
<z3c.relationfield.relation.RelationValue object at 0x7fc85232aa50 oid 0x2801 in <Connection at 7fc858e36e50>>,
<z3c.relationfield.relation.RelationValue object at 0x7fc8523e8f20 oid 0x2833 in <Connection at 7fc858e36e50>>,
<z3c.relationfield.relation.RelationValue object at 0x7fc85226c270 oid 0x284f in <Connection at 7fc858e36e50>>,
<z3c.relationfield.relation.RelationValue object at 0x7fc85226c3c0 oid 0x286b in <Connection at 7fc858e36e50>>,
<z3c.relationfield.relation.RelationValue object at 0x7fc85226c510 oid 0x288e in <Connection at 7fc858e36e50>>,
<z3c.relationfield.relation.RelationValue object at 0x7fc85226c660 oid 0x28a7 in <Connection at 7fc858e36e50>>,
<z3c.relationfield.relation.RelationValue object at 0x7fc85226c7b0 oid 0x28c4 in <Connection at 7fc858e36e50>>],
'relationship_object': [<z3c.relationfield.relation.RelationValue object at 0x7fc852269c80 oid 0x2a83 in <Connection at 7fc858e36e50>>,
<z3c.relationfield.relation.RelationValue object at 0x7fc852256430 oid 0x322c in <Connection at 7fc858e36e50>>]})
$ outgoing_relations = api.relation.get(source=self.context, as_dict=True)
$ outgoing_relations
defaultdict(<class 'list'>, {})