-
Notifications
You must be signed in to change notification settings - Fork 406
Expand file tree
/
Copy pathRetrieveAllIPs.java
More file actions
34 lines (29 loc) · 1.11 KB
/
RetrieveAllIPs.java
File metadata and controls
34 lines (29 loc) · 1.11 KB
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
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;
}
}
}