hashtopolis/server

[BUG]: new API: Duplicate links object in get one API responses

Opened this issue · 0 comments

Version Information

0.14.3

Hashcat

No response

Description

Currently when you do a get one API call you will get the same links object twice in the response:

  1. At the top level of the response (document-level links).
  2. Inside the data object (resource-level links).

For example the GET call to: 'http://localhost:8080/api/v2/ui/crackertypes/1' will return:

{
"jsonapi": {
"version": "1.1",
"ext": [
"https://jsonapi.org/profiles/ethanresnick/cursor-pagination"
]
},
"links": {
"self": "/api/v2/ui/crackertypes/1"
},
"data": {
"type": "crackerBinaryType",
"id": 1,
"attributes": {
"typeName": "hashcat",
"isChunkingAvailable": true
},
"links": {
"self": "/api/v2/ui/crackertypes/1"
},
"relationships": {
"crackerVersions": {
"links": {
"self": "/api/v2/ui/crackertypes/1/relationships/crackerVersions",
"related": "/api/v2/ui/crackertypes/1/crackerVersions"
}
},
"tasks": {
"links": {
"self": "/api/v2/ui/crackertypes/1/relationships/tasks",
"related": "/api/v2/ui/crackertypes/1/tasks"
}
}
}
}
}

In this response you see the top level link object for the document and the link object for the specific object in the data section, which are the same. This redundancy is more useful in GET requests for multiple resources, where the document-level links differ from the resource-specific links.

My suggestion for this is to remove the links object in the data section for responses to get one API calls.