Authentication
When you want to use API calls that require authentication, you have to log in first.
A successful login call returns a JSON object like this:
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVC...",
"expiresIn": "12h",
"user": {
"role": "user",
"email": "arthur.dent@thhgttg.com",
"firstName": "Arthur",
"lastName": "Dent",
}
}
For every following request, make sure to set the bearer token in the request header when trying to access restricted resources.
Note, that you have to add the string “Bearer ” to the value of the token you got from the login!
http-request-header Example
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6Imdlb3JnLnBldHJvdmljQHJlZHBvc...
Differences to the ETER II API
Difference in API base URL
Old:
https://www.eter-project.com/api/eter/...
New:
https://www.eter-project.com/api/3.0/...
Several differences in API calls
For details on the new API calls please see the API documentation here:
The HEI query API call
The /HEIs/query API call is the most complex one in the API and needs some more info.
This is a http-POST request, that needs the following transmitted as JSON in the request body:
{
"filter": {},
"fieldIds": {},
"searchTerms": []
}
The “filter” part is a mongoose query object (for details please see the official mongoose documentation).
Note, that all variables are stored in a structured way and are accessible via their package and fieldId as key. This is what e.g. the field BAS.WEBSITE looks like:
{
"BAS" : {
"WEBSITE" : {
"v" : "https://www.fh-joanneum.at/"
}
}
}
So, if you would like to filter by this field in the query, you would have to send something like this:
{
"filter": {"BAS.WEBSITE.v": "https://www.fh-joanneum.at/"},
"fieldIds": {},
"searchTerms": []
}
The “fieldIds” part specifies, what variables to retrieve from each HEI. If you ommit this, ALL the variables are selected.
Here is an example for selecting only the ETER-ID and the field containing the website:
{
"filter": {"BAS.WEBSITE.v": "http://www.uni-graz.at/"},
"fieldIds": {"BAS.ETERIDYEAR": 1, "BAS.WEBSITE": 1},
"searchTerms": []
}