CenterForDigitalHumanities / TPEN-services

Services required by TPEN interfaces in order to interact with data
1 stars 0 forks source link

Extend Project web API #58

Closed cubap closed 6 days ago

cubap commented 8 months ago

Improve the GET /project/{id} endpoint to return the type of thing expected. Actual connections to the database can be mocked for now.

See #2 for expectations as well as #26 for docs about possible parameters in the request to handle.

Write the failing tests first, then build to suit.

For now, a Project will look like this:

{ 
  "id"          : "#ProjectId",
  "@context"    : "http://t-pen.org/3/context.json",
  "@type"       : "CreativeWork",
  "creator"     : "https://store.rerum.io/v1/id/hash",
  "group"       : "#GroupId",
  "layers"      : [ "#LayerId" ],
  "lastModified": "#PageId",
  "viewer"      : "https://static.t-pen.org/#ProjectId",
  "license"     : "CC-BY",
  "manifest"    : "https://example.com/manifest.json",
  "tools"       : [],
  "options"     : {}
}

This will be stored in a database that is not set up yet, but you can assume a database controller abstraction with db.getByID() and db.find({property: match}) at a minimum, the return of which will be a JSON that contains the minimum unique Project information.

This endpoint should also provide alternate returns for certain parameters:

These parameters are all mutually exclusive except embed and passing multiple or a nonsense combo ("?view=html&embed=true") is an error.

thehabes commented 8 months ago

Note that Linked Data principles state that the @context property should always be the first property in JSON-LD objects.

cubap commented 7 months ago
"@context"    : "http://t-pen.org/3/context.json",
"@type"       : "CreativeWork",

These are not needed here. Who's idea was this?