dina-web-nrm / collections-api

dina-web (dina-datamodel)
0 stars 0 forks source link

Align to JSONAPI.org #3

Open caalle opened 8 years ago

caalle commented 8 years ago

We need to update the API response to align to the jsonapi.org specification. See: jsonapi.org/format/

Example:

{
  "type": "collectionobject",
  "id": "1",
  "attributes": {
    "title": "Rails is Omakase"
  },
  "relationships": {
    "determinations": {
      "links": {
        "self": "http://example.com/collectionobject/1/relationships/determinations",
        "related": "http://example.com/articles/1/author"
      },
      "data": [
        {"type": "determination", "id": "2"},
        {"type": "determination", "id": "6"},
        {"type": "determination", "id": "14"}
      ]
    },
    agent: {

    }
  },
  "links": {
    "self": "http://example.com/articles/1"
  }
}
´´´
mskyttner commented 8 years ago

The service might be aware of its name through the VIRTUAL_HOST environment variable. Java would need to get that system environment variable then? Or can links be relative instead, that would be nicer if allowed?

mskyttner commented 7 years ago

This site http://jsonapi.org/implementations/ mentions these two Java libraries that would provide JSONAPI output:

http://katharsis.io/ - "Elegant and powerful HATEOAS for Java based on JSON API standard... JAX-RS integration can be applied in less than 5 minutes and it won't break current implementation." http://elide.io/ - "Stand up {json:api} web services backed by JPA annotated models in less than 15 minutes"