Select to view content in your preferred language

Is it posible to query for a specific domain. QueryDomains returns all

173
1
03-20-2026 07:20 AM
CarstenB_orsted
Occasional Contributor

Hi All

I need to get the domain codes for a specific domain. I can use QueryDomains, but that returns all domains.

Is there a way to query for a specific domain using the REST API?

Otherwise I will have to filter the json afterwards, which I would like to avoid.

Regards

Carsten

Tags (2)
0 Kudos
1 Reply
TimWestern
MVP Regular Contributor

@CarstenB_orsted I had thought that domains get attached to fields, and if you query the layer for the fields definitions that you could find what domain goes with it that way.  Not sure if it can be done via URL alone though.

I think you can write an easy JS method like this:

function getDomainByName(serviceJson, domainName) {
  if (serviceJson.domains?.[domainName]) {
    return serviceJson.domains[domainName];
  }
  return null;
}


other options might be to do the filter client side like this: 

const domain = domains.find(d => d.name === "MyDomain");





Can you do it from a layer definition like this? /FeatureServer/0?f=json

When I do this in code I usually either get the full list, and then known which one to look for by the field name that's associated, or hard code it in advance.

That I realize, doesn't help if you aren't working in custom code though.

0 Kudos