v1

latestOpenAPI 3.0.02026-07-1424397.4 KB
Organisation

Search for organisations

Overview

Use this endpoint to find information about services provided by NHS organisations.

For more information on how to use search identifiers with this endpoint, see DoHS API guide to search identifiers and service codes.

Sandbox test scenarios

You can test the following scenarios in our sandbox environment:

ScenarioRequestResponse
All organisationsNo parametersHTTP status 200 with all organisations
Single organisationsearch=Y02494HTTP status 200 with single organisation
Search By ODS Code and Filter by EPS enabledsearchFields=ODSCode <br /> $filter=IsEpsEnabled eq 'true'HTTP status 200 with filtered results
Filtered by EPS enabled and organisation typesearch=pharmacy2u <br /> searchfields=OrganisationName <br /> $filter=IsEpsEnabled eq 'true' and OrganisationTypeId eq 'PHA' and OrganisationSubType eq 'DistanceSelling'HTTP status 200 with filtered results
Search by locationsearch=Bletchley <br /> searchfields=Address3,City,CountyHTTP status 200 with found organisations
Filtered by EPS enabled, organisation type and ordered by geocode$filter="IsEpsEnabled eq 'true' and OrganisationTypeId eq 'PHA' and OrganisationSubType eq 'Community'" <br /> $orderby= geo.distance(Geocode, geography'POINT(-0.76444095373153675 52.000820159912109)')HTTP status 200 with ordered results
Filtered by postcode, EPS enabled and organisation type$filter=search.ismatch('B11', 'Postcode') and IsEpsEnabled eq 'true' and OrganisationTypeId eq 'PHA' and OrganisationSubType eq 'Community'Http status 200 with filtered results
Filtered by closing time and locationsearch=Bletchley <br /> searchFields=Address3 <br /> $filter=OpeningTimes / any (x: x/ClosingTime eq '14:00')Http status 200 with filtered results
Filtered by location, EPS enabled and wheelchair accesssearch=Bletchley <br /> searchFields=Address3 <br /> $filter=Facilities / any (x: x/Name eq 'Wheelchair access' and x/Value eq 'Yes') and IsEpsEnabled eq 'true'Http status 200 with filtered results
No organisations foundsearch=no-organisationHTTP status 200 with no organisations
Invalid API versionNo api-version parameterHTTP status 404 with problem description

You can try out the sandbox using the 'Try this API feature' on this page.

get/

Query parameters

api-versionnumber required

The API version number can be supplied as a query parameter.

searchstring

The text to search for. All searchable fields are searched by default unless searchFields is specified.

When searching searchable fields, the search text itself is tokenized, so multiple terms can be separated by white space, for example search=hello world.

To match any term, use * which can be useful for boolean filter queries. Omitting this parameter has the same effect as setting it to *.

searchMode'any' | 'all'

Defaults to any. Specifies whether any or all of the search terms must be matched in order to count the document as a match.

searchFieldsstring

A comma-separated list of field names to search for the specified text. This field works in conjunction with the search field.

Example search field: searchFields=ODSCode

queryType'simple' | 'full'

When set to simple, search text is interpreted using a simple query language that allows for symbols such as +, * and "".

When the query type is set to full, search text is interpreted using the Lucene query language which allows field-specific and weighted searches.

The following example is a search over independent terms, with a requirement that all matching documents include pool.

For more information, see Simple query syntax in Azure Cognitive Search.

Example using simple query type:

queryType=simple

search=budget hotel +pool

searchMode=all

This particular example shows in-field search and term boosting. It looks for hotels where the category field contains the term budget.

Any documents containing the phrase recently renovated are ranked higher as a result of the term boost value.

For more information, see Lucene query syntax in Azure Cognitive Search.

Example using full query type:

queryType=full

search=category:budget AND \'recently renovated\'^3

searchMode=all

$skipnumber

The number of search results to skip. For example, $skip:25 returns the entries after the first 25 entries in the search results.

$topnumber

The number of search results to retrieve. The default is 50.

$countboolean

Optional, defaults to false. Specifies whether to fetch the total count of results.

This is the count of all documents that match the search and $filter parameters, ignoring $top and $skip.

Setting this value to true may have a performance impact. The count returned is an approximation.

If you’d like to get only the count without any documents, you can use $top=0.

$orderBystring

A list of comma-separated expressions to sort the results by. Each expression can be either a field name or a call to the geo.distance() function.

Each expression can be followed by asc to indicate ascending, and desc to indicate descending. The default is ascending order.

This $orderBy routine orders the results by the distance from the geography point included in the expression.

The geography point can be a position from where you are and the results are ordered by how local the results are.

For more information, see Simple query syntax in Azure Cognitive Search.

Example: $orderby=geo.distance(Geocode, geography'POINT(-0.76444095373153675 52.000820159912109)')

$selectstring

A list of comma-separated fields to include in the result set.

If unspecified or set to *, all fields marked as retrievable in the schema are included in the projection.

Example: $select=ODSCode,OrganisationName,Contacts,Address1,Address2,Address3,City,Postcode,OrganisationSubType

$filterstring

A structured search expression in standard OData syntax.

The $filter parameter specifies inclusion or exclusion criteria for returning matches in search results.

For more information on using the $filter, see OData $filter syntax in Azure Cognitive Search.

Examples:

Filter results by Pharmacies that are EPS-enabled and classed as 'Community', that is, IsEpsEnabled is true, Organisation Type is PHA and Sub Type is Community:

$filter=IsEpsEnabled eq 'true' and OrganisationTypeId eq 'PHA' and OrganisationSubType eq 'Community'

Filter results that match our postcode, that is Postcode field is NG16:

$filter=search.ismatch('NG16', 'Postcode')

Filter results by Postcode is CW9 and `OrganisationTypeId" is a dentist:

$filter=search.ismatch('CW9', 'Postcode') and OrganisationTypeId eq 'DEN'

For details on organisation types and service codes, see organisation and service codes.

Response

Search Response

@odata.contextstring uri
@odata.countnumber
@odata.nextstring uri