This is a migrated thread and some comments may be shown as answers.

I feature separate me from using Kendo in my project.

1 Answer 36 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
Sergey
Top achievements
Rank 2
Sergey asked on 06 Nov 2011, 04:34 PM
In our project we use REST API. But this API require some additional headers to be sent. 

response-type:json|xml
api-key:kJsdj67SJ983Lk.......

And some other headers.

Right now what i should do is to send data-source query to php script which send request to API and then API return to PHP and PHP return to data-source.

Would be much more simple if I could set those headers to data-source and send query directly to API.

1 Answer, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 07 Nov 2011, 10:37 AM
Hi Sergey,

If remote transport (which uses jQuery ajax behind the scenes) is used you may specify additional header and parameters similar to the following:

new kendo.data.DataSource({
    transport: {
        read: { // all this will be internally set to $.ajax
            url: "page.html",
            headers: {
              myHeader: "something"
            },
		 data: { //additional parameters sent to the remote service
           "api-key": "12345"
        }

        }
    }  
});

All the best,
Rosen
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Data Source
Asked by
Sergey
Top achievements
Rank 2
Answers by
Rosen
Telerik team
Share this question
or