forked from bbc/REST-API-example
-
Notifications
You must be signed in to change notification settings - Fork 0
/
commands.yml
52 lines (52 loc) · 2.39 KB
/
commands.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
tests:
- - Get list of Things
- GET /thing/
- "curl -i -H 'Accept: application/json' http://localhost:7000/thing/"
- - Create a new Thing
- POST /thing/
- "curl -i -H 'Accept: application/json' -d 'name=Foo&status=new' http://localhost:7000/thing"
- - Get a specific Thing
- GET /thing/id
- "curl -i -H 'Accept: application/json' http://localhost:7000/thing/1"
- - Get a non-existent Thing
- GET /thing/id
- "curl -i -H 'Accept: application/json' http://localhost:7000/thing/9999"
- - Create another new Thing
- POST /thing/
- "curl -i -H 'Accept: application/json' -d 'name=Bar&junk=rubbish' http://localhost:7000/thing"
- - Get list of Things again
- GET /thing/
- "curl -i -H 'Accept: application/json' http://localhost:7000/thing/"
- - Change a Thing's state
- PUT /thing/:id/status/changed
- "curl -i -H 'Accept: application/json' -X PUT http://localhost:7000/thing/1/status/changed"
- - Get changed Thing
- GET /thing/id
- "curl -i -H 'Accept: application/json' http://localhost:7000/thing/1"
- - Change a Thing
- PUT /thing/:id
- "curl -i -H 'Accept: application/json' -X PUT -d 'name=Foo&status=changed2' http://localhost:7000/thing/1"
- - Attempt to change a Thing using partial params
- PUT /thing/:id
- "curl -i -H 'Accept: application/json' -X PUT -d 'status=changed3' http://localhost:7000/thing/1"
- - Attempt to change a Thing using invalid params
- PUT /thing/:id
- "curl -i -H 'Accept: application/json' -X PUT -d 'id=99&status=changed4' http://localhost:7000/thing/1"
- - Change a Thing using the _method hack
- POST /thing/:id?_method=POST
- "curl -i -H 'Accept: application/json' -X POST -d 'name=Baz&_method=PUT' http://localhost:7000/thing/1"
- - Change a Thing using the _method hack in the url
- POST /thing/:id?_method=POST
- "curl -i -H 'Accept: application/json' -X POST -d 'name=Qux' http://localhost:7000/thing/1?_method=PUT"
- - Delete a Thing
- DELETE /thing/id
- "curl -i -H 'Accept: application/json' -X DELETE http://localhost:7000/thing/1/"
- - Try to delete same Thing again
- DELETE /thing/id
- "curl -i -H 'Accept: application/json' -X DELETE http://localhost:7000/thing/1/"
- - Get deleted Thing
- GET /thing/1
- "curl -i -H 'Accept: application/json' http://localhost:7000/thing/1"
- - Delete a Thing using the _method hack
- DELETE /thing/id
- "curl -i -H 'Accept: application/json' -X POST -d'_method=DELETE' http://localhost:7000/thing/2/"