Skip to content

k-script

To display data populated by an external API

Note: The API should return data in the form of an array of objects. For example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
[
    {
        "name": "Segment",
        "domain": "segment.com",
        "logo": "https://logo.clearbit.com/segment.com"
    },
    {
        "name": "Segmentify",
        "domain": "segmentify.com",
        "logo": "https://logo.clearbit.com/segmentify.com"
    }
]

'GET' API without any headers

Code example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
<k-script get-api="http://autocomplete.clearbit.com/v1/companies/suggest?query=Segment">
    <div k-repeat="System.Exception: No matching Action found for the expression.
   at KitsuneSyntaxParser.Models.ParseTress.Parse(Node node)">
        <span>
            [[kresult[i].name]]
        </span>
        <a href="">
            <img src="" alt="">
        </a>
    </div>
</k-script>

'GET' API with headers

Code example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
<k-script get-api="http://autocomplete.clearbit.com/v1/companies/suggest?query=Segment"
        headers="[Authorization: username]">
    <div k-repeat="System.Exception: No matching Action found for the expression.
   at KitsuneSyntaxParser.Models.ParseTress.Parse(Node node)">
        <span>
            [[kresult[i].name]]
        </span>
        <a href="">
            <img src="" alt="">
        </a>
    </div>
</k-script>