Ejemplo n.º 1
0
        public static string PostJson(string url, string rawJsonObject, CredentialCache credentials, RallyAuth rallyAuth)
        {
            string json_response = string.Empty;

            using (WebClient client = new WebClient()) {//todo: understand 'using' better

                foreach(Cookie cookie in rallyAuth.cookies) {
                    client.Headers.Add(cookie.Name, cookie.Value);}

                client.Headers[HttpRequestHeader.ContentType] = "application/json";
                client.Credentials = credentials;
                byte[] byte_response = client.UploadData(url, Encoding.UTF8.GetBytes(rawJsonObject));

                json_response = Encoding.UTF8.GetString(byte_response);
            }

            return json_response;
        }
Ejemplo n.º 2
0
        public RallyDatabase(RallyBotConfig config)
        {
            BASE_URL = config.apiUrl ?? BASE_URL;

            RALLY_AUTH = GetRallyAuth(config.username, config.password);
        }