how to modify uploader behaviour?

I want to use webix uploader for uploading file to parse.com, but I can’t find how to change default uploader behaviour. When uploading to parse.com you have to use file object and ajax post with certain parameters. Callback will be url of file that you can later use. So, right now I’m uploading with this (selectedFile is file object):

	webix.ajax().headers({
		"Content-Type": selectedFile.type,
		"X-Parse-Application-Id": 'xxxxxxxxxx',
		"X-Parse-REST-API-Key": 'xxxxxxxxxx'
	}).post('https://api.parse.com/1/files/'+selectedFile.name, selectedFile, function(text){
		console.log('callback: ' + text);
		webix.message({ text: "callback " + JSON.stringify(text), expire:10000});
		//callback: {"name":"sample.png","url":"http://xxxxxxxxx"}
	});

but I’d like to be able to do it with uploader

You can use onBeforeAjax event handler

webix.attachEvent("onBeforeAjax", function(mode, url, params, x, headers){
  if (url.indexOf("https://api.parse.com/1/files") == 0 ){
     headers["Content-Type"] = selectedFile.type;
     headers["X-Parse-Application-Id"] = 'xxxxxxxxx';
     headers["X-Parse-REST-API-Key"] = 'xxxxxxxxx';
  }
});

Now all calls to the api.parse.com will have valid headers

If you need to send extra params with file during uploading, you can use
http://docs.webix.com/api__ui.uploader_formdata_config.html

Thanks! but that’s not enough, cause parse.com give certain response and uploader expect other. So, in onFileUploadError event in the response I can see that file was uploaded to parse:

onFileUploadError response: {
“file”: {},
“name”: “test.png”,
“id”: 1439278372887,
“size”: 8689,
“sizetext”: “8.49 Kb”,
“type”: “png”,
“status”: “error”,
“xhr”: {
“response”: {“name”:“XXXXXX.png”,“url”:“XXXXXXX”},
}
}

but how can I override uploader setting to expect {status: ‘server’} as only valid response?

Yep, it seems we have a limitation, will be resolved in the oncoming update ( uploader will accept datatype config option, which will allow to define a custom format of response )