What is the error that you're seeing on the server side? I haven't tried this myself, but Brad Chapman suggested this example payload: -- {"tool_id": "upload1", "history_id": "identifier of history to use", "params": {"file_type": "vcf", "dbkey": "hg19", "files_0|url_paste": http://jbrowse-server.org/path/to/file.vcf", "files_0|NAME": "file_name_for_history.vcf"}} -- Maybe try removing file_type and adding files0|NAME? J. On Nov 12, 2012, at 6:42 PM, Ted Goldstein wrote:
Essentially, this the similar to a dataset upload where the origin is from a web page when a user clicks on a HTML button. The button is not part of the tool framework but any number of possible I am writing a variety of data editors in JavaScript and it would be convenient to upload the dataset into the user's current history list. of JavaScript actions.
I think I should be able to use the regular upload1 (upload.py) machinery. But So far, I have not had success in tricking it with my JavaScript function. I know that I could add web api. But there is a lot hairy code in the history dataset association that looks like it will change. So I'd rather keep it simple.
Does anyone have any suggestions?
Thanks, Ted
function UploadToHistory(name, value) { var payload = { tool_id: "upload1", 'file_type': 'tabular', 'file_name', name, 'dbkey': '?', 'files_0|url_paste': value};
$.ajax( { async: false, type: "POST", url: "/tool_runner/index", data: payload, dataType: "json", success: function(array_obj, status) { console.log("success", array_obj, status); }, failure: function() {console.log("fail");} } ); } ___________________________________________________________ Please keep all replies on the list by using "reply all" in your mail client. To manage your subscriptions to this and other Galaxy lists, please use the interface at: