The Telerik Platform product is retired.Learn more

Passing Custom Headers

Passing Custom Headers

Sometimes when making CRUD operations you may need to pass custom headers to the Telerik Platform services. For example you may want to send data as a header value and consume it you Cloud Code.

The Backend Services JavaScript SDK allows passing custom headers through the withHeaders() function. It accept a plain object with its properties used for header names and values as in the following example.

    'custom-header-foo': 'foo',
    'custom-header-bar': 'bar'

Headers passed this way are used in the subsequent request and cleared immediately after that. The next example sets headers for the execution of the get() method.

var el = new Everlive('your-app-id');
var data ='type-name');
    .withHeaders({'X-Custom-Header': 'custom header value'})
    .get() // a request is made with the custom header
    .then(function(data) {
        var item = data.result[0];
        item['Author'] = 'changed'; // returning a new promise
        return data.updateSingle(item); // this request will not send the custom header
    .then(function(data) {
    function(error) {

See Also

Contact us: +1-888-365-2779
Copyright © 2016-2018, Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.