HomeGuidesRecipesAPI ReferencePython SDK
Alation Help Center
API Reference

Custom Template

Custom Template API

Description

This API allows users to fetch custom-templates.

NOTE: This API is available in version 4.19 and later

Get a custom-template

This API gets a particular custom-template given a unique identifier.

URL

GET /integration/v1/custom_template/**<custom_template_id>**

NOTE: custom_template_id refers to the unique identifier of the desired custom-template.

It returns the following fields:

NameDescription
idUnique identifier of the custom-template
titleTitle of the custom-template
builtin_nameBuiltin-name of the custom-template
fieldsList of custom-fields present in the custom-template

NameDescription
idUnique identifier of the custom-field
field_typeData type of the custom-field
tooltip_textThe text that gets displayed on hovering this custom-field
name_pluralPlural name of the custom-field
name_singularSingular name of the custom-field
backref_nameThe reverse relationship between a custom-field value and the object it's applied to
Example: If 'X' is a steward of Y, backref_name="Steward of"
backref_tooltip_textThe text that gets displayed on hovering the backref_name
allow_multipleBoolean to indicate if multiple values are allowed for this custom-field
allowed_otypesList of allowed types for this custom-field
optionsList of values that a custom-field can take
builtin_nameBuiltin_name of the custom-field

Headers

HTTP HeaderValue
Token<your_token>

Replace <your_token> with API Token which can be obtained from getToken API call (Get API Token).

Success Response

Content-Type: application/json

Status: 200 OK

Body

{
    "builtin_name": "business_glossary",
    "fields": [
        {
            "id": 1001,
            "field_type": "DATE",
            "tooltip_text": "This is the date when policy was approved",
            "name_plural": "Approval date",
            "name_singular": "Approval date",
            "backref_name": null,
            "backref_tooltip_text": null,
            "allow_multiple": false,
            "allowed_otypes": null,
            "options": null,
            "builtin_name": null
        }
    ],
    "id": 19,
    "title": "Business Glossary"
}

Get all custom-templates

This API gets all the custom-templates.

URL

GET /integration/v1/custom_template/?**<params>**

Replace with your list of parameters.

URL Parameters

NameRequiredDescription
titleNoTitle of the custom-template
Example: /integration/v1/custom_template/?title=Business Glossary

Headers

HTTP HeaderValue
Token<your_token>
Content-Typeapplication/json

Replace <your_token> with API Token which can be obtained from getToken API call (Get API Token).

Success Response

Content-Type: application/json

Status: 200 OK

Body

[
    {
        "builtin_name": "custom_template",
        "fields": [
            {
                "id": 10012,
                "field_type": "OBJECT_SET",
                "tooltip_text": "",
                "name_plural": "",
                "name_singular": "reference",
                "backref_name": "reference",
                "backref_tooltip_text": "",
                "allow_multiple": false,
                "allowed_otypes": [
                    "schema",
                    "table",
                    "attribute",
                    "user",
                    "groupprofile",
                    "groupprofile"
                ],
                "options": null,
                "builtin_name": null
            },
            {
                "id": 8,
                "field_type": "OBJECT_SET",
                "tooltip_text": null,
                "name_plural": "Stewards",
                "name_singular": "Steward",
                "backref_name": "Steward",
                "backref_tooltip_text": null,
                "allow_multiple": true,
                "allowed_otypes": [
                    "user",
                    "groupprofile",
                    "groupprofile"
                ],
                "options": null,
                "builtin_name": "steward"
            },
        ],
        "id": 16,
        "title": "Custom template"
    },
    {
        "builtin_name": "new_template",
        "fields": [
            {
                "id": 10011,
                "field_type": "PICKER",
                "tooltip_text": "",
                "name_plural": "",
                "name_singular": "status",
                "backref_name": "",
                "backref_tooltip_text": "",
                "allow_multiple": false,
                "allowed_otypes": null,
                "options": [
                    {
                        "old_index": 0,
                        "article_id": null,
                        "tooltip_text": null,
                        "in_use": true,
                        "title": "Done"
                    }
                ],
                "builtin_name": null
            }
        ],
        "id": 18,
        "title": "New Template"
    }
]

Error Response

Invalid Token

Status: 403 Forbidden

Body

{
   "detail": "Invalid API token."
}

Missing Token Header

Status: 403 Forbidden

Body

{
    "detail": "Missing API token."
}

Code Samples

cURL

#!/bin/bash

# This is an example token. Please replace this with your token.
API_TOKEN="2abcd-4c04-4c21-8692-eda27a877f90"

BASE_URL="https://alation.yourcompany.com/integration/v1/custom_template/"

# Get a custom-template
curl -H "TOKEN: ${API_TOKEN}" "${BASE_URL}/1/"

# Get all the custom-templates
curl -H "TOKEN: ${API_TOKEN}" "${BASE_URL}/"

# Filter custom-template with title
curl -H "TOKEN: ${API_TOKEN}" "${BASE_URL}/?title=Business Glossary"

Python

# This example prints only id and title of a custom-template, to know all the parameters in a response, please refer to the sample responses above
import requests
import json

# This is an example token. Please replace this with your token.
headers = {'Token': '2abcd-4c04-4c21-8692-eda27a877f90'}
BASE_URL = 'https://alation.yourcompany.com/integration/v1/custom_template/'

# Get a custom-template
response = requests.get(BASE_URL + '1/', headers=headers)
custom_template = json.loads(response.text)
print ("ID: %s, Title: %s" % (custom_template['id'], custom_template['title']))

# Get all custom-templates
response = requests.get(BASE_URL, headers=headers)
custom-templates = json.loads(response.text)
for ct in custom-templates:
    print ("ID: %s, Title: %s" % (ct['id'], ct['title']))