-
Notifications
You must be signed in to change notification settings - Fork 1
REST API
Moritz Horn edited this page Dec 16, 2024
·
21 revisions
The REST API is implemented for the new GOKb Client and covers all needed services to implement the Application as a Single Page Application (SPA).
- request header should contain
Accept: application/json - add
Authorization: Bearerto the request header with the token from login has to be set to use the API - except LOGIN/REGISTER - use status code 200 to mark that the operation has been successful, 400 to mark a bad request, 401 for authorization failure
- use method GET to request a resource, POST to create a resource, PUT/PATCH to update a resource and DELETE to delete a resource implemented methods
POST ./rest/login
{
"username": "?",
"password": "?"
}
Status Code: 200
{
"username": "?",
"expires_in": 3600,
"roles":["?"],
"token_type":"Bearer",
"access_token": "?",
"refresh_token": "?"
}
Status Code: 401
-
POST ./oauth/access_token
grant_type=refresh_token
refresh_token="?"
see LOGIN
GET ./rest/profile
accept : application/json
authorization : Bearer <valid_access_token>
Status Code: 200
{
"data": {
"id":?,
"username":"?",
"displayName":"?",
"email":"?",
"curatoryGroups":[
{
"name":"?",
"id":<db-id>,
"uuid":"?"
}
],
"enabled":true,
"accountExpired":false,
"accountLocked":false,
"passwordExpired":false,
"defaultPageSize":40,
"roles":[
{"id": <db-id>,"authority":"ROLE_USER"},
...
],
"_links":{
"self":{
"href":"https://gokb.org/gokb/rest/profile"
},
"update":{
"href":"https://gokb.org/gokb/rest/profile"
},
"delete":{
"href":"https://gokb.org/gokb/rest/profile"
}
}
}
}
PUT ./home/profile/<id>
accept : application/json
authorization : Bearer <valid_access_token>
{
"email": "?",
"password": "?",
"new_password": "?"
}
Status Code: 200
{
"data": {
"id":?,
"username":"?",
"displayName":"?",
"email":"?",
"curatoryGroups":[
{
"name":"?",
"id":<db-id>,
"uuid":"?"
}
],
"enabled":<false|true>,
"accountExpired":<false|true>,
"accountLocked":<false|true>,
"passwordExpired":<false|true>,
"defaultPageSize":40,
"roles":[
{"id": <db-id>,"authority":"ROLE_USER"},
...
],
"_links":{
"self":{
"href":"https://gokb.org/gokb/rest/profile"
},
"update":{
"href":"https://gokb.org/gokb/rest/profile"
},
"delete":{
"href":"https://gokb.org/gokb/rest/profile"
}
}
}
}
GET ./rest/users/<id>
accept : application/json
authorization : Bearer <valid_access_token> (needs ROLE_ADMIN)
Status Code: 200
{
"data": {
"id":<db-id>,
"username":"...",
"displayName":"...",
"email":"?",
"curatoryGroups":[
{
"name":"...",
"id":<db-id>,
"uuid":"<uuid>"
}
],
"enabled":<false|true>,
"accountExpired":<false|true>,
"accountLocked":<false|true>,
"passwordExpired":<false|true>,
"defaultPageSize":40,
"roles":[
{"id": <db-id>,"authority":"ROLE_USER"},
...
],
"_links":{
"self":{
"href":"https://gokb.org/gokb/rest/users/..."
},
"update":{
"href":"https://gokb.org/gokb/rest/users/..."
},
"delete":{
"href":"https://gokb.org/gokb/rest/users/..."
}
}
}
}
POST ./rest/users
accept : application/json
authorization : Bearer <valid_access_token> (needs ROLE_ADMIN)
{
"username": "...",
"password": "...",
"email": "...",
"accountLocked": <true|false>,
"enabled": <true|false>,
"passwordExpired": <true|false>,
"roleIds": [<db-id>, ...],
"curatoryGroupIds": [<db-id>, ...],
}
Status Code: 201
Location: ./rest/users/<id>
PUT ./rest/users/<id>
accept : application/json
authorization : Bearer <valid_access_token> (needs ROLE_ADMIN)
{
"username": "...",
"email": "...",
"accountLocked": <true|false>,
"enabled": <true|false>,
"passwordExpired": <true|false>,
"roleIds": [<db-id>, ...],
"curatoryGroupIds": [<db-id>, ...],
}
Status Code: 200
{
"data": {
"id":?,
"username":"?",
"displayName":"?",
"email":"?",
"curatoryGroups":[
{
"name":"?",
"id":<db-id>,
"uuid":"?"
}
],
"enabled":<false|true>,
"accountExpired":<false|true>,
"accountLocked":<false|true>,
"passwordExpired":<false|true>,
"defaultPageSize":40,
"roles":[
{"id": <db-id>,"authority":"ROLE_USER"},
...
],
"_links":{
"self":{
"href":"https://gokb.org/gokb/rest/users/..."
},
"update":{
"href":"https://gokb.org/gokb/rest/users/..."
},
"delete":{
"href":"https://gokb.org/gokb/rest/users/..."
}
}
}
}
GET ./rest/packages/<id>
Status Code: 200
{
"_links":{
"self":{
"href":"https://gokb.org/gokb/rest/packages/43567426"
},
"update": {
"href":"https://gokb.org/gokb/rest/packages/43567426"
},
"delete":{
"href":"https://gokb.org/gokb/rest/packages/43567426"
},
"retire":{
"href":"https://gokb.org/gokb/rest/packages/43567426/retire"
}
},
"type":"Package",
"_embedded":{
"additionalProperties":[],
"variantNames":[],
"reviewRequests":[],
"prices":[],
"subjects":[],
"ids":[
{
"id":<db-id>,
"uuid":"<db-uuid>",
"version":"?",
"value":"?",
"namespace":{
"name":"?",
"type":"Identifier Namespace",
"id":?,
"value":"?"
},
"language":null
}
],
"curatoryGroups":[
{
"_links":{
"self":{
"href":"https://gokb.org/gokb/rest/curatoryGroups/<db-id>"
},
"update":{
"href":"https://gokb.org/gokb/rest/curatoryGroups/<db-id>"
},
"delete":{
"href":"https://gokb.org/gokb/rest/curatoryGroups/<db-id>"
},
"retire":{
"href":"https://gokb.org/gokb/rest/curatoryGroups/<db-id>/retire"
}
},
"type":null,
"id":<db-id>,
"dateCreated":"<timestamp>",
"uuid":"<db-uuid>",
"version":"?",
"superordinatedGroup":null,
"name":"?",
"editStatus": {
"name":"<Approved|In Progress|Rejected>",
"type":"Refdata Value",
"id":<db-id>
},
"lastUpdated":"<timestamp>",
"language":null,
"source":null,
"status":{
"name":"<Current|Retired|Expected|Deleted>",
"type":"Refdata Value",
"id":<db-id>
},
"organizationType":{
"name":"<Library|Provider|Consortium>",
"type":"Refdata Value",
"id":<db-id>
},
"description":null,
"email":"?"
}
]
},
"id":<db-id>,
"dateCreated":"<timestamp>",
"paymentType":{
"name":"<Paid|Free|Unknown>",
"type":"Refdata Value",
"id":<db-id>
},
"uuid":"<db-uuid>",
"consistent":{
"name":"<Yes|No|Unknown>",
"type":"Refdata Value",
"id":<db-id>
},
"version":"?",
"lastCachedDate":"<timestamp>",
"name":"?",
"breakable":{
"name":"<Yes|No|Unknown>",
"type":"Refdata Value",
"id":<db-id>
},
"contentType":{
"name":"<Journal|Book|Database|Mixed>",
"type":"Refdata Value",
"id":<db-id>
},
"descriptionURL":"?",
"editStatus":{
"name":"<Approved|In Progress|Rejected>",
"type":"Refdata Value",
"id":<db-id>
},
"listVerifier":<db-id>,
"listVerifiedDate":<date>,
"lastUpdated":"<timestamp>",
"fixed":{
"name":"<Yes|No|Unknown>",
"type":"Refdata Value",
"id":<db-id>
},
"language":,
"source":{
"name":"?",
"type":"Source",
"id":<db-id>
},
"listStatus":{
"name":"<Checked|In Progress>",
"type":"Refdata Value",
"id":<db-id>
},
"globalNote":"?",
"global":{
"name":"<Global|Consortium|Regional|Local>",
"type":"Refdata Value",
"id":<db-id>
},
"scope":{
"name":"<Front File|Back File|Aggregator|Master File>",
"type":"Refdata Value",
"id":<db-id>
},
"status":{
"name":"<Current|Retired|Expected|Deleted>",
"type":"Refdata Value",
"id":<db-id>
},
"description":"?",
"provider":{
"id":<db-id>,
"name":"?",
"type":"Organization",
"uuid":"<db-uuid>"
},
"nominalPlatform":{
"id":<db-id>,
"name":"?",
"type":"Platform",
"uuid":"<db-uuid>"
},
"_tippCount":?
}
POST ./rest/packages
accept : application/json
authorization : Bearer <valid_access_token> (needs ROLE_EDITOR)
{
"id": <db-id>,
"name": "?",
"source": <db-id>,
"status": <db-id>,
"descriptionURL": "...",
"description": "...",
"scope": <db-id>,
"global": <db-id>,
"globalNote": "...",
"contentType": <db-id>,
"consistent": <db-id>,
"breakable": <db-id>,
"fixed": <db-id>,
"subjects": [],
"listStatus": <db-id>,
"editStatus": <db-id>,
"ids": [],
"provider": <db-id>,
"nominalPlatform": <db-id>,
}
Status Code: 201
Location: ./rest/packages/<id>
PUT ./rest/packages/<id>
Status Code: 200
GET ./rest/identifiers/<id>
Status Code: 200
POST ./rest/identifiers
Status Code: 201
Location: ./rest/identifiers/<id>
PUT ./rest/identifiers/<id>
Status Code: 200
Provider Platform Title Package TitleInstancePackagePlatform (TIPP) Review Curatory Group