{"action":"created","issue":{"url":"https://api.github.com/repos/sagemath/cloud/issues/60","labels_url":"https://api.github.com/repos/sagemath/cloud/issues/60/labels{/name}","comments_url":"https://api.github.com/repos/sagemath/cloud/issues/60/comments","events_url":"https://api.github.com/repos/sagemath/cloud/issues/60/events","html_url":"https://github.com/sagemath/cloud/issues/60","id":22005395,"number":60,"title":"API access","user":{"login":"haraldschilly","id":207405,"avatar_url":"https://avatars.githubusercontent.com/u/207405?v=3","gravatar_id":"","url":"https://api.github.com/users/haraldschilly","html_url":"https://github.com/haraldschilly","followers_url":"https://api.github.com/users/haraldschilly/followers","following_url":"https://api.github.com/users/haraldschilly/following{/other_user}","gists_url":"https://api.github.com/users/haraldschilly/gists{/gist_id}","starred_url":"https://api.github.com/users/haraldschilly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haraldschilly/subscriptions","organizations_url":"https://api.github.com/users/haraldschilly/orgs","repos_url":"https://api.github.com/users/haraldschilly/repos","events_url":"https://api.github.com/users/haraldschilly/events{/privacy}","received_events_url":"https://api.github.com/users/haraldschilly/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/sagemath/cloud/labels/backend","name":"backend","color":"000000"},{"url":"https://api.github.com/repos/sagemath/cloud/labels/enhance","name":"enhance","color":"009800"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2013-11-02T17:34:59Z","updated_at":"2015-09-10T15:00:57Z","closed_at":null,"body":"This issue is for brainstorming about a small API for SMC projects. One use case, similar to #19, is a way to automatically upload files into a certain directory. A way to implement this could be this:\r\n\r\n1. in the project settings, generate one or more API access token - that's a password-like hash, which can be revoked at any time. If there is a need to specify certain permissions, they are tied to such a token. Each HTTP request has to specify in its HTTP header this access token: `x-smc-authorization: <token>`.\r\n1. expose RESTful service URLs like: `https://SMC/projects/<ID>/api/<verb>` where verb is the kind of action you want to do. Besides the `<verb>`, also the type of request is important.\r\n\r\nVerbs / Type:\r\n\r\n* `files` / `POST` or `PUT`:\r\n   * Additional Headers: \r\n        * `x-smc-filename`: the filename (mandatory; is there a standard for POST file uploads to include the filename?)\r\n        * `x-smc-path`: the path, where the file is stored. (optional, if not specified, its $HOME). If the path doesn't exist, create it.\r\n\r\n* `files` / `PATCH`: this is similar to POST or PUT, except that the transferred content is a classical diff file to patch the target file. This might come in handy, if you have a larger csv file and just want to append new results to it.\r\n   * Additional Headers: see above\r\n   * The reply should contain an information if the patch has been applied cleanly; we also have to figure out what to do if it doesn't work.\r\n\r\n* `files` / `GET`: almost identical to the `raw` file view, except that it uses the authorization token to download the file and hence bypasses the cookie based authentication. `GET` requests on directories (and especially on `/` ... which is `$HOME`) might list all the files in that directory.\r\n\r\n* `files` / `DELETE`: this would also exist as a regular http request. the main question is, if delete requests should be handled at all - probably there is no need anyways.\r\n\r\n* `cmd` / `POST`: execute a command. The headers should contain the path where it should run (default is $HOME) and another header is the exact command line that should be executed. Questions are, should it wait for completion or run asynchronously with a timeout? `x-smc-async: (true|false)` could set this ... but makes this even more complicated.\r\n\r\nReplies: \r\n\r\n* send a bit of JSON encoded information. e.g. `{status: \"ok\"}` or `{status: \"error\", error: \"error message\"}`"},"comment":{"url":"https://api.github.com/repos/sagemath/cloud/issues/comments/139272909","html_url":"https://github.com/sagemath/cloud/issues/60#issuecomment-139272909","issue_url":"https://api.github.com/repos/sagemath/cloud/issues/60","id":139272909,"user":{"login":"pdehaye","id":3274335,"avatar_url":"https://avatars.githubusercontent.com/u/3274335?v=3","gravatar_id":"","url":"https://api.github.com/users/pdehaye","html_url":"https://github.com/pdehaye","followers_url":"https://api.github.com/users/pdehaye/followers","following_url":"https://api.github.com/users/pdehaye/following{/other_user}","gists_url":"https://api.github.com/users/pdehaye/gists{/gist_id}","starred_url":"https://api.github.com/users/pdehaye/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pdehaye/subscriptions","organizations_url":"https://api.github.com/users/pdehaye/orgs","repos_url":"https://api.github.com/users/pdehaye/repos","events_url":"https://api.github.com/users/pdehaye/events{/privacy}","received_events_url":"https://api.github.com/users/pdehaye/received_events","type":"User","site_admin":false},"created_at":"2015-09-10T15:00:57Z","updated_at":"2015-09-10T15:00:57Z","body":"Any update here?"}}