IPIF / prosopogrAPhI

Tentative way towards a shared API for prosopographical data based on the factoid model (Bradley/Short 2005)
24 stars 6 forks source link

JSON-HAL HATEOAS compliant refs #16

Open Schiller-Stoff opened 4 years ago

Schiller-Stoff commented 4 years ago

My question is: Wouldn't it be better for an API-consumer to have JSON-HAL conform JSON-Response available? Otherwise a consumre would have to implement API logic in the client code and could not rely on abstract REST-traversel features provided by HATEOAS using e.g. the Traverson library in Spring-Boot or in Javascript.

So instead of implicit knowledge on client side, each REST-Response (and so the server-side) would include the knowledge about how to traverse / use the API for further information, following the factoid model. E.g. instead of providing ids in the response, we could use full urls in an HAL-conform way to inform a consumer on how to further use rest-parameters / what further paths are etc.

HAL Spec: http://stateless.co/hal_specification.html

Example of JSON-HAL: image

Schiller-Stoff commented 4 years ago

13 related?

Schiller-Stoff commented 4 years ago

@gvasold @GVogeler

GVogeler commented 4 years ago

sounds reasonable. So we would replate the refs section with something like the following?

{
    "_links": {
        "curies": [
            {
              "name": "api",
              "href": "/{rel}",
              "templated": true
            }
        ],
        "api:factoid-ref" : { "href": "/factoid/{@id}" , templated:True}
    }
}

I currently don't get, how the OpenAPI-datamodel description is combined with the HAL formalism: maybe https://github.com/OAI/OpenAPI-Specification/issues/577 helps.