Skip to content

GET annotationset

Paolo Ciccarese edited this page Apr 11, 2014 · 13 revisions

GET /annotationset/

Description

Returns the list of available Annotation Sets.

Parameter Description Default Impl
apiKey The application assigned apikey. The API calls are available only for registered and authorized applications. REQUIRED YES
max The number of records to display per page 10 yes
offset The page to be returned 0 yes
tgtUrl If specified, this will limit the results to the Annotation Set that are targeting the specified URL none yes
tgtFgt If true, this will include in the results the Annotation Set that are targeting a fragment of the specified URL true yes
tgtExt If true the results will include annotations of the same content but different URLs (known IDs and other techniques will be used to determine if the content is the same) false no
tgtIds If specified, this will limit the results to the Annotation Set that are targeting content identified by known IDs. Multiple IDs can be specified as a map. none no
outCmd This determines the kind of JSON-LD post processing. Possible values are 'none', 'context', 'frame'. The framing algorithm is currently not supporting Named Graphs* and therefore 'frame' is currently incompatible with 'incGph' set to 'true' none yes
flavor If specified, this will influence the returned format. OA no

Where OA is Open Annotation Model.

Example of usage

curl -i -X GET http://localhost:8080/s/annotationset  \
     --header "Content-Type: application/json"    \
     --data '{"apiKey":"testkey"}'

Success (200)

With Results

{
    "status": "results",
    "result": {
        "duration": "57ms",   // Total duration of the task
        "total": "0",         // Total items in the repository
        "offset": "0",        // Current result page
        "max": "10",          // Max results per page
        "items": [
            ... items ...     // Page items in JSON-LD format
        ]
    }
}

No Results

{
     "status":"nocontent",
     "message":"No results with the chosen criteria" , 
     "result": {
          "total":"0", 
          "pages":"0", 
          "duration": "15ms", 
          "offset": "0", 
          "max": "1", 
          "items":[]
      } 
}

Rejected (401)

Missing API key

{
     "status":"rejected",
     "message":"Api Key missing or invalid"
}

Wrong pagination

{
     "status":"rejected",
     "duration":"31ms",
     "message":"The requested page 2 does not exist, the page index limit is 1"
}

Testing Examples

Notes

  • The following curls are referring to localhost:8080 as the tests have been carried out in development/testing mode. To test against a deployed instance, localhost will need to be replaces with the right IP or server name.
  • For the following curls commands to work it is also necessary to enable the api key 'testkey'
  1. Returns 10 Annotation Sets

    curl -i -X POST http://localhost:8080/AtSmartStorage/annotationset
    --header "Content-Type: application/json"
    --data '{"apiKey":"testkey"}'

  2. Returns 20 Annotation Sets

    curl -i -X POST http://localhost:8080/AtSmartStorage/annotationset
    --header "Content-Type: application/json"
    --data '{"apiKey":"testkey","max":"20"}'

  3. Returns second page of Annotation Sets (10 items per page)

    curl -i -X POST http://localhost:8080/AtSmartStorage/annotationset
    --header "Content-Type: application/json"
    --data '{"apiKey":"testkey","max":"10","offset":"2"}'

  4. Returns 10 Annotation Sets targeting the resource http://www.jbiomedsem.com/content/2/S2/S4 or any of its fragments

    curl -i -X POST http://localhost:8080/AtSmartStorage/annotationset
    --header "Content-Type: application/json"
    --data '{"apiKey":"testkey","tgtUrl":"http://www.jbiomedsem.com/content/2/S2/S4" }'

  5. Returns 10 Annotation Sets targeting the resource http://www.jbiomedsem.com/content/2/S2/S4 but NOT any of its fragments

    curl -i -X POST http://localhost:8080/AtSmartStorage/annotationset
    --header "Content-Type: application/json"
    --data '{"apiKey":"testkey","tgtUrl":"http://www.jbiomedsem.com/content/2/S2/S4","tgtFgt":"false"}'