ADPAPIClient.HttpClient.createClaim C# (CSharp) Method

createClaim() public method

public createClaim ( string jsonPayload ) : string
jsonPayload string
return string
        public string createClaim(string jsonPayload)
        {
            fullUrl = getUrl("external_users/claims.json");
            WebClient client = instantiateClient();
            try
            {
                response = client.UploadString(fullUrl, jsonPayload);
                responseStatusCode = HttpStatusCode.OK;
            }
            catch (WebException ex)
            {
                response = extractErrorDetails(ex);
            }
            return response;
        }

Usage Example

Example #1
0
        private void createCaseButton_Click(object sender, EventArgs e)
        {
            statusMessage.Text = postingClaimStatusMessage;
            Case       myCase  = populateCase();
            HttpClient client  = new HttpClient();
            string     payload = myCase.toJson();

            string response = client.createClaim(payload);

            sentToServerLabel.Text   = formatSentToServerLabel(client, payload);
            statusMessage.Text       = displayResponseStatusMessage;
            responseLabel.Text       = responseLabelText;
            serverResponseLabel.Text = "Status: " + client.responseStatusCode + "  " + response;
        }