Exemple #1
0
        public static int createDev(KepTemplate keptemplate, string chname, string name, string hostid, string port)
        {
            var client = new RestClient(kepConfApiUrl + "/config/v1/project/channels/" + chname + "/devices/");

            client.Authenticator = kepAuth;
            var request = new RestRequest(Method.POST);

            request.AddHeader("cache-control", "no-cache");
            request.AddHeader("content-type", "application/json");
            request.AddParameter("application/json", keptemplate.getDevJson(name, hostid, port), ParameterType.RequestBody);
            IRestResponse response = client.Execute(request);

            return((int)response.StatusCode);
        }
Exemple #2
0
        public static int createCh(KepTemplate keptemplate, string name)
        {
            var client = new RestClient(kepConfApiUrl + "/config/v1/project/channels/");

            client.Authenticator = kepAuth;
            var request = new RestRequest(Method.POST);

            request.AddHeader("cache-control", "no-cache");
            // request.AddHeader("authorization", "Basic QWRtaW5pc3RyYXRvcjo=");
            request.AddHeader("content-type", "application/json");
            request.AddParameter("application/json", keptemplate.getChJson(name, "5000"), ParameterType.RequestBody);
            IRestResponse response = client.Execute(request);

            return((int)response.StatusCode);
        }
Exemple #3
0
        public static int createTags(KepTemplate keptemplate, string chname, string devname, List <Tuple <string, string, int> > tags)
        {
            var client = new RestClient(kepConfApiUrl + "/config/v1/project/channels/" + chname + "/devices/" + devname + "/tags");

            client.Authenticator = kepAuth;
            var request = new RestRequest(Method.POST);

            request.AddHeader("cache-control", "no-cache");
            request.AddHeader("content-type", "application/json");


            var tagsJson = keptemplate.getTagsJson(tags);

            request.AddParameter("application/json", tagsJson, ParameterType.RequestBody);
            IRestResponse response = client.Execute(request);

            return((int)response.StatusCode);
        }