POST Update Application – Client examples

Update Application

/**
 * @author Bluedot Innovation
 * Copyright (c) 2016 Bluedot Innovation. All rights reserved.
 * Update Application client demonstrates updating an existing application to your Bluedot backend
 * using 'request' node module.
 */
var request = require('request');
var applicationData = {
    "security": {
        /* This key is generated by Bluedot Point Access UI when your account is created. It is also available
         * on the PointAccess interface in the Edit Profile section. */
        "customerApiKey": "86577370-7b91-11e4-bcb7-a0481cdc3311"
    },
    "content": {
        "application" : {
            /* This ID is retrieved through the GET Applications call */
            "applicationId" : "6e28197b-81a3-4995-9990-93ea3178cb5e",
            /* Time in Hour:Minute format.*/
            "nextRuleUpdateIntervalFormatted": "00:07"
        }
    }
};
var options = {
    uri: 'https://api.bluedotinnovation.com/1/applications',
    method: 'POST',
    json: applicationData
};
request ( options,
    function (error, response, body) {
        if (error) {
            console.log(error);
        }
        console.log(JSON.stringify(response.body));
    }
);

Update Application with Webhook

/**
 * @author Bluedot Innovation
 * Copyright (c) 2016 Bluedot Innovation. All rights reserved.
 * Update Application with Webhook client demonstrates updating an existing application which has webhooks enabled for it, to your Bluedot backend
 * using 'request' node module.
 */
var request = require('request');
var applicationData = {
    "security": {
        /* The customerApiKey is generated when customer registers first time. It is also available
         * on the PointAccess interface in the Edit Profile section. */
        "customerApiKey": "86577370-7b91-11e4-bcb7-a0481cdc3311"
    },
    "content": {
        "application" : {
            /* This ID is retrieved through the GET Applications call */
            "applicationId" : "6e28197b-81a3-4995-9990-93ea3178cb5e",
            /* Time in Hour:Minute format.*/
            "nextRuleUpdateIntervalFormatted": "00:07",
            "webhook": {
                /*The URL of the server where the webhooks will be received.*/
                "url": "https://api.campusapp.com/webhook/checkinreceiver",
                "enabled": true,
                /*The Security Token Key is the name of the field to be sent in the POST request header.*/
                "securityTokenKey": "authToken",
                /*The Security Token Value field is value of the Security Token Key field sent in the POST request header.*/
                "securityTokenValue": "f2f7a58c-f0d5-498c-9bad-acbc89923dc5"
            }
        }
    }
};
var options = {
    uri: 'https://api.bluedotinnovation.com/1/applications',
    method: 'POST',
    json: applicationData
};
request ( options,
    function (error, response, body) {
        if (error) {
            console.log(error);
        }
        console.log(JSON.stringify(response.body));
    }
);

Update Application with Zones Sync enabled

/**
 * @author Bluedot Innovation
 * Copyright (c) 2016 Bluedot Innovation. All rights reserved.
 * Update Application Zones Sync Enabled client demonstrates updating an existing application to your Bluedot backend
 * using 'request' node module for which the zones sync will be available using Firebase push.
 */
var request = require('request');
var applicationData = {
    "security": {
        /* This key is generated by Bluedot Point Access UI when your account is created. It is also available
         * on the PointAccess interface in the Edit Profile section. */
        "customerApiKey": "86577370-7b91-11e4-bcb7-a0481cdc3311"
    },
    "content": {
        "application" : {
            /* This ID is retrieved through the GET Applications call */
            "applicationId" : "6e28197b-81a3-4995-9990-93ea3178cb5e",
            /* Time in Hour:Minute format.*/
            "nextRuleUpdateIntervalFormatted": "00:07",
            /*The Web API key from Firebase project settings.
             * Using this key our backend will be able to communicate with Firebase to deliver the
             * zones that need to be synced to your application.*/
            "firebaseApiKey": "gDZyt1Bj_Y6S8BKyQfKH6uZ9wc475hrRlGA_6lS"
        }
    }
};
var options = {
    uri: 'https://api.bluedotinnovation.com/1/applications',
    method: 'POST',
    json: applicationData
};
request ( options,
    function (error, response, body) {
        if (error) {
            console.log(error);
        }
        console.log(JSON.stringify(response.body));
    }
);

Update Application

package com.bluedotinnovation.application;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.Charset;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
import com.bluedotinnovation.common.BDCommon;
/**
 * @author Bluedot Innovation
 * Copyright (c) 2016 Bluedot Innovation. All rights reserved.
 * Update Application client demonstrates updating an existing application to your Bluedot backend using Apache HTTP client and JSON Simple libraries.
 */
public class UpdateApplication extends BDCommon {
     
    /**
     * @param args
     * @throws IOException
     * @throws ParseException
     * @throws NoSuchAlgorithmException
     * @throws KeyManagementException
     */
    public static void main(String[] args) throws IOException, ParseException, KeyManagementException, NoSuchAlgorithmException {
         
        String bdCustomerApiKey    = "86577370-7b91-11e4-bcb7-a0481cdc3311"; //This key is generated by Bluedot Point Access UI when your account is created.
        String bdApplicationId     = "564ecdc0-7e86-11e4-95ff-a0481cdba490"; //This ID is retrieved through the GET Applications call
        String bdRestUrl = "https://api.bluedotinnovation.com/1/applications";
         
        CloseableHttpClient httpRestClient = HttpClients.custom().setSSLSocketFactory(getSSLContextFactory()).build();
         
        String application =
                "{" +
                     "\"security\": {" +
                         /*
                          customerApiKey is generated when customer registers first time. It is also available
                          on the PointAccess interface in the Edit Profile section.
                         */
                         "\"customerApiKey\":" + "\"" + bdCustomerApiKey + "\"" +
                   "}," +
                   "\"content\": { " +
                       "\"application\" : {" +
                                 /*This is the id of the application as opposed to the api key.
                                  * This is returned when the application/getAll is called*/
                                 "\"applicationId\":" + "\"" + bdApplicationId + "\"," +
                                 /* Time in Hour:Minute format.*/
                                 "\"nextRuleUpdateIntervalFormatted\": \"00:10\"" +
                            "}" +
                       "}" +
                 "}";
         
        JSONObject bdApplicationJSONObject;    
        JSONParser parser       = new JSONParser();
        bdApplicationJSONObject = (JSONObject)  parser.parse(application);
        HttpPost postRequest = new HttpPost(bdRestUrl);
        postRequest.addHeader("content-type", "application/json");
        postRequest.setEntity(new StringEntity(bdApplicationJSONObject.toJSONString(), Charset.defaultCharset()));
      
        HttpResponse response = httpRestClient.execute(postRequest);
        if (response.getStatusLine().getStatusCode() == 200) {
            System.out.println("Application was successfully updated.");
            InputStream inputStream = response.getEntity().getContent();
            byte[] bytes            = readStream(inputStream);
            String resultString     = new String(bytes); //json result
            JSONObject jsonResult   = (JSONObject)  parser.parse(resultString);
            System.out.println("Application ID for your application is : " + jsonResult.get("applicationId"));
        } else {
            InputStream inputStream = response.getEntity().getContent();
            byte[] bytes            = readStream(inputStream);
            String resultString     = new String(bytes); //json error result
            System.out.println(resultString);
        }          
    }
}

Update Application with Webhook

package com.bluedotinnovation.application;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.Charset;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
import com.bluedotinnovation.common.BDCommon;
/**
 * @author Bluedot Innovation
 * Copyright (c) 2016 Bluedot Innovation. All rights reserved.
 * Update Application with Webhook client demonstrates updating existing an application which has webhooks enabled for it to your Bluedot backend
 * using Apache HTTP client and JSON Simple libraries.
 */
public class UpdateApplicationWithWebhook extends BDCommon {
     
    /**
     * @param args
     * @throws IOException
     * @throws ParseException
     * @throws NoSuchAlgorithmException
     * @throws KeyManagementException
     */
    public static void main(String[] args) throws IOException, ParseException, KeyManagementException, NoSuchAlgorithmException {
         
        String bdCustomerApiKey    = "86577370-7b91-11e4-bcb7-a0481cdc3311"; //This key is generated by Bluedot Point Access UI when your account is created.
        String bdApplicationId     = "564ecdc0-7e86-11e4-95ff-a0481cdba490"; //This ID is retrieved through the GET Applications call
        String bdRestUrl = "https://api.bluedotinnovation.com/1/applications";
         
        CloseableHttpClient httpRestClient = HttpClients.custom().setSSLSocketFactory(getSSLContextFactory()).build();
         
        String applicationWithWebhook =
                "{" +
                    "\"security\": {" +
                         "\"customerApiKey\":" + "\"" + bdCustomerApiKey + "\"" +
                    "}," +
                    "\"content\": { " +
                        "\"application\" : {" +
                            /*This is the id of the application as opposed to the api key.
                             * This is returned when the application/getAll is called*/
                            "\"applicationId\":" + "\"" + bdApplicationId + "\"," +
                            /*Time in Hour:Minute format.*/
                            "\"nextRuleUpdateIntervalFormatted\": \"00:10\"," +
                            "\"webhook\": {" +
                                /*The URL of the server where the webhooks will be received.*/
                                "\"url\": \"https://api.campusapp.com/webhook/checkinreceiver\"," +
                                "\"enabled\" : true," +
                                /*The Security Token Key is the name of the field to be sent in the POST request header.*/
                                "\"securityTokenKey\" : \"authToken\"," +
                                /*The Security Token Value field is value of the Security Token Key field sent in the POST request header.*/
                                "\"securityTokenValue\" : \"f2f7a58c-f0d5-498c-9bad-acbc89923dc5\"" +
                            "}"+
                         "}" +
                    "}" +
                "}";
         
        JSONObject bdApplicationJSONObject;    
        JSONParser parser       = new JSONParser();
        bdApplicationJSONObject = (JSONObject)  parser.parse(applicationWithWebhook);
        HttpPost postRequest = new HttpPost(bdRestUrl);
        postRequest.addHeader("content-type", "application/json");
        postRequest.setEntity(new StringEntity(bdApplicationJSONObject.toJSONString(), Charset.defaultCharset()));
      
        HttpResponse response = httpRestClient.execute(postRequest);
        if (response.getStatusLine().getStatusCode() == 200) {
            System.out.println("Application was successfully updated.");
            InputStream inputStream = response.getEntity().getContent();
            byte[] bytes            = readStream(inputStream);
            String resultString     = new String(bytes); //json result
            JSONObject jsonResult   = (JSONObject)  parser.parse(resultString);
            System.out.println("Application ID for your application is : " + jsonResult.get("applicationId"));
        } else {
            InputStream inputStream = response.getEntity().getContent();
            byte[] bytes            = readStream(inputStream);
            String resultString     = new String(bytes); //json error result
            System.out.println(resultString);
        }          
    }
}

Update Application with Zones Sync enabled

package com.bluedotinnovation.application;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.Charset;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
import com.bluedotinnovation.common.BDCommon;
/**
 * @author Bluedot Innovation
 * Copyright (c) 2016 Bluedot Innovation. All rights reserved.
 * Update Application Zones Sync Enabled client demonstrates updating an existing application to your Bluedot backend
 * using Apache HTTP client and JSON Simple libraries for which the zones sync will be available using Firebase push.
 */
public class UpdateApplicationZonesSyncEnabled extends BDCommon {
     
    /**
     * @param args
     * @throws IOException
     * @throws ParseException
     * @throws NoSuchAlgorithmException
     * @throws KeyManagementException
     */
    public static void main(String[] args) throws IOException, ParseException, KeyManagementException, NoSuchAlgorithmException {
         
        String bdCustomerApiKey    = "86577370-7b91-11e4-bcb7-a0481cdc3311"; //This key is generated by Bluedot Point Access UI when your account is created.
        String bdApplicationId     = "564ecdc0-7e86-11e4-95ff-a0481cdba490"; //This is the id of the application as opposed to the api key. This ID is retrieved through the GET Applications call
        String bdRestUrl           = "https://api.bluedotinnovation.com/1/applications";
         
        CloseableHttpClient httpRestClient = HttpClients.custom().setSSLSocketFactory(getSSLContextFactory()).build();
         
        String application =
                "{" +
                     "\"security\": {" +
                         /* customerApiKey is generated when customer registers first time. It is also available
                          * on the PointAccess interface in the Edit Profile section.*/
                         "\"customerApiKey\":" + "\"" + bdCustomerApiKey + "\"" +
                   "}," +
                   "\"content\": { " +
                       "\"application\" : {" +
                                 /*This is the id of the application as opposed to the api key.
                                  * This ID is retrieved through the GET Applications call*/
                                 "\"applicationId\":" + "\"" + bdApplicationId + "\"," +
                                 /* Time in Hour:Minute format.*/
                                 "\"nextRuleUpdateIntervalFormatted\": \"00:10\"," +
                                 /*The Web API key from Firebase project settings.
                                 * Using this key our backend will be able to communicate with Firebase to deliver the
                                 * zones that need to be synced to your application.*/
                                 "\"firebaseApiKey\": \"gDZyt1Bj_Y6S8BKyQfKH6uZ9wc475hrRlGA_6lS\"" +
                            "}" +
                       "}" +
                 "}";
         
        JSONObject bdApplicationJSONObject;    
        JSONParser parser       = new JSONParser();
        bdApplicationJSONObject = (JSONObject)  parser.parse(application);
        HttpPost postRequest = new HttpPost(bdRestUrl);
        postRequest.addHeader("content-type", "application/json");
        postRequest.setEntity(new StringEntity(bdApplicationJSONObject.toJSONString(), Charset.defaultCharset()));
      
        HttpResponse response = httpRestClient.execute(postRequest);
        if (response.getStatusLine().getStatusCode() == 200) {
            System.out.println("Application with Zones Sync enabled was successfully updated.");
            InputStream inputStream = response.getEntity().getContent();
            byte[] bytes            = readStream(inputStream);
            String resultString     = new String(bytes); //json result
            JSONObject jsonResult   = (JSONObject)  parser.parse(resultString);
            System.out.println("Application ID  for your application is : " + jsonResult.get("applicationId"));
        } else {
            InputStream inputStream = response.getEntity().getContent();
            byte[] bytes            = readStream(inputStream);
            String resultString     = new String(bytes); //json error result
            System.out.println(resultString);
        }          
    }
}

Update Application

using System;
using System.Linq;
using System.Text;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using System.Net;
using System.Web.Script.Serialization;
using System.IO;
using System.Security.Cryptography.X509Certificates;
/**
 * @author Bluedot Innovation
 * Copyright (c) 2016 Bluedot Innovation. All rights reserved.
 * Update Application client demonstrates updating an existing application to to an existing the customer's account using .net http web api library
 * Pass the applicationId of the application to be updated.
 */
namespace BluedotPublicApiClient.applicationclient
{
    public class UpdateApplication
    {
        public void update()
        {
            String bdCustomerApiKey = "73ad7b80-7c4e-11e4-a2d3-b8ca3a6b879d"; //This key is generated by Bluedot Point Access UI when your account is created
            String bdApplicationId  = "564ecdc0-7e86-11e4-95ff-a0481cdba490"; //This ID is retrieved through the GET Applications call
            String bdRestUrl        = "https://api.bluedotinnovation.com/1/applications";
            String application =
               "{" +
                 "\"security\": {" +
                     /*
                      customerApiKey is generated when customer registers first time. It is also available
                      on the PointAccess interface in the Edit Profile section.
                     */
                     "\"customerApiKey\":" + "\"" + bdCustomerApiKey + "\"" +
               "}," +
               "\"content\": { " +
                   "\"application\" : {" +
                        "\"applicationId\":" + "\"" + bdApplicationId + "\"," + /*This is the id of the application as opposed to the api key. This is returned when the application/getAll is called*/
                        /* Time in Hour:Minute format.*/
                        "\"nextRuleUpdateIntervalFormatted\": \"00:10\"" +
                   "}" +
                "}" +
             "}";
            WebRequestHandler handler = new WebRequestHandler();
            X509Certificate2 certificate = new X509Certificate2();
            handler.ClientCertificates.Add(certificate);
            HttpClient httpRestClient = new HttpClient(handler);
            //specify to use TLS 1.2 as default connection
            System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
            httpRestClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            HttpContent jsonApplicationContent = new StringContent(@application);
            jsonApplicationContent.Headers.ContentType = new MediaTypeHeaderValue("application/json");
            HttpResponseMessage serverResponse = httpRestClient.PostAsync(new Uri(bdRestUrl), jsonApplicationContent).Result;
            if (serverResponse.IsSuccessStatusCode)
            {
                var result = serverResponse.Content.ReadAsStringAsync().Result;
                Console.WriteLine("{0}", result);
            }
            else
            {
                Console.WriteLine("{0} ({1})", (int)serverResponse.StatusCode, serverResponse.Content.ReadAsStringAsync().Result);
            }
        }
    }
}

Update Application with Webhook

using System;
using System.Linq;
using System.Text;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using System.Net;
using System.Web.Script.Serialization;
using System.IO;
using System.Security.Cryptography.X509Certificates;
/**
 * @author Bluedot Innovation
 * Copyright (c) 2016 Bluedot Innovation. All rights reserved.
 * Update Application client demonstrates updating an exsiting application to to an existing the customer's account using .net http web api library
 * Pass the applicationId of the application to be updated.
 */
namespace BluedotPublicApiClient.applicationclient
{
    public class UpdateApplicationWithWebhook
    {
        public void update()
        {
            String bdCustomerApiKey = "73ad7b80-7c4e-11e4-a2d3-b8ca3a6b879d"; //This key is generated by Bluedot Point Access UI when your account is created
            String bdApplicationId  = "564ecdc0-7e86-11e4-95ff-a0481cdba490"; //This ID is retrieved through the GET Applications call
            String bdRestUrl        = "https://api.bluedotinnovation.com/1/applications";
            String application =
               "{" +
                 "\"security\": {" +
                     /*
                      customerApiKey is generated when customer registers first time. It is also available
                      on the PointAccess interface in the Edit Profile section.
                     */
                     "\"customerApiKey\":" + "\"" + bdCustomerApiKey + "\"" +
               "}," +
               "\"content\": { " +
                   "\"application\" : {" +
                             /*This is the id of the application as opposed to the api key.
                              * This is returned when the application/getAll is called*/
                             "\"applicationId\":" + "\"" + bdApplicationId + "\"," +
                             /* Time in Hour:Minute format.*/
                             "\"nextRuleUpdateIntervalFormatted\": \"00:10\"," +
                             "\"webhook\": {" +
                                /*The URL of the server where the webhooks will be received.*/
                                "\"url\": \"https://api.testapplication.com/webhook/checkinreceiver\"," +
                                "\"enabled\" : true," +
                                /*The Security Token Key is the name of the field to be sent in the POST request header.*/
                                "\"securityTokenKey\" : \"authToken\"," +
                                /*The Security Token Value field is value of the Security Token Key field sent in the POST request header.*/
                                "\"securityTokenValue\" : \"f2f7a58c-f0d5-498c-9bad-acbc89923dc5\"" +
                            "}" +
                        "}" +
                   "}" +
             "}";
            WebRequestHandler handler = new WebRequestHandler();
            X509Certificate2 certificate = new X509Certificate2();
            handler.ClientCertificates.Add(certificate);
            HttpClient httpRestClient = new HttpClient(handler);
            //specify to use TLS 1.2 as default connection
            System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
            httpRestClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            HttpContent jsonApplicationContent = new StringContent(@application);
            jsonApplicationContent.Headers.ContentType = new MediaTypeHeaderValue("application/json");
            HttpResponseMessage serverResponse = httpRestClient.PostAsync(new Uri(bdRestUrl), jsonApplicationContent).Result;
            if (serverResponse.IsSuccessStatusCode)
            {
                var result = serverResponse.Content.ReadAsStringAsync().Result;
                Console.WriteLine("{0}", result);
            }
            else
            {
                Console.WriteLine("{0} ({1})", (int)serverResponse.StatusCode, serverResponse.Content.ReadAsStringAsync().Result);
            }
        }
    }
}

Update Application with Zones Sync enabled

using System;
using System.Linq;
using System.Text;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using System.Net;
using System.Web.Script.Serialization;
using System.IO;
using System.Security.Cryptography.X509Certificates;
/**
 * @author Bluedot Innovation
 * Copyright (c) 2016 Bluedot Innovation. All rights reserved.
 * Update Application with Zones Sync enabled client demonstrates updating an existing application to to an existing the customer's account
 * using .net http web api library for which the zones sync will be available using Firebase push.
 * Pass the applicationId of the application to be updated.
 */
namespace BluedotPublicApiClient.applicationclient
{
    public class UpdateApplication
    {
        public void update()
        {
            String bdCustomerApiKey = "73ad7b80-7c4e-11e4-a2d3-b8ca3a6b879d"; //This key is generated by Bluedot Point Access UI when your account is created
            String bdApplicationId  = "564ecdc0-7e86-11e4-95ff-a0481cdba490"; //This ID is retrieved through the GET Applications call
            String bdRestUrl        = "https://api.bluedotinnovation.com/1/applications";
            String application =
               "{" +
                 "\"security\": {" +
                     /*
                      customerApiKey is generated when customer registers first time. It is also available
                      on the PointAccess interface in the Edit Profile section.
                     */
                     "\"customerApiKey\":" + "\"" + bdCustomerApiKey + "\"" +
               "}," +
               "\"content\": { " +
                   "\"application\" : {" +
                        /*This is the id of the application as opposed to the api key.
                         * This is returned when the application/getAll is called.*/
                        "\"applicationId\":" + "\"" + bdApplicationId + "\"," +
                        /* Time in Hour:Minute format.*/
                        "\"nextRuleUpdateIntervalFormatted\": \"00:10\"," +
                        /*The Web API key from Firebase project settings.
                        * Using this key our backend will be able to communicate with Firebase to deliver the
                        * zones that need to be synced to your application.*/
                        "\"firebaseApiKey\": \"gDZyt1Bj_Y6S8BKyQfKH6uZ9wc475hrRlGA_6lS\"" +
                   "}" +
                "}" +
             "}";
            WebRequestHandler handler = new WebRequestHandler();
            X509Certificate2 certificate = new X509Certificate2();
            handler.ClientCertificates.Add(certificate);
            HttpClient httpRestClient = new HttpClient(handler);
            //specify to use TLS 1.2 as default connection
            System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
            httpRestClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            HttpContent jsonApplicationContent = new StringContent(@application);
            jsonApplicationContent.Headers.ContentType = new MediaTypeHeaderValue("application/json");
            HttpResponseMessage serverResponse = httpRestClient.PostAsync(new Uri(bdRestUrl), jsonApplicationContent).Result;
            if (serverResponse.IsSuccessStatusCode)
            {
                var result = serverResponse.Content.ReadAsStringAsync().Result;
                Console.WriteLine("{0}", result);
            }
            else
            {
                Console.WriteLine("{0} ({1})", (int)serverResponse.StatusCode, serverResponse.Content.ReadAsStringAsync().Result);
            }
        }
    }
}
Created by Bluedot DevOps on March 3, 2018

Start the discussion