I would like to query metrics on an already predefined segment whose name is test or id is 1.
I have tried using the segment API and providing the following criteria &segment=name=test or&segment=id=1 but it seems not supported.
I could not find anything related to that in the documentation https://developer.matomo.org/api-reference/reporting-api-segmentation
Do I have to query the segment definition api first and applied it to the metrics api?
Specifying the segment ID or name is not possible currently. You would need to specify the actual segment definition. If needed, you could request the list of defined segments first to get the actual definition.
Thank you tsteur