Skip to content

Instantly share code, notes, and snippets.

@mjsuhonos
Last active December 23, 2015 00:39
Show Gist options
  • Save mjsuhonos/07137a594d58d139b1c5 to your computer and use it in GitHub Desktop.
Save mjsuhonos/07137a594d58d139b1c5 to your computer and use it in GitHub Desktop.
API docs
StepStool has a few convenience actions:
- ladder:init will delete all existing data (including files) and re-initialize your account
- index:init will delete the index but retain all mapped objects; it will NOT rebuild the index
- index:reindex will rebuild the index in real-time (ie. will not delete it first)
- index:query will query the index and return a response in JSON
Ladder will respond to several REST endpoints that aren't documented in StepStool. These are:
GET /resources - list all resources (paged using &page and &per_page)
GET /resources/{id} - return a resource, depending on suffix: .xml or .rdf (RDF-XML, default); .json (HAL-ish JSON)
GET /resources/{id}/files - show source file(s) for a root resource
GET /resources/{id}/similar - show resources similar to the given resource based on similarity scoring
GET /resources/{id}/search/{query} - will query objects related to the given resource
GET /resources/random - return a resource at random
PUT /resources/index - reindex all resources in real-time
DELETE /resources/{id} - will delete a resource
All of the above endpoints can be used for /agents/ and /concepts/ similarly. All responses are in HAL-ish JSON (this is an area of active development). Most (if not all, can't remember) requests that return a collection can be paged using &page and &per_page -- though if you encounter one that doesn't, please let me know!
GET /files - list all files (paged using &page and &per_page)
GET /files/{id} - return a file representation in JSON; alternately, if the file's MIME content-type is supplied in the HTTP request header, the actual bitstream contents of the file will be returned
GET /files{id}/model - return the root resource/concept/agent for a mapped file in JSON
DELETE /files{id} - will delete a file
PUT /files/{id}/map - will queue the given file for mapping
There are some other endpoints that I won't detail now, but the last couple you'll find most useful are:
GET /mappings/ - return a list of file mappings based on MIME content-type in JSON
GET /mappings/{id} - return a specific mapping in JSON
DELETE /mappings/{id} - will delete a mapping
POST /mappings - will accept a new mapping using the same JSON syntax in the request body: *NB* this is not validated at present so you can easily crash Ladder with mal-formed mappings
GET /search/{query} - search across all objects using the given Lucene-syntax query
GET /search/resources/{query} - search across resources using the given Lucene-syntax query
GET /search/agents/{query} - search across agents using the given Lucene-syntax query
GET /search/concepts/{query} - search across concepts using the given Lucene-syntax query
GET /search/facets - returns information about the current facet mappings (also an area of active development)
@mjsuhonos
Copy link
Author

Endpoints for the first 4 actions:

  • ladder:init -> DELETE /
  • index:init -> DELETE /search
  • index:reindex -> PUT /search
  • index:query -> GET /search?q=

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment