Identifier Lists¶
The Identifier Lists endpoint creates (or finds, if one already exists) a reusable list of scholarly identifiers and returns its unique ID. The returned identifier_list_id can then be supplied via filter[identifier_list_id] to other endpoints.
The endpoint is idempotent. Submitting the same identifier content again returns the same id rather than creating a duplicate list.
Supported identifier types¶
Identifiers can be separated by whitespace (spaces, tabs, or newlines) and may be mixed in a single request. The following types are recognised:
| Type | Example |
|---|---|
| DOI | 10.1038/nplants.2015.3 |
| Handle | 2027.42/123456 |
| ISBN | 978-3-16-148410-0 |
| URI | https://example.org/article |
| URN | urn:isbn:978-3-16-148410-0 |
| PubMed ID | 29317830 |
| arXiv ID | arXiv:1501.00001 |
| ADS Bibcode | 2015Natur.519..456S |
| RePEc ID | RePEc:eee:ecolet:v:99:y:2008:i:3:p:415-417 |
| National Clinical Trial ID | NCT00000000 |
| Altmetric ID | altmetric:12345 |
The altmetric: prefix is required for Altmetric IDs to disambiguate them from PubMed IDs.
Request¶
POST /explorer/api/identifier_lists¶
POST /explorer/api/identifier_lists HTTP/1.1
Host: www.altmetric.com
Content-Type: application/x-www-form-urlencoded
key={key}&digest={digest}&identifiers={identifiers}
POST request to create (or find) an identifier list.
Warning
The identifiers parameter must be supplied in the request body. Sending it in the query string returns an identifiers_must_be_in_body error.
Example request:
POST /explorer/api/identifier_lists HTTP/1.1
Host: www.altmetric.com
Content-Type: application/x-www-form-urlencoded
key=YOUR_API_KEY&digest=YOUR_DIGEST&identifiers=10.1038%2Fnplants.2015.3%0Aaltmetric%3A12345
Body parameters:
| Parameter | Required | Accepts | Description |
|---|---|---|---|
key |
Yes | A valid key | See Authentication |
digest |
Yes | A valid digest | See Digest below |
identifiers |
Yes | Whitespace-separated list of identifiers | The raw list of identifiers, separated by whitespace (spaces, tabs, or newlines). Up to 25,000 tokens per list. See Supported identifier types. |
Digest¶
Unlike the other Altmetric Explorer API endpoints, the digest for this endpoint is the HMAC-SHA1 of the raw identifiers body content (using your API secret as the key, with hyphens stripped). The alphabetical-filter convention described in Signing your own requests does not apply here, because this endpoint has no filters.
api_secret = 'YOUR_API_SECRET'
identifiers = "10.1038/nplants.2015.3\naltmetric:12345"
digest = OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('SHA1'), api_secret.delete('-'), identifiers)
#=> "YOUR_DIGEST_RESULT"
The same byte-for-byte string passed as identifiers in the body must be used to compute the digest — including any whitespace.
Response object¶
A successful POST request to the identifier_lists endpoint returns a JSON object with the following keys.
Errors¶
An array of objects containing information relating to any errors preventing the response from being returned. See Status codes for additional information.
| Key | Type | Description |
|---|---|---|
status |
string | HTTP response code relating to the request. |
code |
string | Altmetric status code for the error. |
title |
string | The Altmetric assigned title for the error. |
detail |
string | A detailed description of what the error is. |
source |
object | An object that contains information relating to the cause of the error. See Source for more information. |
Source¶
An object that contains the parameter that resulted in the error.
| Key | Type | Description |
|---|---|---|
key |
string | Currently the only key returned is parameter |
value |
string | Available values are key and digest |
Status codes¶
These error codes are common to every Altmetric Explorer API endpoint. Some endpoints define additional error codes, which are documented on their respective pages.
| Status | Code | Title | Details |
|---|---|---|---|
400 |
missing_api_key |
Missing API key | Requests to the Altmetric Explorer API must include your API key in the "key" parameter. You did not supply a key. |
400 |
invalid_api_key |
Invalid API key | Requests to the Altmetric Explorer API must include your API key in the "key" parameter. The supplied key was not valid. |
400 |
expired_api_key |
Expired API key | Requests to the Altmetric Explorer API must include your API key in the "key" parameter. The supplied key was expired. |
400 |
invalid_digest |
Invalid API request signature | Requests to the Altmetric Explorer API must be signed with your API secret, and the digest provided in the "digest" parameter. The signature for this request was missing or invalid. |
400 |
invalid_filter_format |
Invalid filter format | The "filter" parameter must be a hash of filter criteria. The supplied filter was not in the correct format. |
400 |
no_api_access |
API access not allowed | Your organisation does not have access to the Altmetric Explorer API. |
Errors example¶
{
"meta": {
"response": {
"status": "error"
}
},
"errors": [
{
"status": "400",
"code": "invalid_digest",
"title": "Invalid API request signature",
"detail": "Requests to the Altmetric Explorer API must be signed with your API secret, and the digest provided in the \"digest\" parameter. The signature for this request was missing or invalid.",
"source": {
"parameter": "digest"
}
}
]
}
Additional error codes¶
In addition to the common error codes, the identifier lists endpoint can return:
| Status | Code | Title | Details |
|---|---|---|---|
400 |
identifiers_must_be_in_body |
Identifiers must be in the request body | The "identifiers" parameter must be supplied in the POST request body, not in the query string. |
400 |
invalid_identifier_list |
Invalid identifier list | The "identifiers" parameter must be a non-empty list of identifiers within the allowed token limit. |
Data¶
A single object describing the created (or found) identifier list.
| Key | Type | Description |
|---|---|---|
id |
string (UUID) | The unique identifier list ID. Pass this as filter[identifier_list_id] on other endpoints to query against this cohort. |
counts |
object | Number of recognised identifiers, grouped by type. See Counts. |
content |
string | The raw identifiers text exactly as submitted. |
Counts¶
The counts object only includes keys for identifier types that were recognised in the submitted content. Possible keys:
| Key | Description |
|---|---|
dois |
Number of DOIs recognised. |
altmetric_ids |
Number of Altmetric IDs recognised. |
pmids |
Number of PubMed IDs recognised. |
isbns |
Number of ISBNs recognised. |
urns |
Number of URNs recognised. |
uris |
Number of URIs recognised. |
handles |
Number of Handles recognised. |
arxiv_ids |
Number of arXiv IDs recognised. |
ads_ids |
Number of ADS bibcodes recognised. |
repecs |
Number of RePEc IDs recognised. |
nct_ids |
Number of National Clinical Trial IDs recognised. |
Unrecognised tokens are silently dropped from the counts but are preserved in content.
Data example¶
{
"id": "5aca0b58-1e10-423f-80e9-6499ce59cebb",
"counts": {
"dois": 2,
"altmetric_ids": 1
},
"content": "10.3133/pp1348 altmetric:101427008 10.1007/bf01734359"
}
Example response¶
{
"meta": {
"response": {
"status": "ok"
}
},
"data": {
"id": "5aca0b58-1e10-423f-80e9-6499ce59cebb",
"counts": {
"dois": 2,
"altmetric_ids": 1
},
"content": "10.3133/pp1348 altmetric:101427008 10.1007/bf01734359"
}
}
Using the list¶
Once you have an id from the response, pass it as the identifier_list_id filter on any of the other Explorer API endpoints to query against the cohort:
GET /explorer/api/research_outputs?key=YOUR_API_KEY&digest=YOUR_DIGEST&filter[identifier_list_id]=5aca0b58-1e10-423f-80e9-6499ce59cebb HTTP/1.1
Host: www.altmetric.com
The digest for that GET is computed using the normal alphabetical-filter convention — see Signing your own requests. In this case the signing string would be identifier_list_id|5aca0b58-1e10-423f-80e9-6499ce59cebb.