-
Notifications
You must be signed in to change notification settings - Fork 71
Domains
Igor Balos edited this page Oct 1, 2018
·
6 revisions
With API client you can easily manage all your account domains. Check out the examples of some of the API requests you can do with the library.
For these API requests you will need to use a account API token. Once you obtain it, you will need to use account API client.
AccountApiClient client = Postmark.getAccountApiClient(<account token>);
// list domains
Domains domains = client.getDomains(Parameters.init().build("count",6).build("offset",0));
System.out.println(domains.getDomains().get(5).getName());
Retrieve single domain details.
// get domain details
Integer domainId = domains.getDomains().get(5).getId();
DomainDetails domainDetails = client.getDomainDetails(domainId);
System.out.println(domainDetails.getDkimPendingHost());
Create a new domain.
// create domain
Domain domain = new Domain();
domain.setName("account.example.com");
DomainDetails domainDetails = client.createDomain(domain);
Integer domainId = domainDetails.getId();
Update existing domain details.
DomainDetails domainDetails = new DomainDetails();
domainDetails.setReturnPathDomain("rp.account.example.com");
// update domain
domainDetails = client.setDomain(domainId, domainDetails);
System.out.println(domainDetails.getReturnPathDomain());
Trigger SPF verification for your domain
// verify spf
String response = client.verifyDomainSPF(domainId);
System.out.println(response);
Trigger DKIM verification for your domain
// verify spf
String response = client.verifyDomainDKIM(domainId);
System.out.println(response);
Trigger Return Path verification for your domain
// verify spf
String response = client.verifyDomainReturnPath(domainId);
System.out.println(response);
Trigger rotation of domain DKIM key.
// rotate dkim
String response = client.rotateDomainDKIM(domainId);
Delete one of existing domains.
// delete domain
String response = client.deleteDomain(domainId);
For additional information about the capabilities of the Postmark API, see Postmark Developers Documentation.
- Email sending
- Test email sending
- Bounces
- Templates
- Templates push
- Server
- Servers
- Message Streams
- Webhooks
- Messages
- Domains
- Sender Signatures
- Stats
- Trigger Tags
- Suppressions
- Data Removals
- Trigger Inbound Rules
- Parsing Inbound
- Using Postmark with Mail library
- Accessing Postmark Message ID
- Error Handling
- Integration Testing
- Troubleshooting
- Known issues and how to resolve them