Hey Neil,

  Just last week pull request 94 was accepted into galaxy-central that
direct upload of files to history (without needing a URL). The python
bioblend (https://github.com/afgane/bioblend) API client does not yet
have it but it would be relatively easy to add, you will want to look
at upload_file_from_local_path in the libraries client as a template
for how to attach file data to the request and then add a method to a
new tools client to target that API.

 The blend4j (https://github.com/jmchilton/blend4j) Java API does
implement direct uploads to histories. Here is some pseudo-code to
demonstrate the API calls:

import com.github.jmchilton.blend4j.galaxy.*;
import com.sun.jersey.api.client.ClientResponse;
import java.io.File;

class UploadTest {
 GalaxyInstance instance = GalaxyInstanceFactory.get(url, apiKey);

 public void testUpload() {
    ToolsClient client = instance.getToolsClient();
    final String historyId = getTestHistoryId();
    final File testFile = TestHelpers.getTestFile();
    final ClientResponse clientResponse =
client.fileUploadRequest(historyId, "txt", "?", testFile);
    assert clientResponse.getStatus() == 200 :
clientResponse.getEntity(String.class);
  }

  private String getTestHistoryId() {
    final History testHistory = new History();
    testHistory.setName("Upload Test History");
    final History newHistory =
instance.getHistoriesClient().create(testHistory);
    final String historyId = newHistory.getId();
    return historyId;
  }

}

Hope this helps.

-John

On Mon, Jan 14, 2013 at 7:42 AM, Jeremy Goecks <jeremy.goe...@emory.edu> wrote:
> This is the most recent thread on uploading files via the API; this approach
> uses a URL for uploading a dataset to the history:
>
> http://dev.list.galaxyproject.org/Uploading-to-history-via-JavaScript-td4657068.html
>
> In general, using the Galaxy Web search and/or mailing list search to see if
> your question has been discussed before is recommended because the mailing
> lists can act as a good documentation source.
>
> Finally, please direct all coding questions to the galaxy-dev list, not the
> galaxy-user list.
>
> Best,
> J.
>
>
> On Jan 13, 2013, at 8:25 PM, <neil.burd...@csiro.au> wrote:
>
> Hi,
>     It seems the API documentation is a bit scarce. I’d like to upload a
> file from the command line using the API rather than the GUI, but would like
> to see the file in the history. Does anyone have any information how to do
> this/ any tools that are available.
>
> Thanks
> Neil
> ___________________________________________________________
> 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:
>
>  http://lists.bx.psu.edu/
>
>
>
> ___________________________________________________________
> 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:
>
>   http://lists.bx.psu.edu/

___________________________________________________________
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:

  http://lists.bx.psu.edu/

Reply via email to