Skip to content

Commit a9a3370

Browse files
author
mwatson
committed
New API method
1 parent e427c6a commit a9a3370

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

Src/StackifyLib/API.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,24 @@ public static Models.Device[] GetDeviceList()
3333
}
3434
}
3535

36+
public static bool SetServerEnvironmentForThisDevice(string environmentName)
37+
{
38+
var deviceid = Logger.Identity()?.DeviceID;
39+
40+
if(deviceid == null)
41+
throw new Exception("Unable to evaluate current device id");
42+
43+
return SetServerEnvironmentByID(deviceid.Value, environmentName);
44+
}
45+
46+
public static bool SetServerEnvironmentByID(int id, string environmentName)
47+
{
48+
var response = client.POSTAndGetResponse(System.Web.VirtualPathUtility.AppendTrailingSlash(client.BaseAPIUrl) +
49+
"API/Device/SetServerEnvironmentByID/?id=" + id + "&environmentName=" + environmentName, null);
50+
51+
return response.StatusCode == HttpStatusCode.OK;
52+
}
53+
3654
public static bool RemoveServerByID(int id, bool uninstallAgent = false)
3755
{
3856
var response = client.POSTAndGetResponse(System.Web.VirtualPathUtility.AppendTrailingSlash(client.BaseAPIUrl) +

0 commit comments

Comments
 (0)