diff --git a/examples/ips/AddToPool.java b/examples/ips/AddToPool.java new file mode 100644 index 00000000..01e6b16b --- /dev/null +++ b/examples/ips/AddToPool.java @@ -0,0 +1,32 @@ +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; + +import com.sendgrid.*; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + + +////////////////////////////////////////////////////////////////// +// Add an IP address to a pool +// POST /ips/pools/{pool_name}/ips + + +public class AddIPToPool { + public static void main(String[] args) throws IOException { + try { + SendGrid sg = new SendGrid(System.getenv("SENDGRID_API_KEY")); + Request request = new Request(); + request.setMethod(Method.POST); + request.setEndpoint("ips/pools/{pool_name}/ips"); + request.setBody("{\"ip\":\"0.0.0.0\"}"); + Response response = sg.api(request); + System.out.println(response.getStatusCode()); + System.out.println(response.getBody()); + System.out.println(response.getHeaders()); + } catch (IOException ex) { + throw ex; + } + } +} \ No newline at end of file diff --git a/examples/ips/AddToWarmup.java b/examples/ips/AddToWarmup.java new file mode 100644 index 00000000..89ebaad1 --- /dev/null +++ b/examples/ips/AddToWarmup.java @@ -0,0 +1,33 @@ +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; + +import com.sendgrid.*; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + + + +////////////////////////////////////////////////////////////////// +// Add an IP to warmup +// POST /ips/warmup + + +public class AddIPToWarmup { + public static void main(String[] args) throws IOException { + try { + SendGrid sg = new SendGrid(System.getenv("SENDGRID_API_KEY")); + Request request = new Request(); + request.setMethod(Method.POST); + request.setEndpoint("ips/warmup"); + request.setBody("{\"ip\":\"0.0.0.0\"}"); + Response response = sg.api(request); + System.out.println(response.getStatusCode()); + System.out.println(response.getBody()); + System.out.println(response.getHeaders()); + } catch (IOException ex) { + throw ex; + } + } +} \ No newline at end of file diff --git a/examples/ips/CreatePool.java b/examples/ips/CreatePool.java new file mode 100644 index 00000000..c91d82f0 --- /dev/null +++ b/examples/ips/CreatePool.java @@ -0,0 +1,32 @@ +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; + +import com.sendgrid.*; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + + +////////////////////////////////////////////////////////////////// +// Create an IP pool. +// POST /ips/pools + + +public class CreateIPPool { + public static void main(String[] args) throws IOException { + try { + SendGrid sg = new SendGrid(System.getenv("SENDGRID_API_KEY")); + Request request = new Request(); + request.setMethod(Method.POST); + request.setEndpoint("ips/pools"); + request.setBody("{\"name\":\"marketing\"}"); + Response response = sg.api(request); + System.out.println(response.getStatusCode()); + System.out.println(response.getBody()); + System.out.println(response.getHeaders()); + } catch (IOException ex) { + throw ex; + } + } +} \ No newline at end of file diff --git a/examples/ips/DeletePool.java b/examples/ips/DeletePool.java new file mode 100644 index 00000000..51c50249 --- /dev/null +++ b/examples/ips/DeletePool.java @@ -0,0 +1,31 @@ +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; + +import com.sendgrid.*; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + + +////////////////////////////////////////////////////////////////// +// Delete an IP pool. +// DELETE /ips/pools/{pool_name} + + +public class DeletePool { + public static void main(String[] args) throws IOException { + try { + SendGrid sg = new SendGrid(System.getenv("SENDGRID_API_KEY")); + Request request = new Request(); + request.setMethod(Method.DELETE); + request.setEndpoint("ips/pools/{pool_name}"); + Response response = sg.api(request); + System.out.println(response.getStatusCode()); + System.out.println(response.getBody()); + System.out.println(response.getHeaders()); + } catch (IOException ex) { + throw ex; + } + } +} \ No newline at end of file diff --git a/examples/ips/README.md b/examples/ips/README.md new file mode 100644 index 00000000..7ded4310 --- /dev/null +++ b/examples/ips/README.md @@ -0,0 +1,18 @@ +![SendGrid Logo](https://uiux.s3.amazonaws.com/2016-logos/email-logo%402x.png) + +This folder contains various examples on using the IPs endpoint of SendGrid with Java: + +* [Retrieve all IP addresses (GET /ips)](RetrieveAllIPs.java) +* [Retrieve all assigned IPs (GET /ips/assigned)](RetrieveAssignedIPs.java) +* [Create an IP pool (POST /ips/pools)](CreatePool.java) +* [Retrieve all IP pools (GET /ips/pools)](RetrieveAllPools.java) +* [Update an IP pools name (PUT /ips/pools/{pool_name})](UpdatePoolName.java) +* [Retrieve all IPs in a specified pool (GET /ips/pools/{pool_name})](RetrieveIPsInPool.java) +* [Delete an IP pool. (DELETE /ips/pools/{pool_name})](DeletePool.java) +* [Add an IP address to a pool (POST /ips/pools/{pool_name}/ips)](AddToPool.java) +* [Remove an IP address from a pool (DELETE /ips/pools/{pool_name}/ips/{ip}](RemoveFromPool.java) +* [Add an IP to warmup (POST /ips/warmup)](AddToWarmup.java) +* [Retrieve all IPs currently in warmup (GET /ips/warmup)](RetrieveIPsInWarmup.java) +* [Retrieve warmup status for a specific IP address (GET /ips/warmup/{ip_address})](RetrieveWarmupStatus.java) +* [Remove an IP from warmup (DELETE /ips/warmup/{ip_address})](RemoveFromWarmup.java) +* [Retrieve all IP pools an IP address belongs to (GET /ips/{ip_address})](RetrievePoolsForIP.java) \ No newline at end of file diff --git a/examples/ips/RemoveFromPool.java b/examples/ips/RemoveFromPool.java new file mode 100644 index 00000000..ceb5f2be --- /dev/null +++ b/examples/ips/RemoveFromPool.java @@ -0,0 +1,31 @@ +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; + + + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + + +////////////////////////////////////////////////////////////////// +// Remove an IP address from a pool. +// DELETE /ips/pools/{pool_name}/ips/{ip} + + +public class RemoveIPFromPool { + public static void main(String[] args) throws IOException { + try { + SendGrid sg = new SendGrid(System.getenv("SENDGRID_API_KEY")); + Request request = new Request(); + request.setMethod(Method.DELETE); + request.setEndpoint("ips/pools/{pool_name}/ips/{ip}"); + Response response = sg.api(request); + System.out.println(response.getStatusCode()); + System.out.println(response.getBody()); + System.out.println(response.getHeaders()); + } catch (IOException ex) { + throw ex; + } + } +} \ No newline at end of file diff --git a/examples/ips/RemoveFromWarmup.java b/examples/ips/RemoveFromWarmup.java new file mode 100644 index 00000000..b99229de --- /dev/null +++ b/examples/ips/RemoveFromWarmup.java @@ -0,0 +1,32 @@ +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; + +import com.sendgrid.*; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + + + +////////////////////////////////////////////////////////////////// +// Remove an IP from warmup +// DELETE /ips/warmup/{ip_address} + + +public class RemoveFromWarmup { + public static void main(String[] args) throws IOException { + try { + SendGrid sg = new SendGrid(System.getenv("SENDGRID_API_KEY")); + Request request = new Request(); + request.setMethod(Method.DELETE); + request.setEndpoint("ips/warmup/{ip_address}"); + Response response = sg.api(request); + System.out.println(response.getStatusCode()); + System.out.println(response.getBody()); + System.out.println(response.getHeaders()); + } catch (IOException ex) { + throw ex; + } + } +} \ No newline at end of file diff --git a/examples/ips/RetrieveAllIPs.java b/examples/ips/RetrieveAllIPs.java new file mode 100644 index 00000000..14845939 --- /dev/null +++ b/examples/ips/RetrieveAllIPs.java @@ -0,0 +1,34 @@ +import com.sendgrid.Method; +import com.sendgrid.Request; +import com.sendgrid.Response; +import com.sendgrid.SendGrid; + +import java.io.IOException; + + +////////////////////////////////////////////////////////////////// +// Retrieve all IP addresses +// GET /ips + + +public class RetrieveAllIPs { + public static void main(String[] args) throws IOException { + try { + SendGrid sg = new SendGrid(System.getenv("SENDGRID_API_KEY")); + Request request = new Request(); + request.setMethod(Method.GET); + request.setEndpoint("ips"); + request.addQueryParam("subuser", "test_string"); + request.addQueryParam("ip", "test_string"); + request.addQueryParam("limit", "1"); + request.addQueryParam("exclude_whitelabels", "true"); + request.addQueryParam("offset", "1"); + Response response = sg.api(request); + System.out.println(response.getStatusCode()); + System.out.println(response.getBody()); + System.out.println(response.getHeaders()); + } catch (IOException ex) { + throw ex; + } + } +} \ No newline at end of file diff --git a/examples/ips/RetrieveAllPools.java b/examples/ips/RetrieveAllPools.java new file mode 100644 index 00000000..a4362ce0 --- /dev/null +++ b/examples/ips/RetrieveAllPools.java @@ -0,0 +1,30 @@ +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; + +import com.sendgrid.*; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + + +////////////////////////////////////////////////////////////////// +// Retrieve all IP pools. +// GET /ips/pools + + +public class RetieveAllIPPools { + public static void main(String[] args) throws IOException { + try { + SendGrid sg = new SendGrid(System.getenv("SENDGRID_API_KEY")); + Request request = new Request(); + request.setMethod(Method.GET); + request.setEndpoint("ips/pools"); + Response response = sg.api(request); + System.out.println(response.getStatusCode()); + System.out.println(response.getBody()); + System.out.println(response.getHeaders()); + } catch (IOException ex) { + throw ex; + } + } \ No newline at end of file diff --git a/examples/ips/RetrieveAssignedIPs.java b/examples/ips/RetrieveAssignedIPs.java new file mode 100644 index 00000000..968834cc --- /dev/null +++ b/examples/ips/RetrieveAssignedIPs.java @@ -0,0 +1,31 @@ +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; + +import com.sendgrid.*; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + + +////////////////////////////////////////////////////////////////// +// Retrieve all assigned IPs +// GET /ips/assigned + + +public class RetrieveAllAssignedIPs { + public static void main(String[] args) throws IOException { + try { + SendGrid sg = new SendGrid(System.getenv("SENDGRID_API_KEY")); + Request request = new Request(); + request.setMethod(Method.GET); + request.setEndpoint("ips/assigned"); + Response response = sg.api(request); + System.out.println(response.getStatusCode()); + System.out.println(response.getBody()); + System.out.println(response.getHeaders()); + } catch (IOException ex) { + throw ex; + } + } +} \ No newline at end of file diff --git a/examples/ips/RetrieveIPsInPool.java b/examples/ips/RetrieveIPsInPool.java new file mode 100644 index 00000000..72330c3f --- /dev/null +++ b/examples/ips/RetrieveIPsInPool.java @@ -0,0 +1,31 @@ +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; + +import com.sendgrid.*; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + + +////////////////////////////////////////////////////////////////// +// Retrieve all IPs in a specified pool. +// GET /ips/pools/{pool_name} + + +public class RetrieveIPsInPool { + public static void main(String[] args) throws IOException { + try { + SendGrid sg = new SendGrid(System.getenv("SENDGRID_API_KEY")); + Request request = new Request(); + request.setMethod(Method.GET); + request.setEndpoint("ips/pools/{pool_name}"); + Response response = sg.api(request); + System.out.println(response.getStatusCode()); + System.out.println(response.getBody()); + System.out.println(response.getHeaders()); + } catch (IOException ex) { + throw ex; + } + } +} \ No newline at end of file diff --git a/examples/ips/RetrieveIPsInWarmup.java b/examples/ips/RetrieveIPsInWarmup.java new file mode 100644 index 00000000..3767656b --- /dev/null +++ b/examples/ips/RetrieveIPsInWarmup.java @@ -0,0 +1,32 @@ +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; + +import com.sendgrid.*; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + + + +////////////////////////////////////////////////////////////////// +// Retrieve all IPs currently in warmup +// GET /ips/warmup + + +public class RetrieveIPsInWarmup { + public static void main(String[] args) throws IOException { + try { + SendGrid sg = new SendGrid(System.getenv("SENDGRID_API_KEY")); + Request request = new Request(); + request.setMethod(Method.GET); + request.setEndpoint("ips/warmup"); + Response response = sg.api(request); + System.out.println(response.getStatusCode()); + System.out.println(response.getBody()); + System.out.println(response.getHeaders()); + } catch (IOException ex) { + throw ex; + } + } +} \ No newline at end of file diff --git a/examples/ips/RetrievePoolsForIP.java b/examples/ips/RetrievePoolsForIP.java new file mode 100644 index 00000000..8f19b7a7 --- /dev/null +++ b/examples/ips/RetrievePoolsForIP.java @@ -0,0 +1,33 @@ +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; + +import com.sendgrid.*; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + + + +////////////////////////////////////////////////////////////////// +// Retrieve all IP pools an IP address belongs to +// GET /ips/{ip_address} + + +public class RetrieveAllPoolsForIP { + public static void main(String[] args) throws IOException { + try { + SendGrid sg = new SendGrid(System.getenv("SENDGRID_API_KEY")); + Request request = new Request(); + request.setMethod(Method.GET); + request.setEndpoint("ips/{ip_address}"); + Response response = sg.api(request); + System.out.println(response.getStatusCode()); + System.out.println(response.getBody()); + System.out.println(response.getHeaders()); + } catch (IOException ex) { + throw ex; + } + } +} + diff --git a/examples/ips/RetrieveWarmupStatus.java b/examples/ips/RetrieveWarmupStatus.java new file mode 100644 index 00000000..5d315b8f --- /dev/null +++ b/examples/ips/RetrieveWarmupStatus.java @@ -0,0 +1,32 @@ +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; + +import com.sendgrid.*; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + + + +////////////////////////////////////////////////////////////////// +// Retrieve warmup status for a specific IP address +// GET /ips/warmup/{ip_address} + + +public class RetrieveIPsWarmupStatus { + public static void main(String[] args) throws IOException { + try { + SendGrid sg = new SendGrid(System.getenv("SENDGRID_API_KEY")); + Request request = new Request(); + request.setMethod(Method.GET); + request.setEndpoint("ips/warmup/{ip_address}"); + Response response = sg.api(request); + System.out.println(response.getStatusCode()); + System.out.println(response.getBody()); + System.out.println(response.getHeaders()); + } catch (IOException ex) { + throw ex; + } + } +} \ No newline at end of file diff --git a/examples/ips/UpdatePoolName.java b/examples/ips/UpdatePoolName.java new file mode 100644 index 00000000..4e9c2a26 --- /dev/null +++ b/examples/ips/UpdatePoolName.java @@ -0,0 +1,32 @@ +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; + +import com.sendgrid.*; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + + +////////////////////////////////////////////////////////////////// +// Update an IP pools name. +// PUT /ips/pools/{pool_name} + + +public class UpdateIPPoolName { + public static void main(String[] args) throws IOException { + try { + SendGrid sg = new SendGrid(System.getenv("SENDGRID_API_KEY")); + Request request = new Request(); + request.setMethod(Method.PUT); + request.setEndpoint("ips/pools/{pool_name}"); + request.setBody("{\"name\":\"new_pool_name\"}"); + Response response = sg.api(request); + System.out.println(response.getStatusCode()); + System.out.println(response.getBody()); + System.out.println(response.getHeaders()); + } catch (IOException ex) { + throw ex; + } + } +} \ No newline at end of file diff --git a/examples/ips/ips.java b/examples/ips/ips.java deleted file mode 100644 index 55c97644..00000000 --- a/examples/ips/ips.java +++ /dev/null @@ -1,326 +0,0 @@ -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; - -import com.sendgrid.*; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; - -////////////////////////////////////////////////////////////////// -// Retrieve all IP addresses -// GET /ips - - -public class Example { - public static void main(String[] args) throws IOException { - try { - SendGrid sg = new SendGrid(System.getenv("SENDGRID_API_KEY")); - Request request = new Request(); - request.setMethod(Method.GET); - request.setEndpoint("ips"); - request.addQueryParam("subuser", "test_string"); - request.addQueryParam("ip", "test_string"); - request.addQueryParam("limit", "1"); - request.addQueryParam("exclude_whitelabels", "true"); - request.addQueryParam("offset", "1"); - Response response = sg.api(request); - System.out.println(response.getStatusCode()); - System.out.println(response.getBody()); - System.out.println(response.getHeaders()); - } catch (IOException ex) { - throw ex; - } - } -} - -////////////////////////////////////////////////////////////////// -// Retrieve all assigned IPs -// GET /ips/assigned - - -public class Example { - public static void main(String[] args) throws IOException { - try { - SendGrid sg = new SendGrid(System.getenv("SENDGRID_API_KEY")); - Request request = new Request(); - request.setMethod(Method.GET); - request.setEndpoint("ips/assigned"); - Response response = sg.api(request); - System.out.println(response.getStatusCode()); - System.out.println(response.getBody()); - System.out.println(response.getHeaders()); - } catch (IOException ex) { - throw ex; - } - } -} - -////////////////////////////////////////////////////////////////// -// Create an IP pool. -// POST /ips/pools - - -public class Example { - public static void main(String[] args) throws IOException { - try { - SendGrid sg = new SendGrid(System.getenv("SENDGRID_API_KEY")); - Request request = new Request(); - request.setMethod(Method.POST); - request.setEndpoint("ips/pools"); - request.setBody("{\"name\":\"marketing\"}"); - Response response = sg.api(request); - System.out.println(response.getStatusCode()); - System.out.println(response.getBody()); - System.out.println(response.getHeaders()); - } catch (IOException ex) { - throw ex; - } - } -} - -////////////////////////////////////////////////////////////////// -// Retrieve all IP pools. -// GET /ips/pools - - -public class Example { - public static void main(String[] args) throws IOException { - try { - SendGrid sg = new SendGrid(System.getenv("SENDGRID_API_KEY")); - Request request = new Request(); - request.setMethod(Method.GET); - request.setEndpoint("ips/pools"); - Response response = sg.api(request); - System.out.println(response.getStatusCode()); - System.out.println(response.getBody()); - System.out.println(response.getHeaders()); - } catch (IOException ex) { - throw ex; - } - } -} - -////////////////////////////////////////////////////////////////// -// Update an IP pools name. -// PUT /ips/pools/{pool_name} - - -public class Example { - public static void main(String[] args) throws IOException { - try { - SendGrid sg = new SendGrid(System.getenv("SENDGRID_API_KEY")); - Request request = new Request(); - request.setMethod(Method.PUT); - request.setEndpoint("ips/pools/{pool_name}"); - request.setBody("{\"name\":\"new_pool_name\"}"); - Response response = sg.api(request); - System.out.println(response.getStatusCode()); - System.out.println(response.getBody()); - System.out.println(response.getHeaders()); - } catch (IOException ex) { - throw ex; - } - } -} - -////////////////////////////////////////////////////////////////// -// Retrieve all IPs in a specified pool. -// GET /ips/pools/{pool_name} - - -public class Example { - public static void main(String[] args) throws IOException { - try { - SendGrid sg = new SendGrid(System.getenv("SENDGRID_API_KEY")); - Request request = new Request(); - request.setMethod(Method.GET); - request.setEndpoint("ips/pools/{pool_name}"); - Response response = sg.api(request); - System.out.println(response.getStatusCode()); - System.out.println(response.getBody()); - System.out.println(response.getHeaders()); - } catch (IOException ex) { - throw ex; - } - } -} - -////////////////////////////////////////////////////////////////// -// Delete an IP pool. -// DELETE /ips/pools/{pool_name} - - -public class Example { - public static void main(String[] args) throws IOException { - try { - SendGrid sg = new SendGrid(System.getenv("SENDGRID_API_KEY")); - Request request = new Request(); - request.setMethod(Method.DELETE); - request.setEndpoint("ips/pools/{pool_name}"); - Response response = sg.api(request); - System.out.println(response.getStatusCode()); - System.out.println(response.getBody()); - System.out.println(response.getHeaders()); - } catch (IOException ex) { - throw ex; - } - } -} - -////////////////////////////////////////////////////////////////// -// Add an IP address to a pool -// POST /ips/pools/{pool_name}/ips - - -public class Example { - public static void main(String[] args) throws IOException { - try { - SendGrid sg = new SendGrid(System.getenv("SENDGRID_API_KEY")); - Request request = new Request(); - request.setMethod(Method.POST); - request.setEndpoint("ips/pools/{pool_name}/ips"); - request.setBody("{\"ip\":\"0.0.0.0\"}"); - Response response = sg.api(request); - System.out.println(response.getStatusCode()); - System.out.println(response.getBody()); - System.out.println(response.getHeaders()); - } catch (IOException ex) { - throw ex; - } - } -} - -////////////////////////////////////////////////////////////////// -// Remove an IP address from a pool. -// DELETE /ips/pools/{pool_name}/ips/{ip} - - -public class Example { - public static void main(String[] args) throws IOException { - try { - SendGrid sg = new SendGrid(System.getenv("SENDGRID_API_KEY")); - Request request = new Request(); - request.setMethod(Method.DELETE); - request.setEndpoint("ips/pools/{pool_name}/ips/{ip}"); - Response response = sg.api(request); - System.out.println(response.getStatusCode()); - System.out.println(response.getBody()); - System.out.println(response.getHeaders()); - } catch (IOException ex) { - throw ex; - } - } -} - -////////////////////////////////////////////////////////////////// -// Add an IP to warmup -// POST /ips/warmup - - -public class Example { - public static void main(String[] args) throws IOException { - try { - SendGrid sg = new SendGrid(System.getenv("SENDGRID_API_KEY")); - Request request = new Request(); - request.setMethod(Method.POST); - request.setEndpoint("ips/warmup"); - request.setBody("{\"ip\":\"0.0.0.0\"}"); - Response response = sg.api(request); - System.out.println(response.getStatusCode()); - System.out.println(response.getBody()); - System.out.println(response.getHeaders()); - } catch (IOException ex) { - throw ex; - } - } -} - -////////////////////////////////////////////////////////////////// -// Retrieve all IPs currently in warmup -// GET /ips/warmup - - -public class Example { - public static void main(String[] args) throws IOException { - try { - SendGrid sg = new SendGrid(System.getenv("SENDGRID_API_KEY")); - Request request = new Request(); - request.setMethod(Method.GET); - request.setEndpoint("ips/warmup"); - Response response = sg.api(request); - System.out.println(response.getStatusCode()); - System.out.println(response.getBody()); - System.out.println(response.getHeaders()); - } catch (IOException ex) { - throw ex; - } - } -} - -////////////////////////////////////////////////////////////////// -// Retrieve warmup status for a specific IP address -// GET /ips/warmup/{ip_address} - - -public class Example { - public static void main(String[] args) throws IOException { - try { - SendGrid sg = new SendGrid(System.getenv("SENDGRID_API_KEY")); - Request request = new Request(); - request.setMethod(Method.GET); - request.setEndpoint("ips/warmup/{ip_address}"); - Response response = sg.api(request); - System.out.println(response.getStatusCode()); - System.out.println(response.getBody()); - System.out.println(response.getHeaders()); - } catch (IOException ex) { - throw ex; - } - } -} - -////////////////////////////////////////////////////////////////// -// Remove an IP from warmup -// DELETE /ips/warmup/{ip_address} - - -public class Example { - public static void main(String[] args) throws IOException { - try { - SendGrid sg = new SendGrid(System.getenv("SENDGRID_API_KEY")); - Request request = new Request(); - request.setMethod(Method.DELETE); - request.setEndpoint("ips/warmup/{ip_address}"); - Response response = sg.api(request); - System.out.println(response.getStatusCode()); - System.out.println(response.getBody()); - System.out.println(response.getHeaders()); - } catch (IOException ex) { - throw ex; - } - } -} - -////////////////////////////////////////////////////////////////// -// Retrieve all IP pools an IP address belongs to -// GET /ips/{ip_address} - - -public class Example { - public static void main(String[] args) throws IOException { - try { - SendGrid sg = new SendGrid(System.getenv("SENDGRID_API_KEY")); - Request request = new Request(); - request.setMethod(Method.GET); - request.setEndpoint("ips/{ip_address}"); - Response response = sg.api(request); - System.out.println(response.getStatusCode()); - System.out.println(response.getBody()); - System.out.println(response.getHeaders()); - } catch (IOException ex) { - throw ex; - } - } -} -