URIs for the REST API have the following basic structure:
http://[siteURL]/rest/[resourceName]
Where [siteURL] is the domain of your email platform, and [resourceName] is the name of the feature to use. On the SaaS platform, the [siteURL] is: api.whatcounts.net.
Results
The URI allows for the return of a collection of results, or an instance in the format:
- Collection: http://[siteURL]/rest/[resourceName]
- Instance by ID: http://[siteURL]/rest/[resourceName]/[id]
- Instance with Filter: http://[siteURL]/rest/[resourceName]/[fieldName]=[value]
For example:
All Lists in a Realm: http://[siteURL]/rest/lists
Specific List by the List ID: http://[siteURL]/rest/lists/5
Specific List Filtered by the List Name: http://[siteURL]/rest/lists?listName=myList
Response
The Resource returns an HTML Reponse Code along with the representation in the JSON response when feasible. Some REST API resources support Pagination when multiple result sets are found.
The available data depends on the Resource. It includes any field that contains a value, including blank strings. Blank strings appear in double quotes with no data (""). Fields with a NULL value (no data ever set), are not returned in the JSON at all. For example, if the Contact Company field has never been set, the Get Contact response does not include the Company field in the JSON results.
In addition, you can control the amount of data returned in the JSON response by using the body override filter. By default, the Resource returns all available data (_body=true). To return only data with non-blank values, set the override to:
_body=false
For example:
All Lists in a Realm: http://[siteURL]/rest/lists?_body=false
Specific List by the List ID: http://[siteURL]/rest/lists/5?_body=false
Specific List Filtered by the List Name: http://[siteURL]/rest/lists?listName=myList&_body=false