AgileVentures / asyncvoter-api

For Voting on Stories and Tickets remotely and asynchronously e.g. planning poker
5 stars 7 forks source link

document the API #69

Closed tansaku closed 7 years ago

tansaku commented 8 years ago

we should get the available API routes

tansaku commented 8 years ago

e.g. this from @arreche :

Posting Stories

$ curl -v -H "Content-Type: application/json" -X POST localhost:3000/stories -d '{"name": "anstory", "size": "0", "url": "www"}'
Note: Unnecessary use of -X or --request, POST is already inferred.
*   Trying ::1...
* Connected to localhost (::1) port 3000 (#0)
> POST /stories HTTP/1.1
> Host: localhost:3000
> User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)
> Accept: */*
> Referer:
> Content-Type: application/json
> Content-Length: 46
>
* upload completely sent off: 46 out of 46 bytes
< HTTP/1.1 200 OK
< X-Powered-By: Express
< Content-Type: application/json; charset=utf-8
< Content-Length: 160
< ETag: W/"a0-oztERQ0PydVaNHx0V7Me8w"
< Date: Sun, 13 Nov 2016 16:08:27 GMT
< Connection: keep-alive
<
* Connection #0 to host localhost left intact
{"__v":0,"updatedAt":"2016-11-13T16:08:27.411Z","createdAt":"2016-11-13T16:08:27.411Z","name":"anstory","size":"0","url":"www","_id":"58288ffb96bdf8316b234782"}

Getting Stories

$ curl -v -X GET localhost:3000/stories
Note: Unnecessary use of -X or --request, GET is already inferred.
*   Trying ::1...
* Connected to localhost (::1) port 3000 (#0)
> GET /stories HTTP/1.1
> Host: localhost:3000
> User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)
> Accept: */*
> Referer:
>
< HTTP/1.1 200 OK
< X-Powered-By: Express
< Content-Type: application/json; charset=utf-8
< Content-Length: 283
< ETag: W/"11b-e5pqFFwROEqCqTlfHMMETA"
< Date: Sun, 13 Nov 2016 16:09:25 GMT
< Connection: keep-alive
<
* Connection #0 to host localhost left intact
[{"_id":"58288e666023a72ff4856fe2","updatedAt":"2016-11-13T16:01:42.527Z","createdAt":"2016-11-13T16:01:42.527Z","__v":0},{"_id":"58288ffb96bdf8316b234782","updatedAt":"2016-11-13T16:08:27.411Z","createdAt":"2016-11-13T16:08:27.411Z","name":"anstory","size":"0","url":"www","__v":0}]

Posting Votes

$ curl -v -H "Content-Type: application/json" -X POST localhost:3000/stories/58288e666023a72ff4856fe2/votes -d '{"size": "1"}'
Note: Unnecessary use of -X or --request, POST is already inferred.
*   Trying ::1...
* Connected to localhost (::1) port 3000 (#0)
> POST /stories/58288e666023a72ff4856fe2/votes HTTP/1.1
> Host: localhost:3000
> User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)
> Accept: */*
> Referer:
> Content-Type: application/json
> Content-Length: 13
>
* upload completely sent off: 13 out of 13 bytes
< HTTP/1.1 200 OK
< X-Powered-By: Express
< Content-Type: application/json; charset=utf-8
< Content-Length: 88
< ETag: W/"58-i+Gmj7ywDrbmIIIPOFUH+w"
< Date: Sun, 13 Nov 2016 16:10:40 GMT
< Connection: keep-alive
<
* Connection #0 to host localhost left intact
{"__v":0,"story":"58288e666023a72ff4856fe2","size":"1","_id":"5828908096bdf8316b234783"}
arreche commented 7 years ago

Done in #73