Пример #1
0
        public override List <QueryResponse> RunQueries(IDictionary <string, object> config, string id, Core.Mesh.Properties properties)
        {
            var serviceNowCrawlJobData = new ServiceNowCrawlJobData(config);
            var client  = new RestClient(string.Format("{0}/api/now/table", serviceNowCrawlJobData.BaseUrl));
            var request = new RestRequest(EditUrl, Method.POST);

            client.Authenticator = new HttpBasicAuthenticator(serviceNowCrawlJobData.Username, serviceNowCrawlJobData.Password);

            request.AddJsonBody(properties);

            var result = client.ExecuteTaskAsync(request).Result;

            return(new List <QueryResponse>()
            {
                new QueryResponse()
                {
                    Content = result.Content, StatusCode = result.StatusCode
                }
            });
        }
Пример #2
0
 public override List <QueryResponse> RunQueries(IDictionary <string, object> config, string id, Core.Mesh.Properties properties)
 {
     throw new NotImplementedException();
 }
Пример #3
0
        public override List <RawQuery> GetRawQueries(IDictionary <string, object> config, IEntity entity, Core.Mesh.Properties properties)
        {
            var serviceNowCrawlJobData = new ServiceNowCrawlJobData(config);

            return(new List <Core.Messages.WebApp.RawQuery>()
            {
                new Core.Messages.WebApp.RawQuery()
                {
                    Query = string.Format("curl -X POST " + string.Format("{0}/api/now/table/", serviceNowCrawlJobData.BaseUrl) + EditUrl + "--header 'Authorization: Basic {0}' --header \"Content-Type: application/json\"" + " --data '{2}'", serviceNowCrawlJobData.Username, this.GetLookupId(entity), JsonUtility.Serialize(properties)),
                    Source = "cUrl"
                }
            });
        }
Пример #4
0
 public override List <RawQuery> GetRawQueries(IDictionary <string, object> config, IEntity entity, Core.Mesh.Properties properties)
 {
     throw new NotImplementedException();
 }