Skip to content

Instantly share code, notes, and snippets.

@tjsingleton
Created May 9, 2013 18:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tjsingleton/5549479 to your computer and use it in GitHub Desktop.
Save tjsingleton/5549479 to your computer and use it in GitHub Desktop.
{"resource":"Orders","http_method":"POST","route":"/orders","description":"Creating an order","explanation":"First, create an order, then make a later request to get it back","parameters":[{"name":"name","description":"Name of order","required":true,"scope":"order"},{"name":"paid","description":"If the order has been paid for","required":true,"scope":"order"},{"name":"email","description":"Email of user that placed the order","scope":"order"}],"requests":[{"request_method":"POST","request_path":"/orders","request_body":"{\"order\":{\"name\":\"Order 1\",\"paid\":true,\"email\":\"email@example.com\"}}","request_headers":{"Accept":"application/json","Content-Type":"application/json","Host":"example.org","Cookie":""},"request_query_parameters":{},"request_content_type":"application/json","response_status":201,"response_status_text":"Created","response_body":"{\"email\":\"email@example.com\",\"name\":\"Order 1\",\"paid\":true}","response_headers":{"Content-Type":"application/json; charset=utf-8","Location":"http://example.org/orders/1","X-UA-Compatible":"IE=Edge,chrome=1","ETag":"\"5fffd66f61cdd4ab8881584dbf5e72cf\"","Cache-Control":"max-age=0, private, must-revalidate","X-Runtime":"0.007149","Content-Length":"58"},"response_content_type":"application/json; charset=utf-8","curl":"curl \"http://localhost:3000/orders\" -d '{\"order\":{\"name\":\"Order 1\",\"paid\":true,\"email\":\"email@example.com\"}}' -X POST \\\n\t-H \"Accept: application/json\" \\\n\t-H \"Content-Type: application/json\" \\\n\t-H \"Host: example.org\" \\\n\t-H \"Cookie: \""},{"request_method":"GET","request_path":"/orders/1","request_body":null,"request_headers":{"Accept":"application/json","Content-Type":"application/json","Host":"example.org","Cookie":""},"request_query_parameters":{},"request_content_type":"application/json","response_status":200,"response_status_text":"OK","response_body":"{\"email\":\"email@example.com\",\"name\":\"Order 1\",\"paid\":true}","response_headers":{"Content-Type":"application/json; charset=utf-8","X-UA-Compatible":"IE=Edge,chrome=1","ETag":"\"5fffd66f61cdd4ab8881584dbf5e72cf\"","Cache-Control":"max-age=0, private, must-revalidate","X-Runtime":"0.003784","Content-Length":"58"},"response_content_type":"application/json; charset=utf-8","curl":"curl \"http://localhost:3000/orders/1\" -X GET \\\n\t-H \"Accept: application/json\" \\\n\t-H \"Content-Type: application/json\" \\\n\t-H \"Host: example.org\" \\\n\t-H \"Cookie: \""}]}
{"resource":"Orders","http_method":"DELETE","route":"/orders/:id","description":"Deleting an order","explanation":null,"parameters":[],"requests":[{"request_method":"DELETE","request_path":"/orders/1","request_body":null,"request_headers":{"Accept":"application/json","Content-Type":"application/json","Host":"example.org","Cookie":""},"request_query_parameters":{},"request_content_type":"application/json","response_status":200,"response_status_text":"OK","response_body":"{}","response_headers":{"Content-Type":"application/json; charset=utf-8","Location":"http://example.org/orders","X-UA-Compatible":"IE=Edge,chrome=1","ETag":"\"99914b932bd37a50b983c5e7c90ae93b\"","Cache-Control":"max-age=0, private, must-revalidate","X-Runtime":"0.061978","Content-Length":"2"},"response_content_type":"application/json; charset=utf-8","curl":"curl \"http://localhost:3000/orders/1\" -d '' -X DELETE \\\n\t-H \"Accept: application/json\" \\\n\t-H \"Content-Type: application/json\" \\\n\t-H \"Host: example.org\" \\\n\t-H \"Cookie: \""}]}
{"resource":"Orders","http_method":"GET","route":"/orders","description":"Getting a list of orders","explanation":null,"parameters":[{"name":"page","description":"Current page of orders"}],"requests":[{"request_method":"GET","request_path":"/orders?page=1","request_body":null,"request_headers":{"Accept":"application/json","Content-Type":"application/json","Host":"example.org","Cookie":""},"request_query_parameters":{"page":"1"},"request_content_type":"application/json","response_status":200,"response_status_text":"OK","response_body":"[{\"email\":\"email0@example.com\",\"name\":\"Order 0\",\"paid\":true},{\"email\":\"email1@example.com\",\"name\":\"Order 1\",\"paid\":true}]","response_headers":{"Content-Type":"application/json; charset=utf-8","X-UA-Compatible":"IE=Edge,chrome=1","ETag":"\"6cd5831e98b0090b64672b5604d9eb2a\"","Cache-Control":"max-age=0, private, must-revalidate","X-Runtime":"0.018182","Content-Length":"121"},"response_content_type":"application/json; charset=utf-8","curl":"curl \"http://localhost:3000/orders?page=1\" -X GET \\\n\t-H \"Accept: application/json\" \\\n\t-H \"Content-Type: application/json\" \\\n\t-H \"Host: example.org\" \\\n\t-H \"Cookie: \""}]}
{"resource":"Orders","http_method":"GET","route":"/orders/:id","description":"Getting a specific order","explanation":null,"parameters":[],"requests":[{"request_method":"GET","request_path":"/orders/1","request_body":null,"request_headers":{"Accept":"application/json","Content-Type":"application/json","Host":"example.org","Cookie":""},"request_query_parameters":{},"request_content_type":"application/json","response_status":200,"response_status_text":"OK","response_body":"{\"email\":\"email@example.com\",\"name\":\"Old Name\",\"paid\":true}","response_headers":{"Content-Type":"application/json; charset=utf-8","X-UA-Compatible":"IE=Edge,chrome=1","ETag":"\"d9eaba14696a65b9dfc66bf203d25a13\"","Cache-Control":"max-age=0, private, must-revalidate","X-Runtime":"0.003879","Content-Length":"59"},"response_content_type":"application/json; charset=utf-8","curl":"curl \"http://localhost:3000/orders/1\" -X GET \\\n\t-H \"Accept: application/json\" \\\n\t-H \"Content-Type: application/json\" \\\n\t-H \"Host: example.org\" \\\n\t-H \"Cookie: \""}]}
{"resource":"Orders","http_method":"HEAD","route":"/orders","description":"Getting the headers","explanation":null,"parameters":[],"requests":[{"request_method":"HEAD","request_path":"/orders","request_body":null,"request_headers":{"Accept":"application/json","Content-Type":"application/json","Host":"example.org","Cookie":""},"request_query_parameters":{},"request_content_type":"application/json","response_status":200,"response_status_text":"OK","response_body":null,"response_headers":{"Content-Type":"application/json; charset=utf-8","X-UA-Compatible":"IE=Edge,chrome=1","ETag":"\"d751713988987e9331980363e24189ce\"","Cache-Control":"max-age=0, private, must-revalidate","X-Runtime":"0.002877"},"response_content_type":"application/json; charset=utf-8","curl":"curl \"http://localhost:3000/orders\" -X HEAD \\\n\t-H \"Accept: application/json\" \\\n\t-H \"Content-Type: application/json\" \\\n\t-H \"Host: example.org\" \\\n\t-H \"Cookie: \""}]}
Getting a list of orders
------------------------
Parameters:
* page - Current page of orders
Request:
GET /orders?page=1
Accept: application/json
Content-Type: application/json
Cookie:
Host: example.org
page=1
Response:
Status: 200 OK
Cache-Control: max-age=0, private, must-revalidate
Content-Length: 121
Content-Type: application/json; charset=utf-8
ETag: "6cd5831e98b0090b64672b5604d9eb2a"
X-Runtime: 0.018182
X-UA-Compatible: IE=Edge,chrome=1
[{"email":"email0@example.com","name":"Order 0","paid":true},{"email":"email1@example.com","name":"Order 1","paid":true}]
Getting the headers
-------------------
Request:
HEAD /orders
Accept: application/json
Content-Type: application/json
Cookie:
Host: example.org
Response:
Status: 200 OK
Cache-Control: max-age=0, private, must-revalidate
Content-Type: application/json; charset=utf-8
ETag: "d751713988987e9331980363e24189ce"
X-Runtime: 0.002877
X-UA-Compatible: IE=Edge,chrome=1
Creating an order
-----------------
Parameters:
* name - Name of order
* paid - If the order has been paid for
* email - Email of user that placed the order
Request:
POST /orders
Accept: application/json
Content-Type: application/json
Cookie:
Host: example.org
{"order":{"name":"Order 1","paid":true,"email":"email@example.com"}}
Response:
Status: 201 Created
Cache-Control: max-age=0, private, must-revalidate
Content-Length: 58
Content-Type: application/json; charset=utf-8
ETag: "5fffd66f61cdd4ab8881584dbf5e72cf"
Location: http://example.org/orders/1
X-Runtime: 0.007149
X-UA-Compatible: IE=Edge,chrome=1
{"email":"email@example.com","name":"Order 1","paid":true}
Request:
GET /orders/1
Accept: application/json
Content-Type: application/json
Cookie:
Host: example.org
Response:
Status: 200 OK
Cache-Control: max-age=0, private, must-revalidate
Content-Length: 58
Content-Type: application/json; charset=utf-8
ETag: "5fffd66f61cdd4ab8881584dbf5e72cf"
X-Runtime: 0.003784
X-UA-Compatible: IE=Edge,chrome=1
{"email":"email@example.com","name":"Order 1","paid":true}
Getting a specific order
------------------------
Request:
GET /orders/1
Accept: application/json
Content-Type: application/json
Cookie:
Host: example.org
Response:
Status: 200 OK
Cache-Control: max-age=0, private, must-revalidate
Content-Length: 59
Content-Type: application/json; charset=utf-8
ETag: "d9eaba14696a65b9dfc66bf203d25a13"
X-Runtime: 0.003879
X-UA-Compatible: IE=Edge,chrome=1
{"email":"email@example.com","name":"Old Name","paid":true}
Updating an order
-----------------
Parameters:
* name - Name of order
* paid - If the order has been paid for
* email - Email of user that placed the order
Request:
PUT /orders/1
Accept: application/json
Content-Type: application/json
Cookie:
Host: example.org
{"order":{"name":"Updated Name"}}
Response:
Status: 200 OK
Cache-Control: max-age=0, private, must-revalidate
Content-Length: 2
Content-Type: application/json; charset=utf-8
ETag: "99914b932bd37a50b983c5e7c90ae93b"
Location: http://example.org/orders/1
X-Runtime: 0.005919
X-UA-Compatible: IE=Edge,chrome=1
{}
Deleting an order
-----------------
Request:
DELETE /orders/1
Accept: application/json
Content-Type: application/json
Cookie:
Host: example.org
Response:
Status: 200 OK
Cache-Control: max-age=0, private, must-revalidate
Content-Length: 2
Content-Type: application/json; charset=utf-8
ETag: "99914b932bd37a50b983c5e7c90ae93b"
Location: http://example.org/orders
X-Runtime: 0.061978
X-UA-Compatible: IE=Edge,chrome=1
{}
{"resource":"Orders","http_method":"PUT","route":"/orders/:id","description":"Updating an order","explanation":null,"parameters":[{"name":"name","description":"Name of order","scope":"order"},{"name":"paid","description":"If the order has been paid for","scope":"order"},{"name":"email","description":"Email of user that placed the order","scope":"order"}],"requests":[{"request_method":"PUT","request_path":"/orders/1","request_body":"{\"order\":{\"name\":\"Updated Name\"}}","request_headers":{"Accept":"application/json","Content-Type":"application/json","Host":"example.org","Cookie":""},"request_query_parameters":{},"request_content_type":"application/json","response_status":200,"response_status_text":"OK","response_body":"{}","response_headers":{"Content-Type":"application/json; charset=utf-8","Location":"http://example.org/orders/1","X-UA-Compatible":"IE=Edge,chrome=1","ETag":"\"99914b932bd37a50b983c5e7c90ae93b\"","Cache-Control":"max-age=0, private, must-revalidate","X-Runtime":"0.005919","Content-Length":"2"},"response_content_type":"application/json; charset=utf-8","curl":"curl \"http://localhost:3000/orders/1\" -d '{\"order\":{\"name\":\"Updated Name\"}}' -X PUT \\\n\t-H \"Accept: application/json\" \\\n\t-H \"Content-Type: application/json\" \\\n\t-H \"Host: example.org\" \\\n\t-H \"Cookie: \""}]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment