{"action":"created","issue":{"url":"https://api.github.com/repos/semiotproject/wot-semdesc-helper/issues/12","labels_url":"https://api.github.com/repos/semiotproject/wot-semdesc-helper/issues/12/labels{/name}","comments_url":"https://api.github.com/repos/semiotproject/wot-semdesc-helper/issues/12/comments","events_url":"https://api.github.com/repos/semiotproject/wot-semdesc-helper/issues/12/events","html_url":"https://github.com/semiotproject/wot-semdesc-helper/issues/12","id":106149579,"number":12,"title":"Implement JSON RESTful API","user":{"login":"soylent-grin","id":4552250,"avatar_url":"https://avatars.githubusercontent.com/u/4552250?v=3","gravatar_id":"","url":"https://api.github.com/users/soylent-grin","html_url":"https://github.com/soylent-grin","followers_url":"https://api.github.com/users/soylent-grin/followers","following_url":"https://api.github.com/users/soylent-grin/following{/other_user}","gists_url":"https://api.github.com/users/soylent-grin/gists{/gist_id}","starred_url":"https://api.github.com/users/soylent-grin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/soylent-grin/subscriptions","organizations_url":"https://api.github.com/users/soylent-grin/orgs","repos_url":"https://api.github.com/users/soylent-grin/repos","events_url":"https://api.github.com/users/soylent-grin/events{/privacy}","received_events_url":"https://api.github.com/users/soylent-grin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"garayzuev","id":7770646,"avatar_url":"https://avatars.githubusercontent.com/u/7770646?v=3","gravatar_id":"","url":"https://api.github.com/users/garayzuev","html_url":"https://github.com/garayzuev","followers_url":"https://api.github.com/users/garayzuev/followers","following_url":"https://api.github.com/users/garayzuev/following{/other_user}","gists_url":"https://api.github.com/users/garayzuev/gists{/gist_id}","starred_url":"https://api.github.com/users/garayzuev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/garayzuev/subscriptions","organizations_url":"https://api.github.com/users/garayzuev/orgs","repos_url":"https://api.github.com/users/garayzuev/repos","events_url":"https://api.github.com/users/garayzuev/events{/privacy}","received_events_url":"https://api.github.com/users/garayzuev/received_events","type":"User","site_admin":false},"milestone":null,"comments":2,"created_at":"2015-09-12T11:32:27Z","updated_at":"2015-09-16T14:02:26Z","closed_at":null,"body":"We have next components in our app: Browser(client code), Proxy(backend code), TripleStore(Fuseki, SPARQL Endpoint). Here is described communication API protocol between Browser and Proxy.\r\nOn any request, if user is not authorized with OAuth - return `401 Unauthorized` HTTP code.\r\n\r\n1. GET `/api/v1/current_user` - returns exactly the same, that GitHub returns `https://api.github.com/user`, but only `login`, `id` and `avatar_url` will be used on the client.\r\n2. POST `/api/v1/class`. Creates new class. Body is JSON-LD, representing new class. If user is authorized, append `user_id` to class JSON-LD and transfer it to TripleStore. \r\n3. PUT `/api/v1/class/${CLASS_URI}`. Modify existing class. Body is JSON-LD, representing class. `CLASS_URI` is [URLencoded](https://en.wikipedia.org/wiki/Percent-encoding) class URI. Note, that `user_id` parameter would not be sent - you should get it by yourself, and, if `user_id` is not matched current user ID - return `403 Forbidden` HTTP code. If no class found by this URI - return `404 Not Found` HTTP code. \r\n4.  DELETE `/api/v1/class/${CLASS_URI}`. Delete existing class. Body is  empty. Do the same checks, as on PUT request.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/semiotproject/wot-semdesc-helper/issues/comments/140750997","html_url":"https://github.com/semiotproject/wot-semdesc-helper/issues/12#issuecomment-140750997","issue_url":"https://api.github.com/repos/semiotproject/wot-semdesc-helper/issues/12","id":140750997,"user":{"login":"soylent-grin","id":4552250,"avatar_url":"https://avatars.githubusercontent.com/u/4552250?v=3","gravatar_id":"","url":"https://api.github.com/users/soylent-grin","html_url":"https://github.com/soylent-grin","followers_url":"https://api.github.com/users/soylent-grin/followers","following_url":"https://api.github.com/users/soylent-grin/following{/other_user}","gists_url":"https://api.github.com/users/soylent-grin/gists{/gist_id}","starred_url":"https://api.github.com/users/soylent-grin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/soylent-grin/subscriptions","organizations_url":"https://api.github.com/users/soylent-grin/orgs","repos_url":"https://api.github.com/users/soylent-grin/repos","events_url":"https://api.github.com/users/soylent-grin/events{/privacy}","received_events_url":"https://api.github.com/users/soylent-grin/received_events","type":"User","site_admin":false},"created_at":"2015-09-16T14:02:26Z","updated_at":"2015-09-16T14:02:26Z","body":"Typical solution in any JSON-LD document is to store URI in `@id` field, for example:\r\n```javascript\r\n{\r\n  \"@id\": \"http://example.org/cars/for-sale#tesla\"\r\n}\r\n````"}}