- Previous: Querystring parameters
- Up: Getting started using the Springer API portal
- Next: Example Metadata responses
Adding Constraints
The Springer API allows you to limit the results returned by adding contraints to your request. Constrains should appear in your request as a "constraint:argument" pair.
There are three types of constrains: "equals" constraints, "contains" constriants, and "display" contraints. These three types of constraints behave differently.
"Equals" Constraints
When an "equals" constraint is used, the relevant element value in an article or chapter must match the specified argument exactly in order for that content item to appear in the results.
For example, the request:
http://api.springer.com/metadata/pam?q=subject:Math&api_key=APIKEYHERE
will return zero results because - although there are documents where the subject element contains the string "math" (e.g., Mathematics) - there are no documents where the value in a subject element is exactly the string "math".
"Equals" constraints are also case sensitive. So, use of the constraint pair, "subject:mathematics" will also return zero results while the constraint pair, "subject:Mathematics" will return many results.
The API currently supports the following "equals" constraints:
| Constraint | Description | Applies to collection | Example Query |
| doi: | limit to a single Digital Object Identifier | M,O,I | http://api.springer.com/images/xml?q=doi:10.1007/s00392-007-0618-5&api_key=... |
| subject: | limit to the specified subject collection | M,O,I | http://api.springer.com/openaccess/app?q=subject:Biochemistry&api_key=... |
| keyword: | limit to articles tagged with a keyword | M,O,I | http://api.springer.com/images/xml?q=keyword:%22nonlinear%20optimization%22&api_key=... |
| pub: | limit to articles from a particular publication | M,O | http://api.springer.com/metadata/pam?q=pub:Extremes&api_key=... |
| year: | limit to articles/chapters published in a particular year | M,O,I | http://api.springer.com/images/xml?q=year:2007&api_key=APIKEYHERE |
| country: | limit to articles authored in a particular country | M,O | http://api.springer.com/openaccess/app?q=country:%22New%20Zealand%22&api_key=... |
| isbn: | limit to a single International Standard Book Number | M,O,I | http://api.springer.com/metadata/json?q=isbn:978-0-387-79148-7&api_key=... |
| issn: | limit to a single International Standard Serial Number | M,O,I | http://api.springer.com/images/xml?q=issn:1861-0692&api_key=... |
| date: | limit to documents published on a particular date {yyyy-mm-dd} | M,O,I | http://api.springer.com/openaccess/app?q=date:2010-03-01&api_key=... |
| openaccess: | include only open access content: {true, false} | I | http://api.springer.com/images/xml?q=openaccess:true&api_key=... |
| type: | limit to either Book or Journal content {Book, Journal} | M,O,I | http://api.springer.com/metadata/json?q=type:Book&api_key=... |
| imagetype: | limit to images of a particular type: {Image, Table, Video} | I | http://api.springer.com/images/jsonp?q=imagetype:Table&api_key=... |
"Contains" Constraints
When a "contains" constraint is used, the response will include documents where the specified argument is contained anywhere in the relevant element.
The API currenlty supports the following "contains" constraints:
| Constraint | Description | Applies to collection | Example Query |
| "empty" | A word or phrase that appears among the constraints but is not preceded by a constraint value will be treated as the argument of the "empty constraint". Requests of this type will locate documents that contain the specified word or phrase in any element. | M,O,I | http://api.springer.com/images/json?q=%22user%20experience%22&api_key=... |
| title: | locate documents containing a word or phrase in the "article/chapter title" element | M,O,I | http://api.springer.com/metadata/pam?q=title:%22game%20theory%22&api_key=... |
| orgname: | locate documents containing a word or phrase in the "organization name" element | M,O | http://api.springer.com/metadata/json?q=orgname:Paris&api_key=... |
| journal: | locate documents containing a word or phrase in the "journal title" element | M,O | http://api.springer.com/openaccess/app?q=journal:informatics&api_key=... |
| book: | locate documents containing a word or phrase in the "book title" element | M,O | http://api.springer.com/metadata/pam?q=book:%22social%20network%22&api_key=... |
| name: | locate documents containing a word or phrase in the "author name" element | M,O | http://api.springer.com/openaccess/app?q=name:Salvador&api_key=... |
"Display" Constraints
There is only one "display" constraint currently supported.
| Constraint | Description | Applies to collection | Example Query |
| sort: | sorts results by publication date in reverse chronological order {date} | M | http://api.springer.com/metadata/app?q=subject:Biochemistry%20sort:date&api_key=... |
Using Multiple Constraints:
Each constraint that appears in your request will automatically be ANDed with all the others. For instance, a request including constraints: "title:bone+name:Jones" is the equivilent to the request containing constraints concatenated by the AND operator: "title:bone%20AND%20name:Jones".
To alter this behaviour you can include the OR operator to broaden the results.
E.g., a request containing the constraints:"title:bone%20OR%20name:Jones", would return results where either the title contained the string "bone" or the author name contained the string "Jones".
Brackets "( )" can also be used to help structure these boolean constructs.
For example, here is a valid request that uses brackets to group constraints:
http://api.springer.com/metadata/pam?q=(title:%22game%20theory%22%20OR%20title:%22perfect%20information%22)%20chess&api_key=...
This request returns documents where the title either includes the phrase "game theory" or includes the phrase "perfect information" but will only return documents where the word "chess" appears somewhere in the document.
Excluding Constraints:
Any constraint can be negated by surrounding the constraint:argument pair with "( )" and then preceeding it with the minus or hyphen symbol. This operation will remove any results that meet the negated criteria from the response.
For example, the request containing the constraints:
"Smith%20-(name:Fry)%20journal:Planta%20chlorophyll"
will return all documents from the journal "Planta" containing the word chlorophyll where the author name field contains the string "Smith" except for the articles where the author field contains the string "Fry".
Helpful Hints
- Because the {space} character (represented as "%20" or "+") is used to separate "constraint:argument" pairs, whenever the argument of a constrain is a multi-word phrase (e.g: "bone substitute"), the quote symbol (represented by %22 in a URL) must be used surround the phrase in order for the included {space} to be recongnized as part of the argument.
For example, consider the "constraint:argument" pair, "orgname:%22University%20of%20Calgary%22".
If the "%22" quotes were omitted from this request, i.e., "orgname:University of Calgary" the API will interpret this request as having three distinct constraints:
1) "orgname:University" 2) "of" and 3) "Calgary" (where "of" and "Calgary" are arguments of "empty" constraints)
The request without quotes would return all documents were "University" appears in the organization name and where the words "of" and "Calgary" appear anywhere in the document
7 Comments
Mohamed Barakat – 2 years ago
hi
gkamsu – 2 years ago
excuse me, it is possible to find out all the citation in a particular book?
Eddie – 2 years ago
I guess this is the same question from the Quotation thread, but I'll paste the reply anyway:
Do you refer to the metadata API? If so, there are no references to other books available via this API (e.g., http://api.springer.com/metadata/pam?q=isbn:978-1-84800-328-6&api_key=). The openaccess API, however, will have any references that are available, e.g., http://api.springer.com/openaccess/app?q=doi:10.1186/1471-2261-6-8&api_Key=.
Eddie
Alix Axel – 1 year ago
The HTML source of this page is leaking a metadata API key near the first example URL.
Robert – 1 year ago
Can the API do date ranges? To only search for items for an exact day seems a little strange.
Robert – 1 year ago
Typo: "recongnized " -> "recognized"
Eddie – 1 year ago
It does not do ranges per se, but you can use an OR function, e.g., for multiple year queries: -- http://api.springer.com/metadata/pam?q=(year:2009 OR year:2010 OR year:2011)&p=5&api_key= -- http://api.springer.com/metadata/pam?q=(date:2010-03-01 OR date:2011-03-01)&p=5&api_key=
Regards
Eddie
Please sign in to post a comment.