phill_jones Posted January 2, 2015 Posted January 2, 2015 Hi there, I am following along with the C# at http://www.pulseway.com/restapi/ I am successfully publishing a Pulseway REST API instance and seeing the Instance updated in my iPhone app and on the Pulseway Dashboard. What I am not are the labels I guess I was expecting the 'labels' to appear under the instance. Any ideas?
Staff Chris Posted January 3, 2015 Staff Posted January 3, 2015 Hi Phill, Can you please post the JSON payload you're sending to our REST API? To capture the HTTPS request we recommend you use Fiddler's HTTPS proxy by uncommenting the following line: WebRequest.DefaultWebProxy = new WebProxy("127.0.0.1", 8888) { BypassProxyOnLocal = false }; Furthermore, since you'll be dealing with self signed SSL certificates because you'll be passing through a HTTPS proxy you should disable SSL trust checks all together: ServicePointManager.ServerCertificateValidationCallback = delegate { return true; }; Or validate the Certificate Hash that was generated by Fiddler which is more secure: static readonly byte[] apiCertHash = { 0xZZ, 0xYY, ....}; /// <summary> /// Somewhere in your application's startup/init sequence... /// </summary> void InitPhase() { // Override automatic validation of SSL server certificates. ServicePointManager.ServerCertificateValidationCallback = ValidateServerCertficate; } /// <summary> /// Validates the SSL server certificate. /// </summary> /// <param name="sender">An object that contains state information for this /// validation.</param> /// <param name="cert">The certificate used to authenticate the remote party.</param> /// <param name="chain">The chain of certificate authorities associated with the /// remote certificate.</param> /// <param name="sslPolicyErrors">One or more errors associated with the remote /// certificate.</param> /// <returns>Returns a boolean value that determines whether the specified /// certificate is accepted for authentication; true to accept or false to /// reject.</returns> private static bool ValidateServerCertficate( object sender, X509Certificate cert, X509Chain chain, SslPolicyErrors sslPolicyErrors) { if (sslPolicyErrors == SslPolicyErrors.None) { // Good certificate. return true; } log.DebugFormat("SSL certificate error: {0}", sslPolicyErrors); bool certMatch = false; // Assume failure byte[] certHash = cert.GetCertHash(); if (certHash.Length == apiCertHash.Length) { certMatch = true; // Now assume success. for (int idx = 0; idx < certHash.Length; idx++) { if (certHash[idx] != apiCertHash[idx]) { certMatch = false; // No match break; } } } // Return true => allow unauthenticated server, // false => disallow unauthenticated server. return certMatch; } Once you have the JSON object you're sending to the REST API endpoint, please post it here and we will analyse your request, or send it to support [at] pulseway [dot] com indicating that it's a follow-up per this forum post. Regards, Chris Pulseway Support
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now