GitHub PullRequestReviewCommentEvent at 2014-03-26 21:32:28
Repository: docs
Actor: adamroach
Payload: {"comment":{"url":"https://api.github.com/repos/mozilla-services/docs/pulls/comments/11000550","id":11000550,"diff_hunk":"@@ -0,0 +1,363 @@\n+====================\n+Loop Server API v1.0\n+====================\n+\n+.. note::\n+\n+    Unless stated otherwise, all APIs are using application/json for the requests\n+    and responses content types. Parameters for the GET requests are form\n+    encoded (?key=value&key2=value2)\n+\n+To ease testing, you can use `httpie <https://github.com/jkbr/httpie>`_ in\n+order to make requests. You can find the httpie requests for reference in the\n+examples.\n+\n+Authentication\n+==============\n+\n+Loop server supports authentication with cookie sessions.\n+\n+APIs\n+====\n+\n+**GET** **/**\n+\n+    Displays version information, for instance::\n+\n+       http GET localhost:5000 --verbose \n+\n+    .. code-block:: http\n+\n+        GET / HTTP/1.1\n+        Accept: */*\n+\n+        HTTP/1.1 200 OK\n+        Content-Type: application/json; charset=utf-8\n+        {\n+            \"description\": \"The Mozilla Loop (WebRTC App) server\",\n+            \"endpoint\": \"http://localhost:5000\",\n+            \"homepage\": \"https://github.com/mozilla/loop-server/\",\n+            \"name\": \"mozilla-loop-server\",\n+            \"version\": \"0.2.0-DEV\"\n+        }\n+\n+\n+**POST** **/registration**\n+\n+    Associates a Simple Push Endpoint (URL) with the authenticated user.\n+\n+    **May require authentication**\n+\n+    If you aren't authenticated when doing this registration step, then you'll\n+    be given back a session cookie that you'll need to pass along for the\n+    other requests.\n+\n+    Body parameters:\n+\n+    - **simple_push_url**, the simple push endpoint url as defined in\n+      https://wiki.mozilla.org/WebAPI/SimplePush#Definitions\n+\n+    Example (when requesting a session cookie)::\n+\n+        http --session loop POST localhost:5000/registration simple_push_url=https://push.services.mozilla.com/update/MGlYke2SrEmYE8ceyuverbo --verbose\n+\n+    .. code-block:: http\n+\n+        POST /registration HTTP/1.1\n+        Accept: application/json\n+        Content-Type: application/json; charset=utf-8\n+        {\n+            \"simple_push_url\": \"https://push.services.mozilla.com/update/MGlYke2SrEmYE8ceyuverbo\"\n+        }\n+\n+        HTTP/1.1 200 OK\n+        Content-Type: application/json; charset=utf-8\n+        Set-Cookie: loop-session=<session-cookie>; path=/; expires=Tue, 20 Jan 2015 09:18:55 GMT;\n+        \"ok\"\n+\n+    Alternatively, if you set a cookie in the request, with the `Cookie`\n+    header, you will not be given a cookie in the response.\n+\n+    Server should acknowledge your request and answer with a status code of\n+    **200 OK**.\n+\n+    Potential HTTP error responses include:\n+\n+    - **400 Bad Request:**  You forgot to pass the simple_push_url, or it's\n+      not a valid URL.\n+\n+\n+**POST** **/call-url**\n+\n+    **Requires authentication**\n+\n+    Generates a call url for the given `callerId`. This is an URL the caller\n+    can click on in order to call the caller.\n+\n+    Body parameters:\n+\n+    - **callerId**, the caller (the person you will give the link to)\n+      identifier.\n+\n+    Response from the server:\n+\n+    The server should answer this with a 200 status code and a JSON object\n+    with a \"call_url\" property.\n+\n+    Example::\n+\n+        http --session loop POST localhost:5000/call-url callerId=alexis --verbose\n+\n+    .. code-block:: http\n+\n+        POST /call-url HTTP/1.1\n+        Accept: application/json\n+        Content-Type: application/json; charset=utf-8\n+        Cookie: loop-session=<session-cookie>\n+        {\n+            \"callerId\": \"alexis\"\n+        }\n+\n+        HTTP/1.1 200 OK\n+        Content-Type: application/json; charset=utf-8\n+\n+        {\n+            \"call_url\": \"http://localhost:5000/calls/FfzMMm2hSl9FqeYUqNO2XuNzJP\"\n+        }\n+\n+    (note that the token had been truncated here for brievity purposes)\n+\n+    Potential HTTP error responses include:\n+\n+    - **400 Bad Request:**  You forgot to pass the `callerId`, or it's not\n+      valid.\n+\n+**GET**  **/calls/{token}**\n+\n+    Redirects to the application webapp (for the caller)\n+\n+    - *token* is the token returned by the **POST** on **/call-url**.\n+\n+    Server should return an \"HTTP 302\" with the new location.\n+\n+    Example::\n+\n+        http GET localhost:5000/calls/FfzMMm2hSl9FqeYUqNO2XuNzJP --verbose\n+\n+    .. code-block:: http\n+\n+        GET /calls/FfzMMm2hSl9FqeYUqNO2XuNzJP HTTP/1.1\n+        Accept: application/json\n+        Cookie: loop-session=<session-cookie>\n+\n+        HTTP/1.1 302 Moved Temporarily\n+        Content-Length: 0\n+        Location: http://localhost:3000/static/#call/FfzMMm2hSl9FqeYUqNO2XuNzJP\n+        Vary: Accept\n+\n+    Potential HTTP error responses include:\n+\n+    - **400 Bad Request:**  The token you passed is not valid or expired.\n+\n+**POST /calls/{token}**\n+\n+    Creates a new incoming call, gets tokens and session from the provider and\n+    does a simple push notification, then returns caller tokens.\n+\n+    Server should answer with a status of 200 and the following information in\n+    its body (json encoded):\n+\n+    - **uuid**, an unique identifier for the call;\n+    - **sessionId**, the provider session identifier;\n+    - **sessionToken**, the provider session token (for the caller);\n+    - **apiKey**, the provider public api Key.\n+\n+    Example::\n+\n+        http POST localhost:5000/calls/FfzMMm2hSl9FqeYUqNO2XuNzJP --verbose\n+\n+    .. code-block:: http\n+\n+        POST /calls/FfzMMm2hSl9FqeYUqNO2XuNzJP HTTP/1.1\n+        Accept: */*","path":"source/loop/apis.rst","position":182,"original_position":182,"commit_id":"da3354d26f553a6cb69b8951271e4e37c7d6d977","original_commit_id":"da3354d26f553a6cb69b8951271e4e37c7d6d977","user":{"login":"adamroach","id":2974852,"avatar_url":"https://avatars.githubusercontent.com/u/2974852?","gravatar_id":"e8bebce30304eb8c33c1f8b26fd4326a","url":"https://api.github.com/users/adamroach","html_url":"https://github.com/adamroach","followers_url":"https://api.github.com/users/adamroach/followers","following_url":"https://api.github.com/users/adamroach/following{/other_user}","gists_url":"https://api.github.com/users/adamroach/gists{/gist_id}","starred_url":"https://api.github.com/users/adamroach/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adamroach/subscriptions","organizations_url":"https://api.github.com/users/adamroach/orgs","repos_url":"https://api.github.com/users/adamroach/repos","events_url":"https://api.github.com/users/adamroach/events{/privacy}","received_events_url":"https://api.github.com/users/adamroach/received_events","type":"User","site_admin":false},"body":"Accept: application/json\r\nThis is coming out of an XHR, there's no reason we can't indicate the proper content type.","created_at":"2014-03-26T21:32:28Z","updated_at":"2014-03-26T21:32:28Z","html_url":"https://github.com/mozilla-services/docs/pull/11#discussion_r11000550","pull_request_url":"https://api.github.com/repos/mozilla-services/docs/pulls/11","_links":{"self":{"href":"https://api.github.com/repos/mozilla-services/docs/pulls/comments/11000550"},"html":{"href":"https://github.com/mozilla-services/docs/pull/11#discussion_r11000550"},"pull_request":{"href":"https://api.github.com/repos/mozilla-services/docs/pulls/11"}}}}