Question: Galaxy Api run tool
0
gravatar for chavaldranis
5 months ago by
chavaldranis0 wrote:

Hello,

I have some issue to use the galaxy api to start a job.

From : https://docs.galaxyproject.org/en/master/_modules/galaxy/webapps/galaxy/api/tools.html#ToolsController.create

I'm using this command

curl -X POST -H "Content-Type: application/json" -d '{"key":"my_key","tool_id":"Show beginning1","tool_version":"1.0.0","inputs":{"lineNum":10,"input":{"values":[{"src":"hda","name":"Select first on data 18","tags":[],"keep":false,"hid":19,"id":"bbd44e69cb8906b5fc5c181d22be27d6"}],"batch":false}}}' https://usegalaxy.org/api/tools

And I got this error msg {"err_msg": "API authentication required for this request", "err_code": 403001}

Anyone have an idea or have an example of this kind of command working ?

tool api • 527 views
ADD COMMENTlink modified 4 months ago • written 5 months ago by chavaldranis0
1
gravatar for chavaldranis
4 months ago by
chavaldranis0 wrote:

I'hv finally found a way to make it work

curl -v -X POST -H "X-Api-Key: 011d381c1e07fa288b0........ -H "Content-Type: application/json" -d '{"history_id":"3efc1e4fbcc09bd8","tool_id":"Show beginning1","tool_version":"1.0.0","inputs":{"lineNum":10,"input":{"values":[{"src":"hda","name":"Select first on data 18","tags":[],"keep":false,"hid":19,"id":"bbd44e69cb8906b5fc5c181d22be27d6"}],"batch":false}}}' https://usegalaxy.org/api/tools

The API key has to be sent with the header 'X-Api-Key". And I had forgotten to add the 'history_id' in the payload otherwise I got

{"err_msg": "Error executing tool: 'NoneType' object has no attribute 'user'", "err_code": 0}

ADD COMMENTlink modified 4 months ago • written 4 months ago by chavaldranis0
0
gravatar for Martin Čech
5 months ago by
Martin Čech ♦♦ 4.9k
United States
Martin Čech ♦♦ 4.9k wrote:

I assume in the actual call you replace my_key with your actual API key. Is that correct?

edit: check out the Galaxy API library for Python: http://bioblend.readthedocs.io/en/latest/api_docs/galaxy/all.html#bioblend.galaxy.tools.ToolClient.run_tool

ADD COMMENTlink modified 5 months ago • written 5 months ago by Martin Čech ♦♦ 4.9k

Yes I replace my_key with my actual API key.

Actually, I would like to make it work without using python :/

ADD REPLYlink modified 5 months ago • written 5 months ago by chavaldranis0

I tried with the Galaxy API library for Python, to check if I can make it work

from bioblend import galaxy

gi = galaxy.GalaxyInstance(url='https://usegalaxy.org/', key='011d381c1...')
inputs = {"lineNum":10,"input":{"values":[{"src":"hda","name":"Select first on data 18","tags":[],"keep":False,"hid":19,"id":"bbd44e69cb8906b5fc5c181d22be27d6"}],"batch":False}}
gi.tools.run_tool(history_id='3efc1e4fbcc09bd8',tool_id='Show beginning1',tool_inputs=inputs)

And it works. I'm wondering what's wrong in the first command

ADD REPLYlink written 5 months ago by chavaldranis0

I am no curl guru so I would probably catch/log the requests and compare them.

ADD REPLYlink written 5 months ago by Martin Čech ♦♦ 4.9k

Hello Martin, have you catch up the logs?

ADD REPLYlink written 4 months ago by chavaldranis0

That is for you to do, I cannot see your logs.

ADD REPLYlink written 4 months ago by Martin Čech ♦♦ 4.9k

Sorry I misunderstood the answer

ADD REPLYlink written 4 months ago by chavaldranis0
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 169 users visited in the last hour