{"action":"created","comment":{"url":"https://api.github.com/repos/owncloud/documentation/pulls/comments/22761696","id":22761696,"diff_hunk":"@@ -0,0 +1,487 @@\n+========\n+Tutorial\n+========\n+\n+.. sectionauthor:: Bernhard Posselt <dev@bernhard-posselt.com>\n+\n+This tutorial will outline how to create a very simple notes app.\n+\n+\n+Setup\n+=====\n+After the `development tool <https://github.com/owncloud/ocdev/blob/master/README.rst#installation>`_ has been installed the :doc:`development environment needs to be set up <../general/devenv>`. This can be done by either `downloading the zip from the website <http://owncloud.org/install/>`_ or cloning it directly from GitHub::\n+\n+    ocdev setup core --dir owncloud  --owncloud 8\n+\n+Now open another tab in the terminal and start the development server::\n+\n+    cd owncloud\n+    php -S localhost:8080\n+\n+Afterwards the app can be created in the **apps** folder::\n+\n+    cd apps\n+    ocdev startapp OwnNotes\n+\n+This creates a new folder called **ownnotes**. Now access and set up ownCloud through the webinterface at `http://localhost:8080 <http://localhost:8080>`_ and enable the OwnNotes application on the apps page.\n+\n+Routes & Controllers\n+====================\n+A typical web application consists of server side and client side code. The glue between those two parts are the URLs. In case of the notes app the following URLs will be used:\n+\n+* **GET /**: Returns the interface in HTML\n+* **GET /notes**: Returns a list of all routes as in JSON\n+* **GET /notes/1**: Returns a note with the id 1 in JSON\n+* **DELETE /notes/1**: Deletes a note with the id 1\n+* **POST /notes**: Creates a new note by passing in JSON\n+* **PUT /notes/1**: Updates a note with the id 1 by passing in JSON\n+\n+On the client side we can call these URLs with the following jQuery code:\n+\n+.. code-block:: js\n+\n+    // example for calling the PUT /notes/1 URL\n+    var baseUrl = OC.generateUrl('/apps/ownnotes');\n+    var note = {\n+        title: 'New note',\n+        content: 'This is the note text'\n+    };\n+    var id = 1;\n+    $.ajax({\n+        url: baseUrl + '/notes/' + id,\n+        type: 'PUT',\n+        contentType: 'application/json',\n+        data: JSON.stringify(note)\n+    }).done(function (response) {\n+        // handle success\n+    }).fail(function (response, code) {\n+        // handle failure\n+    });\n+\n+On the server side we need to register a callback that is executed once the request comes in. The callback itself will be a method on a :doc:`controller <controllers>` and the controller will be connected to the URL with a :doc:`route <routes>`. The controller and route for the page are already set up in **ownnotes/appinfo/routes.php**:\n+\n+.. code-block:: php\n+\n+    <?php\n+    return ['routes' => [","path":"developer_manual/app/tutorial.rst","position":74,"original_position":66,"commit_id":"00fe3888124f33ba09a295225f423dc0c6accbcd","original_commit_id":"32d26dbf9098987de79aac59e056438ad5746ba3","user":{"login":"Raydiation","id":195053,"avatar_url":"https://avatars.githubusercontent.com/u/195053?v=3","gravatar_id":"","url":"https://api.github.com/users/Raydiation","html_url":"https://github.com/Raydiation","followers_url":"https://api.github.com/users/Raydiation/followers","following_url":"https://api.github.com/users/Raydiation/following{/other_user}","gists_url":"https://api.github.com/users/Raydiation/gists{/gist_id}","starred_url":"https://api.github.com/users/Raydiation/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Raydiation/subscriptions","organizations_url":"https://api.github.com/users/Raydiation/orgs","repos_url":"https://api.github.com/users/Raydiation/repos","events_url":"https://api.github.com/users/Raydiation/events{/privacy}","received_events_url":"https://api.github.com/users/Raydiation/received_events","type":"User","site_admin":false},"body":"Nothing changed regarding the old behavior. Only if an array is returned from the file, the new code will be executed.","created_at":"2015-01-10T20:26:27Z","updated_at":"2015-01-10T20:26:27Z","html_url":"https://github.com/owncloud/documentation/pull/748#discussion_r22761696","pull_request_url":"https://api.github.com/repos/owncloud/documentation/pulls/748","_links":{"self":{"href":"https://api.github.com/repos/owncloud/documentation/pulls/comments/22761696"},"html":{"href":"https://github.com/owncloud/documentation/pull/748#discussion_r22761696"},"pull_request":{"href":"https://api.github.com/repos/owncloud/documentation/pulls/748"}}},"pull_request":{"url":"https://api.github.com/repos/owncloud/documentation/pulls/748","id":27069778,"html_url":"https://github.com/owncloud/documentation/pull/748","diff_url":"https://github.com/owncloud/documentation/pull/748.diff","patch_url":"https://github.com/owncloud/documentation/pull/748.patch","issue_url":"https://api.github.com/repos/owncloud/documentation/issues/748","number":748,"state":"open","locked":false,"title":"Tutorial","user":{"login":"Raydiation","id":195053,"avatar_url":"https://avatars.githubusercontent.com/u/195053?v=3","gravatar_id":"","url":"https://api.github.com/users/Raydiation","html_url":"https://github.com/Raydiation","followers_url":"https://api.github.com/users/Raydiation/followers","following_url":"https://api.github.com/users/Raydiation/following{/other_user}","gists_url":"https://api.github.com/users/Raydiation/gists{/gist_id}","starred_url":"https://api.github.com/users/Raydiation/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Raydiation/subscriptions","organizations_url":"https://api.github.com/users/Raydiation/orgs","repos_url":"https://api.github.com/users/Raydiation/repos","events_url":"https://api.github.com/users/Raydiation/events{/privacy}","received_events_url":"https://api.github.com/users/Raydiation/received_events","type":"User","site_admin":false},"body":"This is a small tutorial how to create a simple notes app. \r\n\r\n@MorrisJobke @DeepDiver1975 @jbtbnl @PVince81 @karlitschek","created_at":"2015-01-08T23:42:39Z","updated_at":"2015-01-10T20:26:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8de5f2e98b1cfe74fed5e1ae8153c86096181565","assignee":null,"milestone":{"url":"https://api.github.com/repos/owncloud/documentation/milestones/3","labels_url":"https://api.github.com/repos/owncloud/documentation/milestones/3/labels","id":792010,"number":3,"title":"ownCloud 8","description":"","creator":{"login":"wakeup","id":231068,"avatar_url":"https://avatars.githubusercontent.com/u/231068?v=3","gravatar_id":"","url":"https://api.github.com/users/wakeup","html_url":"https://github.com/wakeup","followers_url":"https://api.github.com/users/wakeup/followers","following_url":"https://api.github.com/users/wakeup/following{/other_user}","gists_url":"https://api.github.com/users/wakeup/gists{/gist_id}","starred_url":"https://api.github.com/users/wakeup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wakeup/subscriptions","organizations_url":"https://api.github.com/users/wakeup/orgs","repos_url":"https://api.github.com/users/wakeup/repos","events_url":"https://api.github.com/users/wakeup/events{/privacy}","received_events_url":"https://api.github.com/users/wakeup/received_events","type":"User","site_admin":false},"open_issues":3,"closed_issues":9,"state":"open","created_at":"2014-09-16T17:56:14Z","updated_at":"2015-01-08T23:42:47Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/owncloud/documentation/pulls/748/commits","review_comments_url":"https://api.github.com/repos/owncloud/documentation/pulls/748/comments","review_comment_url":"https://api.github.com/repos/owncloud/documentation/pulls/comments/{number}","comments_url":"https://api.github.com/repos/owncloud/documentation/issues/748/comments","statuses_url":"https://api.github.com/repos/owncloud/documentation/statuses/00fe3888124f33ba09a295225f423dc0c6accbcd","head":{"label":"owncloud:tutorial","ref":"tutorial","sha":"00fe3888124f33ba09a295225f423dc0c6accbcd","user":{"login":"owncloud","id":1645051,"avatar_url":"https://avatars.githubusercontent.com/u/1645051?v=3","gravatar_id":"","url":"https://api.github.com/users/owncloud","html_url":"https://github.com/owncloud","followers_url":"https://api.github.com/users/owncloud/followers","following_url":"https://api.github.com/users/owncloud/following{/other_user}","gists_url":"https://api.github.com/users/owncloud/gists{/gist_id}","starred_url":"https://api.github.com/users/owncloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/owncloud/subscriptions","organizations_url":"https://api.github.com/users/owncloud/orgs","repos_url":"https://api.github.com/users/owncloud/repos","events_url":"https://api.github.com/users/owncloud/events{/privacy}","received_events_url":"https://api.github.com/users/owncloud/received_events","type":"Organization","site_admin":false},"repo":{"id":6405172,"name":"documentation","full_name":"owncloud/documentation","owner":{"login":"owncloud","id":1645051,"avatar_url":"https://avatars.githubusercontent.com/u/1645051?v=3","gravatar_id":"","url":"https://api.github.com/users/owncloud","html_url":"https://github.com/owncloud","followers_url":"https://api.github.com/users/owncloud/followers","following_url":"https://api.github.com/users/owncloud/following{/other_user}","gists_url":"https://api.github.com/users/owncloud/gists{/gist_id}","starred_url":"https://api.github.com/users/owncloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/owncloud/subscriptions","organizations_url":"https://api.github.com/users/owncloud/orgs","repos_url":"https://api.github.com/users/owncloud/repos","events_url":"https://api.github.com/users/owncloud/events{/privacy}","received_events_url":"https://api.github.com/users/owncloud/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/owncloud/documentation","description":"Documentation and manual","fork":false,"url":"https://api.github.com/repos/owncloud/documentation","forks_url":"https://api.github.com/repos/owncloud/documentation/forks","keys_url":"https://api.github.com/repos/owncloud/documentation/keys{/key_id}","collaborators_url":"https://api.github.com/repos/owncloud/documentation/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/owncloud/documentation/teams","hooks_url":"https://api.github.com/repos/owncloud/documentation/hooks","issue_events_url":"https://api.github.com/repos/owncloud/documentation/issues/events{/number}","events_url":"https://api.github.com/repos/owncloud/documentation/events","assignees_url":"https://api.github.com/repos/owncloud/documentation/assignees{/user}","branches_url":"https://api.github.com/repos/owncloud/documentation/branches{/branch}","tags_url":"https://api.github.com/repos/owncloud/documentation/tags","blobs_url":"https://api.github.com/repos/owncloud/documentation/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/owncloud/documentation/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/owncloud/documentation/git/refs{/sha}","trees_url":"https://api.github.com/repos/owncloud/documentation/git/trees{/sha}","statuses_url":"https://api.github.com/repos/owncloud/documentation/statuses/{sha}","languages_url":"https://api.github.com/repos/owncloud/documentation/languages","stargazers_url":"https://api.github.com/repos/owncloud/documentation/stargazers","contributors_url":"https://api.github.com/repos/owncloud/documentation/contributors","subscribers_url":"https://api.github.com/repos/owncloud/documentation/subscribers","subscription_url":"https://api.github.com/repos/owncloud/documentation/subscription","commits_url":"https://api.github.com/repos/owncloud/documentation/commits{/sha}","git_commits_url":"https://api.github.com/repos/owncloud/documentation/git/commits{/sha}","comments_url":"https://api.github.com/repos/owncloud/documentation/comments{/number}","issue_comment_url":"https://api.github.com/repos/owncloud/documentation/issues/comments/{number}","contents_url":"https://api.github.com/repos/owncloud/documentation/contents/{+path}","compare_url":"https://api.github.com/repos/owncloud/documentation/compare/{base}...{head}","merges_url":"https://api.github.com/repos/owncloud/documentation/merges","archive_url":"https://api.github.com/repos/owncloud/documentation/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/owncloud/documentation/downloads","issues_url":"https://api.github.com/repos/owncloud/documentation/issues{/number}","pulls_url":"https://api.github.com/repos/owncloud/documentation/pulls{/number}","milestones_url":"https://api.github.com/repos/owncloud/documentation/milestones{/number}","notifications_url":"https://api.github.com/repos/owncloud/documentation/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/owncloud/documentation/labels{/name}","releases_url":"https://api.github.com/repos/owncloud/documentation/releases{/id}","created_at":"2012-10-26T14:36:00Z","updated_at":"2015-01-09T19:06:14Z","pushed_at":"2015-01-10T16:10:04Z","git_url":"git://github.com/owncloud/documentation.git","ssh_url":"git@github.com:owncloud/documentation.git","clone_url":"https://github.com/owncloud/documentation.git","svn_url":"https://github.com/owncloud/documentation","homepage":null,"size":32844,"stargazers_count":70,"watchers_count":70,"language":"CSS","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":128,"mirror_url":null,"open_issues_count":114,"forks":128,"open_issues":114,"watchers":70,"default_branch":"master"}},"base":{"label":"owncloud:master","ref":"master","sha":"3aecb6899b79650a0efc17936f69a2f4ca575288","user":{"login":"owncloud","id":1645051,"avatar_url":"https://avatars.githubusercontent.com/u/1645051?v=3","gravatar_id":"","url":"https://api.github.com/users/owncloud","html_url":"https://github.com/owncloud","followers_url":"https://api.github.com/users/owncloud/followers","following_url":"https://api.github.com/users/owncloud/following{/other_user}","gists_url":"https://api.github.com/users/owncloud/gists{/gist_id}","starred_url":"https://api.github.com/users/owncloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/owncloud/subscriptions","organizations_url":"https://api.github.com/users/owncloud/orgs","repos_url":"https://api.github.com/users/owncloud/repos","events_url":"https://api.github.com/users/owncloud/events{/privacy}","received_events_url":"https://api.github.com/users/owncloud/received_events","type":"Organization","site_admin":false},"repo":{"id":6405172,"name":"documentation","full_name":"owncloud/documentation","owner":{"login":"owncloud","id":1645051,"avatar_url":"https://avatars.githubusercontent.com/u/1645051?v=3","gravatar_id":"","url":"https://api.github.com/users/owncloud","html_url":"https://github.com/owncloud","followers_url":"https://api.github.com/users/owncloud/followers","following_url":"https://api.github.com/users/owncloud/following{/other_user}","gists_url":"https://api.github.com/users/owncloud/gists{/gist_id}","starred_url":"https://api.github.com/users/owncloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/owncloud/subscriptions","organizations_url":"https://api.github.com/users/owncloud/orgs","repos_url":"https://api.github.com/users/owncloud/repos","events_url":"https://api.github.com/users/owncloud/events{/privacy}","received_events_url":"https://api.github.com/users/owncloud/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/owncloud/documentation","description":"Documentation and manual","fork":false,"url":"https://api.github.com/repos/owncloud/documentation","forks_url":"https://api.github.com/repos/owncloud/documentation/forks","keys_url":"https://api.github.com/repos/owncloud/documentation/keys{/key_id}","collaborators_url":"https://api.github.com/repos/owncloud/documentation/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/owncloud/documentation/teams","hooks_url":"https://api.github.com/repos/owncloud/documentation/hooks","issue_events_url":"https://api.github.com/repos/owncloud/documentation/issues/events{/number}","events_url":"https://api.github.com/repos/owncloud/documentation/events","assignees_url":"https://api.github.com/repos/owncloud/documentation/assignees{/user}","branches_url":"https://api.github.com/repos/owncloud/documentation/branches{/branch}","tags_url":"https://api.github.com/repos/owncloud/documentation/tags","blobs_url":"https://api.github.com/repos/owncloud/documentation/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/owncloud/documentation/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/owncloud/documentation/git/refs{/sha}","trees_url":"https://api.github.com/repos/owncloud/documentation/git/trees{/sha}","statuses_url":"https://api.github.com/repos/owncloud/documentation/statuses/{sha}","languages_url":"https://api.github.com/repos/owncloud/documentation/languages","stargazers_url":"https://api.github.com/repos/owncloud/documentation/stargazers","contributors_url":"https://api.github.com/repos/owncloud/documentation/contributors","subscribers_url":"https://api.github.com/repos/owncloud/documentation/subscribers","subscription_url":"https://api.github.com/repos/owncloud/documentation/subscription","commits_url":"https://api.github.com/repos/owncloud/documentation/commits{/sha}","git_commits_url":"https://api.github.com/repos/owncloud/documentation/git/commits{/sha}","comments_url":"https://api.github.com/repos/owncloud/documentation/comments{/number}","issue_comment_url":"https://api.github.com/repos/owncloud/documentation/issues/comments/{number}","contents_url":"https://api.github.com/repos/owncloud/documentation/contents/{+path}","compare_url":"https://api.github.com/repos/owncloud/documentation/compare/{base}...{head}","merges_url":"https://api.github.com/repos/owncloud/documentation/merges","archive_url":"https://api.github.com/repos/owncloud/documentation/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/owncloud/documentation/downloads","issues_url":"https://api.github.com/repos/owncloud/documentation/issues{/number}","pulls_url":"https://api.github.com/repos/owncloud/documentation/pulls{/number}","milestones_url":"https://api.github.com/repos/owncloud/documentation/milestones{/number}","notifications_url":"https://api.github.com/repos/owncloud/documentation/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/owncloud/documentation/labels{/name}","releases_url":"https://api.github.com/repos/owncloud/documentation/releases{/id}","created_at":"2012-10-26T14:36:00Z","updated_at":"2015-01-09T19:06:14Z","pushed_at":"2015-01-10T16:10:04Z","git_url":"git://github.com/owncloud/documentation.git","ssh_url":"git@github.com:owncloud/documentation.git","clone_url":"https://github.com/owncloud/documentation.git","svn_url":"https://github.com/owncloud/documentation","homepage":null,"size":32844,"stargazers_count":70,"watchers_count":70,"language":"CSS","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":128,"mirror_url":null,"open_issues_count":114,"forks":128,"open_issues":114,"watchers":70,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/owncloud/documentation/pulls/748"},"html":{"href":"https://github.com/owncloud/documentation/pull/748"},"issue":{"href":"https://api.github.com/repos/owncloud/documentation/issues/748"},"comments":{"href":"https://api.github.com/repos/owncloud/documentation/issues/748/comments"},"review_comments":{"href":"https://api.github.com/repos/owncloud/documentation/pulls/748/comments"},"review_comment":{"href":"https://api.github.com/repos/owncloud/documentation/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/owncloud/documentation/pulls/748/commits"},"statuses":{"href":"https://api.github.com/repos/owncloud/documentation/statuses/00fe3888124f33ba09a295225f423dc0c6accbcd"}}}}