NAV

List(Last Updated : 01/04/2017)

A distribution list enables you to create a specific group of subscriptions. The list can then be used for targeted messaging or marketing campaigns, which means you are reaching only the most relevant subscribers.

Methods

PUT /rest/v1/{user_name}/list
GET /rest/v1/{user_name}/list
GET /rest/v1/{user_name}/list/{list_id}
POST /rest/v1/{user_name}/list/{list_id}
DELETE /rest/v1/{user_name}/list/{list_id}

PUT List

Create a distribution list by setting details such as list name, display name, frequency, and a description of the list. Upon submitting your request, the request ID and list ID will be returned so that you can track the request. After your request has been completely processed, a PUSH Notification will be sent to you indicating the success or failure of the request.

Once a distribution list is created, you can then add subscriptions to it by using the PUT Subscription request.

Resource Information

Response Formats JSON
Allowed Methods PUT
URL http://api.trumpia.com/rest/v1/{user_name}/list
{user_name} Your account username (this can be found in the Account Settings page after logging in.)

Header Parameters

* required parameters
Parameter Description
Content-Type * application/json
X-Apikey * Your API key (This can be found in the API Settings page after logging in.)

Example value: 123456789abc1011

Body Parameters

* required parameters
Parameter Description
list_name * The name of the distribution list.

Example value: GeneralList
display_name * The display name will be the name that your subscribers will see when signing up for your distribution list. As this name is public, make sure it makes sense to your future subscribers. There is a 50-character limit.

Example value: GeneralList
frequency * The frequency of messages your subscribers receive each month must be disclosed, according to mobile industry regulations. The maximum value is 999.

Example value: 4
description * The description of what types of messages your subscribers will receive when they opt in to this list must be disclosed. There is a 20-character limit.

Example value: promo alerts

Code sample for PUT List

"Request Example:
PUT http://api.trumpia.com/rest/v1/{user_name}/list"
{
  "list_name" : "listname0001",
  "display_name" : "display name",
  "frequency" : "2",
  "description" : "test list"
}

"Response Example:"
{
  "request_id" : "1234561234567asdf123",
  "list_id" : "987987987980"
}


<?
    //PUT List - Create a distribution list.
    include "request_rest.php";

    $request_url = "http://api.trumpia.com/rest/v1/{user_name}/list";

    $request_data = array(
        "list_name" => "listname0001",
        "display_name" => "testlist",
        "frequency" => "2",
        "description" => "test description"
    );

    $request_rest = new RestRequest();

    $request_rest->setRequestURL($request_url);
    $request_rest->setAPIKey("{api_key}");
    $request_rest->setRequestBody(json_encode($request_data));
    $request_rest->setMethod("PUT");
    $result = $request_rest->execute();

    $response_status = $result[0];
    $json_response_data = $result[1];

    if ($response_status == "200") {    //success
        $response_data = json_decode($json_response_data);
        echo "request_id : " . $response_data->request_id . "<br>";
        echo "list_id : " . $response_data->list_id;
    } else {
        echo $response_status ." - connection failure";
    }
?>


//PUT List - Create a distribution list.
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="org.json.simple.JSONArray" %>
<%@ page import="org.json.simple.JSONObject" %>
<%@ page import="java.io.BufferedReader" %>
<%@ page import="java.io.IOException" %>
<%@ page import="java.io.InputStreamReader" %>
<%@ page import="java.io.OutputStream" %>
<%@ page import="java.io.OutputStreamWriter" %>
<%@ page import="java.io.Writer" %>
<%@ page import="java.net.HttpURLConnection" %>
<%@ page import="java.net.URL" %>
<html>
<title>List Put Sample Code</title>
<body>

<%
    String username = "username";
    String listName = "listname0001";
    String displayName = "test display name";
    String frequency = "2";
    String description = "test description";

    JSONObject listPut = new JSONObject();
    listPut.put("list_name", listName);
    listPut.put("display_name", displayName);
    listPut.put("frequency", frequency);
    listPut.put("description", description);

    String urlStr = "http://api.trumpia.com/rest/v1/" + username + "/list";
    URL url = new URL(urlStr);
    HttpURLConnection conn = (HttpURLConnection) url.openConnection();
    conn.setRequestMethod("PUT");
    conn.setDoOutput(true);
    conn.setDoInput(true);
    conn.setUseCaches(false);
    conn.setAllowUserInteraction(false);
    conn.setRequestProperty("Content-type", "application/json");
    conn.setRequestProperty("X-Apikey", "12345aaaaa67890aaaaa");
    OutputStream outPutStream = conn.getOutputStream();
    Writer writer = new OutputStreamWriter(outPutStream, "UTF-8");
    writer.write(listPut.toJSONString());
    writer.close();
    outPutStream.close();

    if (conn.getResponseCode() != 200) {
%>
    Error : <%=conn.getResponseMessage()%>
<%
    }else{
    // Buffer the result into a string
    BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
    StringBuilder sb = new StringBuilder();
    String line;
    while ((line = rd.readLine()) != null) {
        sb.append(line);
    }
    rd.close();
    conn.disconnect();
%>
    Response : <%=sb.toString()%>
<%
    }
%>
</body>
</html>


//PUT List - Create a distribution list.
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;

namespace samplecode
{
    class ListInfo
    {
        public string list_name { get; set; }
        public string display_name { get; set; }
        public string frequency { get; set; }
        public string description { get; set; }
    }
    class Result
    {
        public string request_id { get; set; }
        public string list_id { get; set; }
    }
    class ListPut
    {
        static void Main()
        {
          RunAsync().Wait();
        }

        static async Task RunAsync()
        {
            using (var client = new HttpClient())
            {
                var apikey = "12345aaaaa67890aaaaa";

                client.DefaultRequestHeaders.Accept.Clear();
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                client.DefaultRequestHeaders.Add("X-Apikey", string.Format("{0}", apikey));

                var username = "username";
                //PUT
                var list = new ListInfo() { list_name = "listname0001", display_name = "display name", frequency = "2", description = "test list" };
                Uri postUrl = new Uri(string.Format("http://api.trumpia.com/rest/v1/{0}/list",username));
                var response = client.PutAsJsonAsync(postUrl, list).Result;
                if(response.IsSuccessStatusCode) {
                    var p = response.Content.ReadAsAsync<Result>().Result;
                    string json = JsonConvert.SerializeObject(p);
                    Console.WriteLine(json);
                }
            }
        }
    }
}

GET List

Look up basic information, like list IDs and names, of existing distribution lists, or look up detailed information from a specific distribution list.

Resource Information

Response Formats JSON
Allowed Methods GET
URL http://api.trumpia.com/rest/v1/{user_name}/list
http://api.trumpia.com/rest/v1/{user_name}/list/{list_id}
{user_name} Your account username (this can be found in the Account Settings page after logging in.)
{list_id} Get information from a specific list using the list_id.

Example value: 12345

Header Parameters

* required parameters
Parameter Description
Content-Type * application/json
X-Apikey * Your API key (This can be found in the API Settings page after logging in.)

Example value: 123456789abc1011

Code sample for GET List

"Request Example (all lists):
GET http://api.trumpia.com/rest/v1/{user_name}/list"

"Response Example:"
{
  "list" :
  [
    {
      "list_id" : "987987987980",
      "list_name" : "listname0001"
    },
    {
      "list_id" : "987987987981",
      "list_name" : "listname0002"
    },
    {
      "list_id" : "987987987982",
      "list_name" : "listname0003"
    }
  ]
}

"Request Example (of a specific list):
GET http://api.trumpia.com/rest/v1/{user_name}/list/{list_id}"

"Response Example:"
{
  "display_name" : "display name",
  "description" : "test list",
  "list_name" : "listname0001",
  "frequency" : "2",
  "subscription_count" : "0",
  "mobile_count" : "0",
  "im_count" : "0",
  "email_count" : "0"
}


<?
    //GET List - Retrieve all distribution lists.
    include "request_rest.php";

    $request_url = "http://api.trumpia.com/rest/v1/{user_name}/list";

    $request_rest = new RestRequest();

    $request_rest->setRequestURL($request_url);
    $request_rest->setAPIKey("{api_key}");
    $request_rest->setMethod("GET");
    $result = $request_rest->execute();

    $response_status = $result[0];
    $json_response_data = $result[1];

    if ($response_status == "200") {    //success
        echo $json_response_data;
    } else {
        echo $response_status ." - connection failure";
    }
?>


<?
    //GET List - Retrieve a distribution list by ID.
    include "request_rest.php";

    $request_url = "http://api.trumpia.com/rest/v1/{user_name}/list";
    $list_id = "987987987980";
    $request_url =  $request_url . "/" . $list_id;

    $request_rest = new RestRequest();

    $request_rest->setRequestURL($request_url);
    $request_rest->setAPIKey("{api_key}");
    $request_rest->setMethod("GET");
    $result = $request_rest->execute();

    $response_status = $result[0];
    $json_response_data = $result[1];

    if ($response_status == "200") {    //success
        echo $json_response_data;
    } else {
        echo $response_status ." - connection failure";
    }
?>



//GET List - Retrieve all distribution lists.
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="org.json.simple.JSONArray" %>
<%@ page import="org.json.simple.JSONObject" %>
<%@ page import="java.io.BufferedReader" %>
<%@ page import="java.io.IOException" %>
<%@ page import="java.io.InputStreamReader" %>
<%@ page import="java.io.OutputStream" %>
<%@ page import="java.io.OutputStreamWriter" %>
<%@ page import="java.io.Writer" %>
<%@ page import="java.net.HttpURLConnection" %>
<%@ page import="java.net.URL" %>
<html>
<title>List Get All Sample Code</title>
<body>

<%
    String username = "username";
    String urlStr = "http://api.trumpia.com/rest/v1/" + username + "/list";

    URL url = new URL(urlStr);
    HttpURLConnection conn = (HttpURLConnection) url.openConnection();
    conn.setRequestProperty("Content-type", "application/json");
    conn.setRequestProperty("X-Apikey", "12345aaaaa67890aaaaa");

    if (conn.getResponseCode() != 200) {
%>
    Error : <%=conn.getResponseMessage()%>
<%
    }else{
    // Buffer the result into a string
    BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
    StringBuilder sb = new StringBuilder();
    String line;
    while ((line = rd.readLine()) != null) {
        sb.append(line);
    }
    rd.close();
    conn.disconnect();
%>
    Response : <%=sb.toString()%>
<%
    }
%>
</body>
</html>


//GET List - Retrieve a distribution list by ID.
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="org.json.simple.JSONArray" %>
<%@ page import="org.json.simple.JSONObject" %>
<%@ page import="java.io.BufferedReader" %>
<%@ page import="java.io.IOException" %>
<%@ page import="java.io.InputStreamReader" %>
<%@ page import="java.io.OutputStream" %>
<%@ page import="java.io.OutputStreamWriter" %>
<%@ page import="java.io.Writer" %>
<%@ page import="java.net.HttpURLConnection" %>
<%@ page import="java.net.URL" %>
<html>
<title>List Get By Id Sample Code</title>
<body>

<%
    String username = "username";
    String listId = "987987987980";
    String urlStr = "http://api.trumpia.com/rest/v1/" + username + "/list/" + listId;

    URL url = new URL(urlStr);
    HttpURLConnection conn = (HttpURLConnection) url.openConnection();
    conn.setRequestProperty("Content-type", "application/json");
    conn.setRequestProperty("X-Apikey", "12345aaaaa67890aaaaa");

    if (conn.getResponseCode() != 200) {
%>
    Error : <%=conn.getResponseMessage()%>
<%
    }else{
    // Buffer the result into a string
    BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
    StringBuilder sb = new StringBuilder();
    String line;
    while ((line = rd.readLine()) != null) {
        sb.append(line);
    }
    rd.close();
    conn.disconnect();
%>
    Response : <%=sb.toString()%>
<%
    }
%>
</body>
</html>


//GET List - Retrieve all distribution lists.
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;

namespace sampleCode
{
    class ListInfo
    {
        public JArray list { get; set; }
    }
    class ListGet
    {
        static void Main(string[] args)
        {
            RunAsync().Wait();
        }

        static async Task RunAsync()
        {
            using (var client = new HttpClient())
            {
                var apikey = "12345aaaaa67890aaaaa";

                client.BaseAddress = new Uri("http://api.trumpia.com");
                client.DefaultRequestHeaders.Accept.Clear();
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                client.DefaultRequestHeaders.Add("X-Apikey", string.Format("{0}", apikey));

                var username = "username";

                //GET
                HttpResponseMessage response = await client.GetAsync(string.Format("/rest/v1/{0}/list",username));
                if (response.IsSuccessStatusCode)
                {
                    ListInfo listInfo = await response.Content.ReadAsAsync<ListInfo>();
                    string json = JsonConvert.SerializeObject(listInfo);
                    Console.WriteLine(json);
                }
            }
        }
    }
}

//GET List - Retrieve a distribution list by ID.
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;

namespace samplecode
{
    class ListInfo
    {
        public string list_name { get; set; }
        public string display_name { get; set; }
        public string frequency { get; set; }
        public string description { get; set; }
        public string subscription_count { get; set; }
        public string mobile_count { get; set; }
        public string email_count { get; set; }
        public string im_count { get; set; }
    }
    class ListDetailGet
    {
        static void Main()
        {
           RunAsync().Wait();
        }

        static async Task RunAsync()
        {
            using (var client = new HttpClient())
            {
                var apikey = "12345aaaaa67890aaaaa";

                client.BaseAddress = new Uri("http://api.trumpia.com");
                client.DefaultRequestHeaders.Accept.Clear();
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                client.DefaultRequestHeaders.Add("X-Apikey", string.Format("{0}", apikey));

                var username = "username";
                var listId = "987987987980";

                //GET
                HttpResponseMessage response = await client.GetAsync(string.Format("/rest/v1/{0}/list/{1}", username, listId));
                if (response.IsSuccessStatusCode)
                {
                    ListInfo listInfo = await response.Content.ReadAsAsync<ListInfo>();
                    string json = JsonConvert.SerializeObject(listInfo);
                    Console.WriteLine(json);
                }
            }
        }
    }
}

POST List

Update the information, including the name, display name, frequency, and description, of a specific distribution list.

Resource Information

Response Formats JSON
Allowed Methods POST
URL http://api.trumpia.com/rest/v1/{user_name}/list/{list_id}
{user_name} Your account username (this can be found in the Account Settings page after logging in.)
{list_id} list_id of list being updated.

Example value: 12345

Header Parameters

* required parameters
Parameter Description
Content-Type * application/json
X-Apikey * Your API key (This can be found in the API Settings page after logging in.)

Example value: 123456789abc1011

Body Parameters

* required parameters
Parameter Description
list_name The name of your distribution list that has been previously created. This is the list to which the subscriber will be added.

Example value: GeneralList
display_name The display name will be the name that your subscribers will see when signing up for your distribution list. As this name is public, make sure it makes sense to your future subscribers. There is a 50-character limit.

Example value: GeneralList
frequency The frequency of messages your subscribers receive each month must be disclosed, according to mobile industry regulations. The maximum value is 999.

Example value: 4
description The description of what types of messages your subscribers will receive when they opt in to this list must be disclosed. There is a 20-character limit.

Example value: promo alerts

Code sample for POST List


"Request Example:
POST http://api.trumpia.com/rest/v1/{user_name}/list/{list_id}"
 {
  "list_name" : "listname0001",
  "display_name" : "display name",
  "frequency" : "2",
  "description" : "test list"
}

"Response Example:"
 {
  "request_id" : "1234561234567asdf123"
}



<?
    //POST List - Update a distribution list.
    include "request_rest.php";

    $request_url = "http://api.trumpia.com/rest/v1/{user_name}/list";
    $list_id = "588889";
    $request_url =  $request_url . "/" . $list_id;

    $request_data = array(
                                "list_name" => "12345",
                                "display_name" => "testlist2",
                                "frequency" => "20",
                                "description" => "test description"
                            );

        $request_rest = new RestRequest();

        $request_rest->setRequestURL($request_url);
        $request_rest->setAPIKey("{api_key}");
        $request_rest->setRequestBody(json_encode($request_data));
        $request_rest->setMethod("POST");
        $result = $request_rest->execute();

        $response_status = $result[0];
        $json_response_data = $result[1];

        if ($response_status == "200") {    //success
            $response_data = json_decode($json_response_data);
            echo "request_id : " . $response_data->request_id . "<br>";
        } else {
            echo $response_status ." - connection failure";
        }
?>


//POST List - Update a distribution list.
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="org.json.simple.JSONArray" %>
<%@ page import="org.json.simple.JSONObject" %>
<%@ page import="java.io.BufferedReader" %>
<%@ page import="java.io.IOException" %>
<%@ page import="java.io.InputStreamReader" %>
<%@ page import="java.io.OutputStream" %>
<%@ page import="java.io.OutputStreamWriter" %>
<%@ page import="java.io.Writer" %>
<%@ page import="java.net.HttpURLConnection" %>
<%@ page import="java.net.URL" %>
<html>
<title>List Post Sample Code</title>
<body>

<%
    String username = "username";
    String listId = "987987987980";

    String listName = "listname0001";
    String displayName = "test display name";
    String frequency = "2";
    String description = "test description";

    JSONObject listPost = new JSONObject();
    listPost.put("list_name", listName);
    listPost.put("display_name", displayName);
    listPost.put("frequency", frequency);
    listPost.put("description", description);

    String urlStr = "http://api.trumpia.com/rest/v1/" + username + "/list/" + listId;
    URL url = new URL(urlStr);
    HttpURLConnection conn = (HttpURLConnection) url.openConnection();
    conn.setRequestMethod("POST");
    conn.setDoOutput(true);
    conn.setDoInput(true);
    conn.setUseCaches(false);
    conn.setAllowUserInteraction(false);
    conn.setRequestProperty("Content-type", "application/json");
    conn.setRequestProperty("X-Apikey", "12345aaaaa67890aaaaa");
    OutputStream outPutStream = conn.getOutputStream();
    Writer writer = new OutputStreamWriter(outPutStream, "UTF-8");
    writer.write(listPost.toJSONString());
    writer.close();
    outPutStream.close();

    if (conn.getResponseCode() != 200) {
%>
    Error : <%=conn.getResponseMessage()%>
<%
    }else{
    // Buffer the result into a string
    BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
    StringBuilder sb = new StringBuilder();
    String line;
    while ((line = rd.readLine()) != null) {
        sb.append(line);
    }
    rd.close();
    conn.disconnect();
%>
    Response : <%=sb.toString()%>
<%
    }
%>
</body>
</html>


//POST List - Update a distribution list.
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;

namespace samplecode
{
    class ListInfo
    {
        public string list_name { get; set; }
        public string display_name { get; set; }
        public string frequency { get; set; }
        public string description { get; set; }
    }
    class Result
    {
        public string request_id { get; set; }
    }
    class ListPost
    {
        static void Main()
        {
            RunAsync().Wait();
        }

        static async Task RunAsync()
        {
            using (var client = new HttpClient())
            {
                var apikey = "12345aaaaa67890aaaaa";

                client.DefaultRequestHeaders.Accept.Clear();
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                client.DefaultRequestHeaders.Add("X-Apikey", string.Format("{0}", apikey));

                var username = "username";
                var listId = "987987987980";
                //POST
                var list = new ListInfo() { list_name = "listname0001", display_name = "display name", frequency = "2", description = "test list" };
                Uri postUrl = new Uri(string.Format("http://api.trumpia.com/rest/v1/{0}/list/{1}", username, listId));
                var response = client.PostAsJsonAsync(postUrl, list).Result;
                if (response.IsSuccessStatusCode)
                {
                    var p = response.Content.ReadAsAsync<Result>().Result;
                    string json = JsonConvert.SerializeObject(p);
                    Console.WriteLine(json);
                }
            }
        }
    }
}

DELETE List

Permanently remove a distribution list.

Resource Information

Response Formats JSON
Allowed Methods DELETE
URL http://api.trumpia.com/rest/v1/{user_name}/list/{list_id}
{user_name} Your account username (this can be found in the Account Settings page after logging in.)
{list_id} list_id of list being deleted.

Example value: 12345

Header Parameters

* required parameters
Parameter Description
Content-Type * application/json
X-Apikey * Your API key (This can be found in the API Settings page after logging in.)

Example value: 123456789abc1011

Code sample for DELETE List

"Request Example:
DELETE http://api.trumpia.com/rest/v1/{user_name}/list/{list_id}"

"Response Example:"
 {
  "request_id" : "1234561234567asdf123"
}



<?
    //list DELETE
    include "request_rest.php";

    $request_url = "http://api.trumpia.com/rest/v1/{user_name}/list";
    $list_id = "987987987980";
    $request_url =  $request_url . "/" . $list_id;

    $request_rest = new RestRequest();

    $request_rest->setRequestURL($request_url);
    $request_rest->setAPIKey("{api_key}");
    $request_rest->setMethod("DELETE");
    $result = $request_rest->execute();

    $response_status = $result[0];
    $json_response_data = $result[1];

    if ($response_status == "200") {    //success
        echo $json_response_data;
    } else {
        echo $response_status ." - connection failure";
    }
?>



//DELETE List - Delete a distribution list.
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="org.json.simple.JSONArray" %>
<%@ page import="org.json.simple.JSONObject" %>
<%@ page import="java.io.BufferedReader" %>
<%@ page import="java.io.IOException" %>
<%@ page import="java.io.InputStreamReader" %>
<%@ page import="java.io.OutputStream" %>
<%@ page import="java.io.OutputStreamWriter" %>
<%@ page import="java.io.Writer" %>
<%@ page import="java.net.HttpURLConnection" %>
<%@ page import="java.net.URL" %>
<html>
<title>List Delete Sample Code</title>
<body>

<%
    String username = "username";
    String listId = "987987987980";
    String urlStr = "http://api.trumpia.com/rest/v1/" + username + "/list/" + listId;
    URL url = new URL(urlStr);
    HttpURLConnection conn = (HttpURLConnection) url.openConnection();
    conn.setRequestMethod("DELETE");
    conn.setDoOutput(true);
    conn.setAllowUserInteraction(false);
    conn.setRequestProperty("Content-type", "application/json");
    conn.setRequestProperty("X-Apikey", "12345aaaaa67890aaaaa");
    if (conn.getResponseCode() != 200) {
%>
    Error : <%=conn.getResponseMessage()%>
<%
    }else{
    // Buffer the result into a string
    BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
    StringBuilder sb = new StringBuilder();
    String line;
    while ((line = rd.readLine()) != null) {
        sb.append(line);
    }
    rd.close();
    conn.disconnect();
%>
    Response : <%=sb.toString()%>
<%
    }
%>
</body>
</html>


//DELETE List - Delete a distribution list.
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;

namespace samplecode
{
    class Result
    {
        public string request_id { get; set; }
    }
    class ListDelete
    {
        static void Main()
        {
            RunAsync().Wait();
        }

        static async Task RunAsync()
        {
            using (var client = new HttpClient())
            {
                var apikey = "12345aaaaa67890aaaaa";

                client.DefaultRequestHeaders.Accept.Clear();
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                client.DefaultRequestHeaders.Add("X-Apikey", string.Format("{0}", apikey));

                var username = "username";
                var listId = "987987987980";
                //DELETE
                Uri deleteUrl = new Uri(string.Format("http://api.trumpia.com/rest/v1/{0}/list/{1}", username, listId));
                var response = client.DeleteAsync(deleteUrl).Result;
                if (response.IsSuccessStatusCode)
                {
                    var p = response.Content.ReadAsAsync<Result>().Result;
                    string json = JsonConvert.SerializeObject(p);
                    Console.WriteLine(json);
                }
            }
        }
    }
}