How to pass a value to external Web API call

0 Answers 3 Views
AutoComplete
Rey
Top achievements
Rank 2
Iron
Iron
Iron
Rey asked on 11 Sep 2025, 12:35 PM

I am trying to call an external web api with the autocomplete but can't seem to pass the autocomplete value as I need to.  I need to pass the value at the end of the URL like:  https://webapiurl/api/{value} .  The farthest I got is passing the value but as a querystring parameter (https://webapiurl/api?name=value), this doesn't work, I get a 404 error.  How can I concatenate the value at the end of the URL?

 

@(Html.Kendo().AutoComplete().Name("auto")
    .DataTextField("Name")
    .Filter("contains")
    .MinLength(4)
    .DataSource(source =>
        {
            source.Read(r =>
            {
                r.Url("https://webapiurl/api")
                    .Data("onAdditionalData");
            })
            .ServerFiltering(false);
        })
    )

<script>
    function onAdditionalData() {
        return {
            name: $("#auto").val()
        };
    }
</script>

No answers yet. Maybe you can help?

Tags
AutoComplete
Asked by
Rey
Top achievements
Rank 2
Iron
Iron
Iron
Share this question
or