{"action":"created","issue":{"url":"https://api.github.com/repos/grafana/grafana/issues/5991","repository_url":"https://api.github.com/repos/grafana/grafana","labels_url":"https://api.github.com/repos/grafana/grafana/issues/5991/labels{/name}","comments_url":"https://api.github.com/repos/grafana/grafana/issues/5991/comments","events_url":"https://api.github.com/repos/grafana/grafana/issues/5991/events","html_url":"https://github.com/grafana/grafana/issues/5991","id":175763329,"number":5991,"title":"API: add datasource to a specific organization","user":{"login":"loic911","id":1715849,"avatar_url":"https://avatars.githubusercontent.com/u/1715849?v=3","gravatar_id":"","url":"https://api.github.com/users/loic911","html_url":"https://github.com/loic911","followers_url":"https://api.github.com/users/loic911/followers","following_url":"https://api.github.com/users/loic911/following{/other_user}","gists_url":"https://api.github.com/users/loic911/gists{/gist_id}","starred_url":"https://api.github.com/users/loic911/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/loic911/subscriptions","organizations_url":"https://api.github.com/users/loic911/orgs","repos_url":"https://api.github.com/users/loic911/repos","events_url":"https://api.github.com/users/loic911/events{/privacy}","received_events_url":"https://api.github.com/users/loic911/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-09-08T14:07:24Z","updated_at":"2016-09-08T17:43:40Z","closed_at":"2016-09-08T14:32:10Z","body":"Hello,\r\n\r\nI'm using the Grafana 3.1.1 API. \r\nI try to create an organization and a datasource inside this organization but the datasource has always orgId=1.\r\n\r\nI first try with:\r\n\r\n**1. POST http://localhost:3000/api/orgs with data**\r\n _Request data: {\"name\":\"test16\"}_\r\n_Response id:19_\r\n\r\n**2. POST http://localhost:3000/api/datasources**\r\n_Request data: {\"database\":\"databaseName\",\"password\":\"password\",\"access\":\"proxy\",\"name\":\"test16\",\"host\":\"http://localhost:8086\",\"type\":\"influxdb\",\"username\":\"user\",**\"orgId\":19**}_\r\n_Response id: 14_\r\n\r\n**3. GET http://localhost:3000/api/datasources/14**\r\n_Request data: {id=14, **orgId=1**, name=test16, type=influxdb, typeLogoUrl=, access=proxy, url=, password=password, user=, database=databaseName, basicAuth=false, basicAuthUser=, basicAuthPassword=, withCredentials=false, isDefault=false, jsonData={}}_\r\n\r\n\r\n\r\nThe organization id from datasource is not correct. So I try to switch the current user organization after the organization creation:\r\n\r\n**1. Create organization (same request as below)**\r\n\r\n**2. POST http://localhost:3000/api/user/using/19**\r\n_Request data: {\"message\":\"Active organization changed\"}_\r\n\r\n**3. Create datasource**\r\n\r\n**4. GET http://localhost:3000/api/datasources/14**\r\n_Request data: {id=14, **orgId=1**, name=test16, type=influxdb, typeLogoUrl=, access=proxy, url=, password=password, user=, database=databaseName, basicAuth=false, basicAuthUser=, basicAuthPassword=, withCredentials=false, isDefault=false, jsonData={}}_\r\n\r\nHow can I add a datasource inside a specific organization (not the default one)?\r\n\r\nThanks"},"comment":{"url":"https://api.github.com/repos/grafana/grafana/issues/comments/245678969","html_url":"https://github.com/grafana/grafana/issues/5991#issuecomment-245678969","issue_url":"https://api.github.com/repos/grafana/grafana/issues/5991","id":245678969,"user":{"login":"loic911","id":1715849,"avatar_url":"https://avatars.githubusercontent.com/u/1715849?v=3","gravatar_id":"","url":"https://api.github.com/users/loic911","html_url":"https://github.com/loic911","followers_url":"https://api.github.com/users/loic911/followers","following_url":"https://api.github.com/users/loic911/following{/other_user}","gists_url":"https://api.github.com/users/loic911/gists{/gist_id}","starred_url":"https://api.github.com/users/loic911/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/loic911/subscriptions","organizations_url":"https://api.github.com/users/loic911/orgs","repos_url":"https://api.github.com/users/loic911/repos","events_url":"https://api.github.com/users/loic911/events{/privacy}","received_events_url":"https://api.github.com/users/loic911/received_events","type":"User","site_admin":false},"created_at":"2016-09-08T17:43:40Z","updated_at":"2016-09-08T17:43:40Z","body":"That's what I explain in the second case.\r\nBut the switch don't work with API keys, even if it tells me \"Active organization changed\".\r\nI will use basic auth.\r\n\r\n\r\n"}}
{"actor":{"display_login":"loic911"}}