All URIs are relative to https://api.dyspatch.io
Method | HTTP request | Description |
---|---|---|
getTemplateById | GET /templates/{templateId} | Get Template by ID |
getTemplates | GET /templates | List Templates |
TemplateRead getTemplateById(templateId, targetLanguage, accept)
Get Template by ID
Gets a template object with the matching ID. If the template has published content the "compiled" field will contain the template .
// Import classes:
import io.dyspatch.client.ApiClient;
import io.dyspatch.client.ApiException;
import io.dyspatch.client.Configuration;
import io.dyspatch.client.auth.*;
import io.dyspatch.client.models.*;
import io.dyspatch.client.api.TemplatesApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.dyspatch.io");
// Configure API key authorization: Bearer
ApiKeyAuth Bearer = (ApiKeyAuth) defaultClient.getAuthentication("Bearer");
Bearer.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//Bearer.setApiKeyPrefix("Token");
TemplatesApi apiInstance = new TemplatesApi(defaultClient);
String templateId = "templateId_example"; // String | A template ID
String targetLanguage = "targetLanguage_example"; // String | The type of templating language to compile as. Should only be used for visual templates.
String accept = "accept_example"; // String | A version of the API that should be used for the request. For example, to use version \"2020.11\", set the value to \"application/vnd.dyspatch.2020.11+json\"
try {
TemplateRead result = apiInstance.getTemplateById(templateId, targetLanguage, accept);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling TemplatesApi#getTemplateById");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
templateId | String | A template ID | |
targetLanguage | String | The type of templating language to compile as. Should only be used for visual templates. | [enum: html, handlebars, ampscript, freemarker, cheetah, jinja, liquid] |
accept | String | A version of the API that should be used for the request. For example, to use version "2020.11", set the value to "application/vnd.dyspatch.2020.11+json" |
- Content-Type: Not defined
- Accept: application/vnd.dyspatch.2020.11+json, /
Status code | Description | Response headers |
---|---|---|
200 | A template object with the requested ID. If the template has no published content the "compiled" field will be null. | * X-RateLimit-Remaining - The number of requests left for the current time window |
400 | Invalid request | * X-RateLimit-Remaining - The number of requests left for the time window. |
401 | Unauthenticated | * X-RateLimit-Remaining - The number of requests left for the time window. |
403 | Unauthorized | * X-RateLimit-Remaining - The number of requests left for the time window. |
404 | Resource not found | * X-RateLimit-Remaining - The number of requests left for the time window. |
429 | Rate limit exceeded | * X-RateLimit-Remaining - The number of requests left for the time window. |
500 | Server error | * X-RateLimit-Remaining - The number of requests left for the time window. |
0 | Server error | * X-RateLimit-Remaining - The number of requests left for the time window. |
TemplatesRead getTemplates(accept, cursor)
List Templates
Gets a list of Template Metadata objects for all templates. Up to 25 results returned before results are paginated.
// Import classes:
import io.dyspatch.client.ApiClient;
import io.dyspatch.client.ApiException;
import io.dyspatch.client.Configuration;
import io.dyspatch.client.auth.*;
import io.dyspatch.client.models.*;
import io.dyspatch.client.api.TemplatesApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.dyspatch.io");
// Configure API key authorization: Bearer
ApiKeyAuth Bearer = (ApiKeyAuth) defaultClient.getAuthentication("Bearer");
Bearer.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//Bearer.setApiKeyPrefix("Token");
TemplatesApi apiInstance = new TemplatesApi(defaultClient);
String accept = "accept_example"; // String | A version of the API that should be used for the request. For example, to use version \"2020.11\", set the value to \"application/vnd.dyspatch.2020.11+json\"
String cursor = "cursor_example"; // String | A cursor value used to retrieve a specific page from a paginated result set.
try {
TemplatesRead result = apiInstance.getTemplates(accept, cursor);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling TemplatesApi#getTemplates");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
accept | String | A version of the API that should be used for the request. For example, to use version "2020.11", set the value to "application/vnd.dyspatch.2020.11+json" | |
cursor | String | A cursor value used to retrieve a specific page from a paginated result set. | [optional] |
- Content-Type: Not defined
- Accept: application/vnd.dyspatch.2020.11+json, /
Status code | Description | Response headers |
---|---|---|
200 | A list of templates | * X-RateLimit-Remaining - The number of requests left for the time window. |
400 | Invalid request | * X-RateLimit-Remaining - The number of requests left for the time window. |
401 | Unauthenticated | * X-RateLimit-Remaining - The number of requests left for the time window. |
403 | Unauthorized | * X-RateLimit-Remaining - The number of requests left for the time window. |
429 | Rate limit exceeded | * X-RateLimit-Remaining - The number of requests left for the time window. |
500 | Server error | * X-RateLimit-Remaining - The number of requests left for the time window. |
0 | Server error | * X-RateLimit-Remaining - The number of requests left for the time window. |