Documentation for eduOER Search API
The base URL of the API is:
When you formulate a REST query, you have to decide which resource type you want. The resource type is the first word in your query and determines the format of the response data. The resource types currently offered are described below.
The akif type is a data model to represent educational resources related to agriculture and biodiversity.
The RESTful URL to request data from the akif resource begins:
Query features can be broken into two sections: What do you want? and How do you want it?
What do you want?
- Simple search.
- Searching within specific fields.
- Fetching specific items.
How do you want it?
- Sorting results.
- Faceting results.
Putting it all together
- Complex queries
This is just a keyword search against all the text fields. If don't know anything about the fields, but you know you want fossil, use the q parameter.
(items with fossil anywhere in any field).
Searching within specific fields
You don't know what you want, but you know it has to have oil in the english title. It doesn't just have to be the title, though. You can search for terms within any textual field except:
You do not need the q parameter when searching within a specific field. Use the field's name as a URL query string parameter instead.
You can combine specific field searches with simple search. You can also combine multiple field-specific searches. When combining field q parameters, separate them with an ampersand (&). These combinations are exclusive, meaning that result items fulfill all simple and field-specific criteria.
(items with KEEVOSH anywhere in the set field)
(items with oil anywhere in the languageBlocks.en.title field)
(items with en in the expressions.languages and sea in the languageBlocks.en.description)
Field & simple:
(items with ASETVALUE in the set and zebra in any field.)
(items with active or pending in the status.)
The eduOER Search API understands dates. Combine that with the fielded search above, and you've got a pretty spiffy way of finding records that have fields that fall before, after, and between dates.
The following examples search the creationDate field which is the time an akif or agrif document was created.
(items that were created on 1910)
Fetching specific items
Say you already have the set and id for the item you want, and you're just looking to get the rest of the metadata for that item. Simply add the set/id to the end of the items request. Bonus: You can search for multiple id's in the given set by separating the ids with a comma (,).
(item with the given set and id)
Sort stuff using the sort_by parameter. We’ll sort stuff in ascending order by default, but if you'd like to flip things, set the sort_order parameter to desc.
(items with fossil in any field, sorted by the languageBlocks.en.title)
(items with fossil in any field, sorted by creationDate)
(items with sea in any field, sorted by their english title)
Facets tell you the most common values for certain fields in a collection of items. We return a couple different types of facets depending upon the field you're looking for. For date fields, we'll send back facets of type date_histogram (which is what it sounds like). For complex text fields, we'll break it down for you into a terms type. For simple text fields, we'll also send back a terms type but with unadulterated values. And for geographic types, we'll give you a geo_distance type.
By default, we'll give you 10 items. If that's not enough, you can get the next ten items incrementing the page parameter (it's one-indexed). If that's still not enough, you can pull more items per page by using the page_size parameter (we'll limit you to 100 items per page because greediness is a vice).
http://<DOMAIN>/v1/akif?q=fossil&page_size=2 http://<DOMAIN>/v1/akif?q=sea&page_size=25 http://<DOMAIN>/v1/akif?q=sea&page_size=25&page=3
Let's get this APIarty started.
(items with both sea in any field and africa in the languageBlocks.en.title)
(the first 25 items with either sea or africa in the languageBlocks.en.description)