One of the newest functions in the Constellix API is the ability to search for records by specifying any part of the hostname and the record type. There are four types of searches that can be done: 'starts with, 'ends with, 'contains', and 'exact'. All four of these would fall under the category of GET calls. In this tutorial, we will be using Postman to make the API calls. If you are not familiar with Postman or need guidance to get your workspace setup, click here for our Getting Started with Postman tutorial. You will also need the ID# of the domain you want to search through, you can obtain this by following our Search for Domains tutorial.
In the account used in this tutorial, there are 4 A records in thisisanexample.com that will be searched for:
mail2
mail.w2
server.w2
www
Search Records Using 'starts with'
The base URL for this call is:
https://api.dns.constellix.com/v1/domains/<domainId>/records/<recordtype>/search?startswith=
Enter the URL into Postman's address bar. Replace <domainId> with your domain's ID# and replace <recordtype> with the abbreviated name of the record type (a for A record, cname for CNAME record, etc.) Following the = at the end of the URL, enter the first 1+ characters of the hostname.
Because I searched for records starting with "ma", only mail2 and mail.w2 are returned.
Search Records Using 'endswith'
The base URL for this call is:
https://api.dns.constellix.com/v1/domains/<domainId>/records/<recordtype>/search?endswith=
Enter the URL into Postman's address bar. Replace <domainId> with your domain's ID# and replace <recordtype> with the abbreviated name of the record type (a for A record, cname for CNAME record, etc.) Following the = at the end of the URL, enter the last 1+ characters of the hostname.
Because I searched for records ending with "w2", only mail.w2 and server.w2 are returned.
Search Records Using 'contains'
The base URL for this call is:
https://api.dns.constellix.com/v1/domains/<domainId>/records/<recordtype>/search?contains=
Enter the URL into Postman's address bar. Replace <domainId> with your domain's ID# and replace <recordtype> with the abbreviated name of the record type (a for A record, cname for CNAME record, etc.) Following the = at the end of the URL, enter any character or consecutive characters found in the hostname.
Because I searched for records containing "l.w", only mail.w2 is returned.
Search Records Using 'exact'
The base URL for this call is:
https://api.dns.constellix.com/v1/domains/<domainId>/records/<recordtype>/search?exact=
Enter the URL into Postman's address bar. Replace <domainId> with your domain's ID# and replace <recordtype> with the abbreviated name of the record type (a for A record, cname for CNAME record, etc.) Following the = at the end of the URL, enter the full hostname of the record you're looking for.
Because I searched for the record "www", only www is returned.
Common Errors
If you mistyped your search or search for a record that is not in your domain, you will receive a 404 not found error:
If a part of the call is broken or mistyped, you will get a "required parameter is missing error"