public AuthResponsev6 testRestConnectionv6()
        {
            String URL = this.RestEndpointURL + ":" + this.RestAuthEndpointPort + "/v1/authentication";

            string json = "{ \"username\" : \"" + this.RestLogin + "\", \"password\" : \"" + this.RestPassword + "\" }";
            //Console.WriteLine("Debug:" + URL+":"+json);
            RestResponse resp = RestUtils.SendAuthRequest(URL, json, this.IQBotMajorVersion);

            if (resp.ORetCode != 0)
            {
                Console.WriteLine(" -- Error Code: " + resp.ORetCode);
                return(null);
            }
            else
            {
                //AuthResponsev6_401
                AuthResponsev6 r = JsonConvert.DeserializeObject <AuthResponsev6>(resp.RetResponse);

                if (r.token == null)
                {
                    Console.WriteLine(" -- Error: REST Authentication failed.");
                    this.RestAuthToken = null;
                    return(null);
                }

                this.RestAuthToken = r.token;
                return(r);
            }
        }
Exemple #2
0
        public String GetAllLearningInstances()
        {
            String       Req    = this.broker.RestEndpointURL + ":" + this.broker.RestAuthEndpointPort + "/api/projects";
            RestResponse MyResp = RestUtils.SendGetRequest(Req, this.broker.RestAuthToken, this.broker.IQBotMajorVersion);

            return(MyResp.RetResponse);
        }