Skip to content

Latest commit

 

History

History
183 lines (141 loc) · 8.08 KB

TemplatesApi.md

File metadata and controls

183 lines (141 loc) · 8.08 KB

dyspatch_client.TemplatesApi

All URIs are relative to https://api.dyspatch.io

Method HTTP request Description
get_template_by_id GET /templates/{templateId} Get Template by ID
get_templates GET /templates List Templates

get_template_by_id

TemplateRead get_template_by_id(template_id, target_language, 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 .

Example

  • Api Key Authentication (Bearer):
from __future__ import print_function
import time
import dyspatch_client
from dyspatch_client.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://api.dyspatch.io
# See configuration.py for a list of all supported configuration parameters.
configuration = dyspatch_client.Configuration(
    host = "https://api.dyspatch.io"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: Bearer
configuration = dyspatch_client.Configuration(
    host = "https://api.dyspatch.io",
    api_key = {
        'Authorization': 'YOUR_API_KEY'
    }
)
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Authorization'] = 'Bearer'

# Enter a context with an instance of the API client
with dyspatch_client.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = dyspatch_client.TemplatesApi(api_client)
    template_id = 'template_id_example' # str | A template ID
target_language = 'target_language_example' # str | The type of templating language to compile as. Should only be used for visual templates.
accept = 'accept_example' # str | 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:
        # Get Template by ID
        api_response = api_instance.get_template_by_id(template_id, target_language, accept)
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling TemplatesApi->get_template_by_id: %s\n" % e)

Parameters

Name Type Description Notes
template_id str A template ID
target_language str The type of templating language to compile as. Should only be used for visual templates.
accept str 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"

Return type

TemplateRead

Authorization

Bearer

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/vnd.dyspatch.2020.11+json, /

HTTP response details

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.

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_templates

TemplatesRead get_templates(accept, cursor=cursor)

List Templates

Gets a list of Template Metadata objects for all templates. Up to 25 results returned before results are paginated.

Example

  • Api Key Authentication (Bearer):
from __future__ import print_function
import time
import dyspatch_client
from dyspatch_client.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://api.dyspatch.io
# See configuration.py for a list of all supported configuration parameters.
configuration = dyspatch_client.Configuration(
    host = "https://api.dyspatch.io"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: Bearer
configuration = dyspatch_client.Configuration(
    host = "https://api.dyspatch.io",
    api_key = {
        'Authorization': 'YOUR_API_KEY'
    }
)
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Authorization'] = 'Bearer'

# Enter a context with an instance of the API client
with dyspatch_client.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = dyspatch_client.TemplatesApi(api_client)
    accept = 'accept_example' # str | 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 = 'cursor_example' # str | A cursor value used to retrieve a specific page from a paginated result set. (optional)

    try:
        # List Templates
        api_response = api_instance.get_templates(accept, cursor=cursor)
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling TemplatesApi->get_templates: %s\n" % e)

Parameters

Name Type Description Notes
accept str 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 str A cursor value used to retrieve a specific page from a paginated result set. [optional]

Return type

TemplatesRead

Authorization

Bearer

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/vnd.dyspatch.2020.11+json, /

HTTP response details

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.

[Back to top] [Back to API list] [Back to Model list] [Back to README]