Question: API trouble with get_latest_installable_revisions
0
gravatar for cgpwytko
3.1 years ago by
cgpwytko0
United States
cgpwytko0 wrote:

I'm attempting to use the python api get_latest_installable_revisions in the galaxy folder

(galaxy/lib/galaxy/webapps/galaxy/api)

using curl in php with the following code

 

    public function get_latest_installable_revision ($admin_api_key, $tool_shed_url, $name_of_repo, $name_owner_of_repo){

        $i = curl_init();

        $api_key = $this->galaxy->getAPIKey();

        $url = $this->galaxy->getURL() . '/api/tool_shed_repositories/' . 'get_latest_installable_revision';
        
        $data = array(
                
                'tool_shed_url' => 'https://toolshed.g2.bx.psu.edu/repository?repository_id=253e22fdaf6a52c1'
                'name' => 'codonlogo',
                'owner' => 'davidmurphy', 
                'key' => $api_key
                
        );
        $data_string = '';
        foreach($data as $key=>$value) { 
            $data_string .= $key.'='.$value.'&'; 
        }
        //rtrim($data_string, '&');
        print($data_string);
        print "\n";
        
        curl_setopt($i, CURLOPT_URL, $url);
        curl_setopt($i,CURLOPT_POST, count($data));
        curl_setopt($i, CURLOPT_POSTFIELDS, $data_string);
        curl_setopt($i, CURLOPT_CUSTOMREQUEST, "POST");
        curl_setopt($i, CURLOPT_RETURNTRANSFER, true);
        
        $result = curl_exec($i);
          
        $info = curl_getinfo($i);
         
        $array = json_decode($result, true);
        
        print_r ($array);
         
        curl_close($i);
        }

 

and receive the following error:

tool_shed_url=https://toolshed.g2.bx.psu.edu/repository?repository_id=253e22fdaf6a52c1&name=codonlogo&owner=davidmurphy&key=6d79393594d00b17c63806144311d492&
Array
(
    [traceback] => Traceback (most recent call last):
  File "/home/cwytko/galaxy/lib/galaxy/web/framework/decorators.py", line 258, in decorator
    rval = func( self, trans, *args, **kwargs)
  File "/home/cwytko/galaxy/lib/galaxy/webapps/galaxy/api/tool_shed_repositories.py", line 115, in get_latest_installable_revision
    changeset_revisions = json.loads( raw_text )
  File "/usr/lib/python2.7/json/__init__.py", line 338, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python2.7/json/decoder.py", line 366, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python2.7/json/decoder.py", line 384, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded

    [err_msg] => Uncaught exception in exposed API method:
    [err_code] => 0
)

 

Any insight on this problem would be much appreciated

 

 

software error galaxy • 835 views
ADD COMMENTlink modified 3.1 years ago by Jennifer Hillman Jackson25k • written 3.1 years ago by cgpwytko0
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: 166 users visited in the last hour