Wild Dog Cloud is not much introduced, here is mainly to record the C # call them to provide the rest API, the data post to the Wild Dog cloud storage, directly on the code
Static voidMain (string[] args) { stringstr ="Hello"; /** Note the link here to add. JSON * I was here in the pit for 1 hours. * Always exception: After the bad Request * I am in the Wild Dog cloud application Manually added a user node * and then saved as normal.*/ //appId: Corresponding to your wild Dog cloud appPost ("Https://<appId>.wilddogio.com/user.json","{\ "col1\": \ ""+ DateTime.Now.ToString ("YYYY/MM/DD HH:mm:ss") +"\ ", \" col2\ ": \""+ str +"\"}"); } /// <summary> ///send a POST request/// </summary> /// <param name= "PostURL" >Request Address</param> /// <param name= "Jsonstr" >JSON data</param> /// <returns></returns> Public Static stringPost (stringPostURL,stringjsonstr) { //Set HTTPS authentication mode if(PostURL. StartsWith ("HTTPS", StringComparison.OrdinalIgnoreCase)) {Servicepointmanager.servercertificatevalidationcallback=NewRemotecertificatevalidationcallback (CheckValidationResult); } HttpWebRequest Request=(HttpWebRequest) webrequest.create (PostURL); Request. Method="POST"; Request. ContentType="application/x-www-form-urlencoded"; //JSON string to byte array byte[] bytes =System.Text.Encoding.UTF8.GetBytes (JSONSTR); //set the contentlength of the requestRequest. ContentLength =bytes. Length; //send request, GET request streamStream stream; Try { //gets the stream object used to write the request datastream =request. GetRequestStream (); } Catch(Exception ex) {stream=NULL; Console.WriteLine (ex. Message); } //write data to a streamStream. Write (Bytes,0, Bytes. Length); Stream. Close (); HttpWebResponse response; Try { //get the response streamResponse =(HttpWebResponse) request. GetResponse (); } Catch(WebException ex) {response= ex. Response asHttpWebResponse; } Stream S=Response. GetResponseStream (); StreamReader SR=NewStreamReader (S, Encoding.UTF8); stringStrval =Sr. ReadToEnd (). Trim (); Sr. Close (); S.close (); returnStrval; } Public Static BOOLCheckValidationResult (Objectsender, X509Certificate certificate, X509chain chain, sslpolicyerrors errors) { return true; }
Wild Dog Cloud app Configure a bit of byte point
Post successful return
Write for the first time, just make a record, and also hope to help the people who need help.
C # calls Wild Dog cloud REST API