public static DoHttpMethod ( string method, string uri, |
||
method | string | |
uri | string | |
credential | ||
requestText | string | |
readResponse | bool | |
return | string |
public static string GetConfigValue(string uri, string key, NetworkCredential credential) { uri = uri + "?key=" + key; string responseText = HttpUtil.DoHttpMethod("GET", uri, credential, null); return(responseText); }
public static string GetOrInitConfigValue(string napkinServerUri, string devicePath, string key, string defaultValue, NetworkCredential credential) { string uri = napkinServerUri + "/config/" + devicePath + "?key=" + key; string responseText = HttpUtil.DoHttpMethod("GET", uri, credential, null); Debug.Print("GOT " + key + "=" + responseText); if ((responseText == null) || (responseText == "")) { HttpUtil.DoHttpMethod("PUT", uri, credential, defaultValue, false); return(defaultValue); } else { return(responseText); } }
public static void PostConfigNode(string uri, string sub, NetworkCredential credential) { uri = uri + "?sub=" + sub; HttpUtil.DoHttpMethod("POST", uri, credential, null, false); }
public static void PutConfigValue(string uri, string key, string value, NetworkCredential credential) { uri = uri + "?key=" + key; HttpUtil.DoHttpMethod("PUT", uri, credential, value, false); }