Fetch Organization by Domain | Community
Skip to main content

Fetch Organization by Domain

  • July 11, 2023
  • 2 replies
  • 0 views

I am attempting to fetch a an organization by its domain instead of its name

When I execute

url = "https://<subdomain>.zendesk.com/api/v2/search.json?query=type:organization name:<org-name>".
 
This works and returns the correct org. This org has a  field 'domain_names': ['<org_domain>'].
 
I am also interested in only searching for an org by it's domain_name. Running the following

url = "https://<subdomain>.zendesk.com/api/v2/search.json?query=type:organization domain_names:<org_domain>'"
Returns an empty result. What needs to be changed?



2 replies

Greg29
  • July 12, 2023

Hi Mohammad! As far as I'm aware, that is not a valid query parameter, which is why it's not working. We don't offer a domain lookup in our org search options, however if you've seen this documented elsewhere, would you mind sharing it here so that I can look into it?


  • Author
  • July 12, 2023

Hi @greg29, thank you for getting back to me. I dug through the API reference docs and couldn't find this query parameter, but to me I made the assumption it could be valid. 

What would recommend in terms of best approach to finding an org by it's associated domain? I could fetch all the organizations and filter down by domain but that seems inefficient. 

If there is no workaround for this, could I make a feature request to expose domains as a valid query parameter?