This guide provides information on how to form Datastore version 3 API queries. A subset of the Datastore API’s features and options is provided below. A full list of features that IATI is committed to maintain is outlined in the API contract. All features in the SOLR API documentation can be used as part of the Datastore v3 API, however those not in IATI’s API contract may be changed and updated over time.
- Datastore v3 API contract - The contract contains the full list of search and filtering options IATI is committed to maintain in the Datastore v3 API. Key features are highlighted below.
- SOLR documentation - This contains all of the features available via SOLR. The list of SOLR features is larger than those IATI is committed to maintain in the Datastore v3 API.
Examples of complex API calls can be found here.
Each user is required to have a free account and include their subscription key when making queries. The details below show how to form the API query, as well as how to do so using the API Gateway’s Query Field.
Please note, users of the IATI Datastore will need to have technical competency and understand the basic structure and elements of the IATI Standard. Please see Tools and resources for data use for other ways of accessing IATI data.
Return data formatted as either one activity, transaction or budget per row. Each endpoint returns all activity data related to that activity, transaction or budget.
In the Query Field use the collection parameter, choose a drop down option of activity, transaction or budget:
How to add activity filters
The first filter is added using the sequence `q=`, following this, further filters can be added using `AND`, `OR`, `NOT` and + (+ means AND/OR but cannot be expressed using text).
Attribute Code Searches
- Search for a specific attribute code: q=sector_code:11110
- Search for multiple attribute codes: q=recipient_country_code:(UG TZ)
- Search for one code OR another: q=sector_code:11110 OR transaction_sector_code:11110
- Search for one code AND another: q=recipient_country_code:UG AND sector_code:11110
- Search for one code AND/OR another: q=recipient_country_code:UG + sector_code:11110
- Search for one code but NOT another: q=recipient_country_code:UG NOT sector_code:11110
- Freetext search in a specific narrative: q=description_narrative:rabbit
- Freetext search in multiples narratives: q=title_narrative:rabbit OR description_narrative:rabbit OR iati_identifier:rabbit OR transaction_description_narrative:rabbit
- Freetext search for two words in a specific narrative: q=title_narrative:(rabbit AND production)
- Freetext search for a phrase in a specific narrative: q=title_narrative:“rabbit production”
Note, the iati-identifier is counted as a narrative field in the IATI Datastore. Use quotes to find a specific activity e.g. q=iati_identifier:“US-GOV-1-AID-OAA-TO-14-00001”
Further narrative search options
- * = wildcard, returns matches with zero or more letters
E.g. apple* returns apple, apples and appleseeds
- ? = single character, returns matches which include a single character
E.g. te?t returns test and text
Note: to use * and ? as wildcards in narrative searches, the search term MUST NOT be quoted. If quoted, * and ? symbols will be searched for in the narrative text.
How to search dates and financial values
The API allows users to select date and financial values within a certain range. This is added in the format [* TO *].
- q=transaction_value:[* TO 10000] finds all field values less than or equal to 10000.
- q=activity_date_iso_date:[2021-01-01T00:00:00Z TO *] finds all activities that have an activity date later 1st Jan 2021.
Note: The SOLR API cannot search for both the type and iso-date within a single activity-date element. This means you cannot select only start or end dates to search by; this needs to be done by the user or programme once the JSON/XML/CSV output has been retrieved.
In the Query Field use the q parameter, then add the combination of filters required using the guidance above e.g.
|q||title_narrative:(rabbit AND production)|
Return specific columns
In the Query Field use the fl parameter, then add the list of data fields to return e.g.
How to select the format:
In the Query Field use the wt parameter, choose one of the three options: json, xml or csv
How to select number of rows
If not used, a default of 10 results will be returned.
A maximum of 1000 rows can be returned per API call. Use the &start parameter to select which row to start from.
In the Query Field use the rows and start parameter, then specify the number required e.g.
Names of elements/attributes:
Names of elements and attributes are based upon the names and path provided in the IATI Schema. Each sequence of non-alpha characters is replaced with a ‘_’.
|IATI Name||API Name|
A full list of the names and paths, plus the data type of each element and attribute can be found in the Activity Summary Table.
The API will encode certain characters. Either the character or the encoding can be used when typing/pasting in an API. For example: