-
Notifications
You must be signed in to change notification settings - Fork 4
/
delete_subuser.cs
34 lines (30 loc) · 1.15 KB
/
delete_subuser.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
using System;
using System.IO;
using System.Net;
namespace Smartproxy_API
{
class delete_subuser
{
static void Main(string[] args)
{
// Details from authentication
string userId = "";
string token = "";
int sub_user_id = null; // Recieved from get_subusers.cs
string uri = "https://api.smartproxy.com/v1/users/" + userId + "/sub-users/" + sub_user_id;
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);
request.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate;
request.PreAuthenticate = true;
request.Headers.Add("Authorization", "Token " + token);
request.ContentType = "application/json";
request.Method = "DELETE";
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
using (Stream stream = response.GetResponseStream())
using (StreamReader reader = new StreamReader(stream))
{
Console.WriteLine(reader.ReadToEnd());
Console.ReadKey();
}
}
}
}