Пример #1
0
        private async Task <CaseDetails> GetCaseAsync(String cxmEndPoint, String cxmAPIKey, String caseReference, String taskToken)
        {
            CaseDetails caseDetails = new CaseDetails();
            HttpClient  cxmClient   = new HttpClient();

            cxmClient.BaseAddress = new Uri(cxmEndPoint);
            String             requestParameters = "key=" + cxmAPIKey;
            HttpRequestMessage request           = new HttpRequestMessage(HttpMethod.Get, "/api/service-api/norbert/case/" + caseReference + "?" + requestParameters);

            try
            {
                HttpResponseMessage response = cxmClient.SendAsync(request).Result;
                if (response.IsSuccessStatusCode)
                {
                    HttpContent responseContent = response.Content;
                    String      responseString  = responseContent.ReadAsStringAsync().Result;
                    JObject     caseSearch      = JObject.Parse(responseString);
                    caseDetails.customerContact = (String)caseSearch.SelectToken("values.enquiry_details");
                }
                else
                {
                    await SendFailureAsync("Getting case details for " + caseReference, response.StatusCode.ToString());

                    Console.WriteLine("ERROR : GetStaffResponseAsync : " + request.ToString());
                    Console.WriteLine("ERROR : GetStaffResponseAsync : " + response.StatusCode.ToString());
                }
            }
            catch (Exception error)
            {
                await SendFailureAsync("Getting case details for " + caseReference, error.Message);

                Console.WriteLine("ERROR : GetStaffResponseAsync : " + error.StackTrace);
            }
            return(caseDetails);
        }
Пример #2
0
        private async Task <Boolean> ProcessCaseAsync()
        {
            CaseDetails caseDetails = await GetCaseAsync(cxmEndPoint, cxmAPIKey, caseReference, taskToken);

            //Start of your code
            await UpdateCaseDetailsAsync("your-field", "your-field-value");

            //End of your code
            return(true);
        }