Skip to content

Commit

Permalink
updated doc to reflect v0.2 changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredwilkening committed Mar 22, 2012
1 parent e673745 commit 65bfcbe
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 15 deletions.
85 changes: 71 additions & 14 deletions README.md
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -24,25 +24,22 @@ To build:


Unix/Macintosh Unix/Macintosh


To install go weekly.2012-01-20 ([weekly.golang.org/doc/install/source](http://weekly.golang.org/doc/install/source)): To install go weekly.2012-03-13 ([weekly.golang.org/doc/install/source](http://weekly.golang.org/doc/install/source)):


hg clone -u release https://code.google.com/p/go hg clone -u release https://code.google.com/p/go
hg pull hg pull
hg update weekly.2012-01-20 hg update weekly.2012-03-13
cd go/src cd go/src
./all.bash ./all.bash
<add ../bin to $PATH> <add ../bin to $PATH>


To build Shock: To build Shock:


git clone <this repo> go get github.com/MG-RAST/Shock/shock-server
cd Shock
export GOPATH=`pwd`
go install shock/shock-server


To run (additional requires mongodb=>2.0.3): To run (additional requires mongodb=>2.0.3):


./bin/shock-server -port=<port to listen on> -data=<data directory to store on disk files> -mongo=<hostname(s) of mongodb> shock-server -port=<port to listen on> -data=<data directory to store on disk files> -mongo=<hostname(s) of mongodb> -secretkey=<secret key>


Command-line client: Command-line client:
------------------- -------------------
Expand Down Expand Up @@ -160,12 +157,13 @@ All responses from Shock currently are in the following encoding.
### Create node: ### Create node:
POST /node (multipart/form-data encoded) POST /node (multipart/form-data encoded)


- optionally takes user/password via Basic Auth. If set only that user with have access to the node
- to set attributes include file field named "attributes" containing a json file of attributes - to set attributes include file field named "attributes" containing a json file of attributes
- to set file include file field named "file" containing any file - to set file include file field named "file" containing any file


##### example ##### example


curl -X POST [ -F "attributes=@<path_to_json>" -F "file=@<path_to_data_file>" ] http://<shock_host>[:<port>]/node curl -X POST [ --user user:password ] [ -F "attributes=@<path_to_json>" -F "file=@<path_to_data_file>" ] http://<shock_host>[:<port>]/node


##### returns ##### returns


Expand All @@ -176,10 +174,10 @@ POST /node (multipart/form-data encoded)
"S": <http status of request> "S": <http status of request>
} }


<br/>
### List nodes: ### List nodes:
GET /node GET /node


- optionally takes user/password via Basic Auth. Grants access to non-public data
- by adding ?skip=N you get the nodes starting at N+1 - by adding ?skip=N you get the nodes starting at N+1
- by adding ?limit=N you get a maximum of N nodes returned - by adding ?limit=N you get a maximum of N nodes returned


Expand All @@ -200,7 +198,7 @@ Multiple attributes can be selected in a single query and are treated as AND ope


##### example ##### example


curl -X GET http://<shock_host>[:<port>]/node/[?skip=<skip>&limit=<count>][&query&<tag>=<value>] curl -X GET [ --user user:password ] http://<shock_host>[:<port>]/node/[?skip=<skip>&limit=<count>][&query&<tag>=<value>]
##### returns ##### returns


Expand All @@ -211,21 +209,80 @@ Multiple attributes can be selected in a single query and are treated as AND ope
"S": <http status of request> "S": <http status of request>
} }


<br/>
### Get node: ### Get node:
GET /node/:nodeid GET /node/:nodeid


- optionally takes user/password via Basic Auth
- ?download - complete file download - ?download - complete file download
- ?download&index=size&part=1\[&part=2...\]\[chunksize=inbytes\] - download portion of the file via the size virtual index. Chunksize defaults to 1MB (1048576 bytes).

##### example

curl -X GET [ --user user:password ] http://<shock_host>[:<port>]/node/:nodeid

##### returns

{
"C":"",
"D": {<node>},
"E": <error message or null>,
"S": <http status of request>
}

### Create user:
POST /user

Requires Basic Auth encoded username:password. To create an admin user include :secret_key specified at server start.


##### example ##### example


curl -X GET http://<shock_host>[:<port>]/node/:nodeid # regular user
curl -X POST --user joeuser:1234 http://<shock_host>[:<port>]/user

# admin user
curl -X POST --user joeuser:1234:supersupersecret http://<shock_host>[:<port>]/user


##### returns ##### returns


{ {
"C":"", "C":"",
"D": {<node>}, "D": {<user>},
"E": <error message or null>,
"S": <http status of request>
}

### Get user:
GET /user/:uuid

Requires Basic Auth encoded username:password. Regular user are able to see their own information while Admin user are able to access all.

##### example

curl -X GET --user joeuser:1234 http://<shock_host>[:<port>]/user/:uuid

##### returns

{
"C":"",
"D": {<user>},
"E": <error message or null>,
"S": <http status of request>
}

### List users:
GET /user

Requires Basic Auth encoded username:password. Restricted to Admin users.

##### example

curl -X GET --user joeadmin:12345 http://<shock_host>[:<port>]/user

##### returns

{
"C":"",
"D": {[<user>,...]},
"E": <error message or null>, "E": <error message or null>,
"S": <http status of request> "S": <http status of request>
} }
Expand Down
3 changes: 2 additions & 1 deletion Roadmap.txt
Original file line number Original file line Diff line number Diff line change
@@ -1,7 +1,7 @@
Release 0.2 (3/22/12) Release 0.2 (3/22/12)
- Client command (github.com/MG-RAST/ShockClient): Done - Client command (github.com/MG-RAST/ShockClient): Done
- basic auth: Done - basic auth: Done
- indices - indices (size vitual indexes): Done
- node ACLs: Done - node ACLs: Done
- basic user management: Done - basic user management: Done


Expand All @@ -15,6 +15,7 @@ Release 0.3 (4/1/12)
Release 0.4 (4/25/12) Release 0.4 (4/25/12)


Unfiled: Unfiled:
- generic indices
- testing - testing
- OAuth - OAuth
- client command (go version) - client command (go version)
Expand Down

0 comments on commit 65bfcbe

Please sign in to comment.