summary refs log tree commit diff
diff options
context:
space:
mode:
authorfranck cuny <franck@lumberjaph.net>2010-08-31 16:53:12 +0200
committerfranck cuny <franck@lumberjaph.net>2010-08-31 16:53:12 +0200
commit8a8ca7f6ef75120d851df343f31c813c28bd6aa1 (patch)
tree308b581dca74df5da8241b11ed70fd5464262973
parentcheck path for file (diff)
downloadnet-http-api-spec-8a8ca7f6ef75120d851df343f31c813c28bd6aa1.tar.gz
start to describe the specification
-rw-r--r--readme.md63
1 files changed, 63 insertions, 0 deletions
diff --git a/readme.md b/readme.md
new file mode 100644
index 0000000..c5b682f
--- /dev/null
+++ b/readme.md
@@ -0,0 +1,63 @@
+# Net::HTTP::API::Spec
+
+## SYNOPSIS
+
+## DESCRIPTION
+
+## Spec
+
+### API information
+
+  * api_base_url   : URL of the API base
+  * api_format     : format of the API
+  * api_format_mode: how the format information is sent to the API:
+    * append      : the format will be added to the path (eg: /search.json)
+    * content-type: the format will be set in the headers of the request (eg: Content-Type)
+
+### API method declaration
+
+  * path: (required) path of the API method (start after the API base url, start with a /)
+  * method: (required) which HTTP method to use (GET/POST/PUT/DELETE)
+  * description: (optional) a description of what the method do
+  * strict: (optional) should the control of the arguments be strict (yes by default)
+  * authentication: (optional) does this method require authentication ? (no by default)
+  * expected: (optional) list of possible HTTP code accepted for this request (eg: [200, 201])
+  * params: (optional) list of parameters that will be used for the request
+  * params_in_url: (optional) should the parameters of the request be sent in the URL instead of body (for POST and PUT request)
+  * required: (optional) list of required parameters
+  * documetation: (optional) documentation for this method
+
+### example: GitHub
+
+    {
+      "declare" : {
+        "api_base_url" : "http://github.com/api/v2/",
+        "api_format_mode" : "content-type",
+        "api_format" : "json"
+      },
+      "methods" : {
+        "user_information" : {
+           "params" : [
+              "username",
+              "format"
+           ],
+           "required" : [
+              "username",
+              "format"
+           ],
+           "path" : "/:format/user/show/:username",
+           "method" : "GET"
+        },
+        "user_following" : {
+           "params" : [
+              "user"
+           ],
+           "required" : [
+              "user"
+           ],
+           "path" : "/user/show/:user/followers",
+           "method" : "GET"
+        }
+      }
+    }
+