Skip to content
aworkman edited this page May 20, 2014 · 13 revisions

Content Hosting Service Documentation

For the purposes of this project, this service contains the following endpoints:

  • Search
  • Advanced Search
  • GetKeys
  • GetMetadata
  • SetMetadata
  • UploadFile
  • DownloadFile
  • DeleteFile
  • GetAllVersions

Installation

Install Riak

Riak 2.0.0pre20 Download page

Download the Riak package relevant to your operating system and architecture. Install according to the instructions.

Install the Prototype

$ git clone https://github.com/adlnet/Content-Hosting-Service.git
$ cd content-repo
$ pip install virtualenv
$ virtualenv env
$ source env/bin/activate
(env)$ pip install -r requirements.txt

to quit and leave the virtualenv:

(env)$ deactivate

Running

to start riak:

$ sudo riak start

to start the webserver:

(env)$ cd content-repo
(env)$ source env/bin/activate
(env)$ python main.py

Stopping

to stop riak:

$ sudo riak stop

to stop the webserver:

(env)$^C

Usage

This is a very simple API. It exposes several endpoints: /CHS/keys/ for checking the keys stored in the database, /CHS/search/ that sends and receives JSON documents to conduct a search of the database using one term, /CHS/advanced_search/ that sends and receives JSON documents to conduct an advanced, more specific search of the database using three terms, /CHS/get_metadata/{id} that sends and receives JSON documents to retrieve a file's metadata, where {id} is the filename, /CHS/set_metadata/{id} that sends and receives JSON documents to set a file's metadata, where {id} is the filename,

The API also exposes several sub-endpoints to access particular parts of the JSON document.

Clone this wiki locally