More work
This commit is contained in:
parent
7428fb1ef8
commit
187147113f
9 changed files with 37 additions and 7 deletions
BIN
resources/api.png
Normal file
BIN
resources/api.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 30 KiB |
|
@ -1,9 +1,15 @@
|
|||
## A RESTful Example
|
||||
|
||||
Some site with example
|
||||
Simple sample
|
||||
|
||||
* List: GET /resource
|
||||
* Create: POST /resource
|
||||
* Show: GET /resource/1
|
||||
* Update: PUT /resource/1
|
||||
* Delete: DELETE /resource/1
|
||||
* List: GET /jokes
|
||||
* Create: POST /jokes
|
||||
* Show: GET /jokes/1
|
||||
* Update: PUT /jokes/1
|
||||
* Delete: DELETE /jokes/1
|
||||
|
||||
note:
|
||||
|
||||
curl --data 'joke[joke]=Why did the chicken get to the other side&joke[punchline]=To get to the other side' http://localhost:9292/jokes
|
||||
curl -X PUT --data 'joke[joke]=New Joke&joke[punchline]=Punchline' http://localhost:9292/jokes/1
|
||||
curl -X DELETE http://localhost:9292/jokes/1
|
||||
|
|
3
slides/api-documentation.md
Normal file
3
slides/api-documentation.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
## API Documentation
|
||||
|
||||
![API Guide](resources/api.png)
|
|
@ -1,4 +1,6 @@
|
|||
|
||||
# Let's Talk APIs
|
||||
|
||||
Well...RESTful ones anyway
|
||||
|
||||
<small>Andrew Tomaka / [@atomaka](https://twitter.com/atomaka)</small>
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
[
|
||||
"index.md",
|
||||
"what-is-an-api.md",
|
||||
"api-documentation.md",
|
||||
"make-it-restful.md",
|
||||
"rest-constraints.md",
|
||||
"rest-on-the-web.md",
|
||||
"a-restful-example.md",
|
||||
"sample-code.md",
|
||||
"resources.md",
|
||||
"other-talks.md"
|
||||
]
|
||||
|
|
|
@ -3,3 +3,5 @@
|
|||
* **RE**presentational
|
||||
* **S**tate
|
||||
* **T**ransfer
|
||||
|
||||
Constraints to create consistent APIs
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
* Pick a data type (JSON, XML, Atom, etc)
|
||||
* Use standard HTTP methods
|
||||
* GET, PUT, POST, DELETE, (and PATCH)
|
||||
* Use standard HTTP response codes
|
||||
* 200 OK, 204 No Content, 404 Not Found
|
||||
|
||||
notes:
|
||||
note:
|
||||
|
||||
|
|
12
slides/restful-responses.md
Normal file
12
slides/restful-responses.md
Normal file
|
@ -0,0 +1,12 @@
|
|||
## HTTP Responses
|
||||
|
||||
* 200 OK: Request succeeded and information returned
|
||||
* 204 No Content: Request succeeded but no information returned
|
||||
* 404 Not Found: Resource not found
|
||||
* 422 Unprocessable Entity: Incorrect semantics
|
||||
|
||||
[And many others](http://www.restapitutorial.com/httpstatuscodes.html)
|
||||
|
||||
note:
|
||||
|
||||
422 ex: strong params violation
|
1
slides/sample-code.md
Normal file
1
slides/sample-code.md
Normal file
|
@ -0,0 +1 @@
|
|||
## Sample Code
|
Loading…
Reference in a new issue