galaxy-genome-annotation / python-tripal

A Python library for interacting with Tripal
MIT License
3 stars 2 forks source link

error getting csrf token? #2

Closed bradfordcondon closed 6 years ago

bradfordcondon commented 6 years ago

Hi, I'm trying this out and im unable to interact with the server with the error in the stack being:

File "/Library/Python/2.7/site-packages/tripal/client.py", line 62, in _get_csrf_token
    (r.status_code, r.text))
Exception: Unexpected response from tripal while getting CSRF token 404: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN"

I've double checked my username password in the tripaille.yml, they are correct. Is there any configuration or prerequisites needed on the tripal site itself?

bradfordcondon commented 6 years ago

shoot, i found it at the bottom: I don't have the rest API installed!

edit- after enabling tripal_rest_API the problem persists (although now the response takes a while, so something is happening :) )

abretaud commented 6 years ago

Hi, Thanks for testing it! I've updated the readme to make it more visible thta you need tripal_rest_api.

Which version of tripal are you running? Which tripaille command are you trying to run? Is it a 404 error or something else now (e.g. 500)? If it's a 404 error, it might mean that the server url you put in tripaille.yml is not correct

bradfordcondon commented 6 years ago

Tripal 3. I was testing the add organism command, get organism also fails. It's still a 404 error, but the URL looks correct, since the response includes stuff from my site.

My guess is that the API is not configured correctly, are there more setup steps than enabling the module?

Attaching hte full response below

sudo tripaille organism add_organism --abbr donkey --common yep d yep (sudo because there is something very weird about my python setup :| from many years ago)

Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/tripaille/decorators.py", line 14, in custom_exception
    return wrapped(*args, **kwargs)
  File "/Library/Python/2.7/site-packages/tripaille/decorators.py", line 38, in dict_output
    output = wrapped(*args, **kwargs)
  File "/Library/Python/2.7/site-packages/tripaille/commands/organism/add_organism.py", line 44, in cli
    return ctx.gi.organism.add_organism(genus, species, common=common, abbr=abbr, comment=comment, infraspecific_rank=infraspecific_rank, infraspecific_name=infraspecific_name)
  File "/Library/Python/2.7/site-packages/tripal/organism/__init__.py", line 144, in add_organism
    return self._request('entity/create', params)
  File "/Library/Python/2.7/site-packages/tripal/client.py", line 100, in _request
    return self._do_request(url, clientMethod, data, post_params)
  File "/Library/Python/2.7/site-packages/tripal/client.py", line 109, in _do_request
    self._login()
  File "/Library/Python/2.7/site-packages/tripal/client.py", line 67, in _login
    csrfToken = self._get_csrf_token()
  File "/Library/Python/2.7/site-packages/tripal/client.py", line 62, in _get_csrf_token
    (r.status_code, r.text))
Exception: Unexpected response from tripal while getting CSRF token 404: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN"
  "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" version="XHTML+RDFa 1.0" dir="ltr"
  xmlns:content="http://purl.org/rss/1.0/modules/content/"
  xmlns:dc="http://purl.org/dc/terms/"
  xmlns:foaf="http://xmlns.com/foaf/0.1/"
  xmlns:og="http://ogp.me/ns#"
  xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
  xmlns:sioc="http://rdfs.org/sioc/ns#"
  xmlns:sioct="http://rdfs.org/sioc/types#"
  xmlns:skos="http://www.w3.org/2004/02/skos/core#"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema#">

<head profile="http://www.w3.org/1999/xhtml/vocab">
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="Generator" content="Drupal 7 (http://drupal.org)" />
<link rel="http://www.w3.org/ns/hydra/core#apiDocumentation" href="http://localhost:8083/web-sevices//doc/v0.1" />
<link rel="shortcut icon" href="http://localhost:8083/misc/favicon.ico" type="image/vnd.microsoft.icon" />
  <title>Page not found | localhost</title>
  <style type="text/css" media="all">
@import url("http://localhost:8083/modules/system/system.base.css?p7jiba");
@import url("http://localhost:8083/modules/system/system.menus.css?p7jiba");
@import url("http://localhost:8083/modules/system/system.messages.css?p7jiba");
@import url("http://localhost:8083/modules/system/system.theme.css?p7jiba");
</style>
<style type="text/css" media="all">
@import url("http://localhost:8083/modules/comment/comment.css?p7jiba");
@import url("http://localhost:8083/sites/all/modules/date/date_api/date.css?p7jiba");
@import url("http://localhost:8083/modules/field/theme/field.css?p7jiba");
@import url("http://localhost:8083/modules/node/node.css?p7jiba");
@import url("http://localhost:8083/modules/search/search.css?p7jiba");
@import url("http://localhost:8083/sites/all/modules/tripal/tripal/theme/css/tripal.css?p7jiba");
@import url("http://localhost:8083/sites/all/modules/custom/tripal_analysis_blast/theme/css/tripal_analysis_blast.css?p7jiba");
@import url("http://localhost:8083/sites/all/modules/tripal/tripal_chado/theme/css/tripal_chado.css?p7jiba");
@import url("http://localhost:8083/sites/all/modules/tripal/legacy/tripal_core/theme/css/tripal_core.css?p7jiba");
@import url("http://localhost:8083/sites/all/modules/tripal/legacy/tripal_organism/theme/css/tripal_organism.css?p7jiba");
@import url("http://localhost:8083/sites/all/modules/tripal/tripal_ws/theme/css/tripal_ws.css?p7jiba");
@import url("http://localhost:8083/modules/user/user.css?p7jiba");
@import url("http://localhost:8083/sites/all/modules/views/css/views.css?p7jiba");
</style>
<style type="text/css" media="all">
@import url("http://localhost:8083/sites/all/modules/ctools/css/ctools.css?p7jiba");
@import url("http://localhost:8083/sites/all/modules/custom/mainlab_chado_loader/theme/css/mcl.css?p7jiba");
</style>
<link type="text/css" rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.3.2/themes/default/style.min.css" media="all" />
<style type="text/css" media="all">
@import url("http://localhost:8083/sites/all/modules/custom/tripal_analysis_go/theme/css/tripal_analysis_go.css?p7jiba");
@import url("http://localhost:8083/sites/all/modules/tripal/tripal_ds/theme/css/tripal_ds.css?p7jiba");
@import url("http://localhost:8083/sites/all/modules/tripal/tripal_ds/theme/fonts/font-awesome-4.7.0/css/font-awesome.min.css?p7jiba");
</style>
<style type="text/css" media="all">
@import url("http://localhost:8083/themes/bartik/css/layout.css?p7jiba");
@import url("http://localhost:8083/themes/bartik/css/style.css?p7jiba");
@import url("http://localhost:8083/themes/bartik/css/colors.css?p7jiba");
</style>
<style type="text/css" media="print">
@import url("http://localhost:8083/themes/bartik/css/print.css?p7jiba");
</style>

<!--[if lte IE 7]>
<link type="text/css" rel="stylesheet" href="http://localhost:8083/themes/bartik/css/ie.css?p7jiba" media="all" />
<![endif]-->

<!--[if IE 6]>
<link type="text/css" rel="stylesheet" href="http://localhost:8083/themes/bartik/css/ie6.css?p7jiba" media="all" />
<![endif]-->
  <script type="text/javascript" src="http://localhost:8083/misc/jquery.js?v=1.4.4"></script>
<script type="text/javascript" src="http://localhost:8083/misc/jquery.once.js?v=1.2"></script>
<script type="text/javascript" src="http://localhost:8083/misc/drupal.js?p7jiba"></script>
<script type="text/javascript" src="http://localhost:8083/misc/jquery.cookie.js?v=1.0"></script>
<script type="text/javascript" src="http://localhost:8083/misc/jquery.form.js?v=2.52"></script>
<script type="text/javascript" src="http://localhost:8083/misc/form.js?v=7.58"></script>
<script type="text/javascript" src="http://localhost:8083/sites/all/modules/tripal/tripal/theme/js/tripal.js?p7jiba"></script>
<script type="text/javascript" src="http://localhost:8083/sites/all/modules/custom/tripal_analysis_blast/theme/js/tripal_analysis_blast.js?p7jiba"></script>
<script type="text/javascript" src="http://localhost:8083/sites/all/modules/tripal/legacy/tripal_core/theme/js/tripal_core.js?p7jiba"></script>
<script type="text/javascript" src="http://localhost:8083/misc/progress.js?v=7.58"></script>
<script type="text/javascript" src="http://localhost:8083/misc/collapse.js?v=7.58"></script>
<script type="text/javascript" src="http://localhost:8083/sites/all/modules/custom/mainlab_chado_loader/theme/js/mcl.js?p7jiba"></script>
<script type="text/javascript">
<!--//--><![CDATA[//><!--

    var baseurl  = 'http://localhost:8083';
    var isClean  =  1;
    var tripal_path = '/sites/all/modules/tripal/tripal';
//--><!]]>
</script>
<script type="text/javascript" src="http://localhost:8083/misc/ajax.js?p7jiba"></script>
<script type="text/javascript" src="http://localhost:8083/sites/all/modules/tripal/tripal_ds/theme/js/tripal_ds.js?p7jiba"></script>
<script type="text/javascript">
<!--//--><![CDATA[//><!--
var ds_theme_dir  = '/sites/all/modules/tripal/tripal_ds/theme';
//--><!]]>
</script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.2.1/jstree.min.js"></script>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
<!--//--><![CDATA[//><!--
if (typeof feature_viewer_jquery == 'undefined') {var feature_viewer_jquery = jQuery.noConflict(true);}
//--><!]]>
</script>
<script type="text/javascript" src="http://localhost:8083/sites/all/modules/custom/tripal_analysis_go/theme/js/tripal_analysis_go.js?p7jiba"></script>
<script type="text/javascript">
<!--//--><![CDATA[//><!--
jQuery.extend(Drupal.settings, {"basePath":"\/","pathPrefix":"","ajaxPageState":{"theme":"bartik","theme_token":"G2wbngehlTl6iX7kc2XlYowfx1eF2Hd1yUXO8RRSS7U","js":{"misc\/jquery.js":1,"misc\/jquery.once.js":1,"misc\/drupal.js":1,"misc\/jquery.cookie.js":1,"misc\/jquery.form.js":1,"misc\/form.js":1,"sites\/all\/modules\/tripal\/tripal\/theme\/js\/tripal.js":1,"sites\/all\/modules\/custom\/tripal_analysis_blast\/theme\/js\/tripal_analysis_blast.js":1,"sites\/all\/modules\/tripal\/legacy\/tripal_core\/theme\/js\/tripal_core.js":1,"misc\/progress.js":1,"misc\/collapse.js":1,"sites\/all\/modules\/custom\/mainlab_chado_loader\/theme\/js\/mcl.js":1,"0":1,"misc\/ajax.js":1,"sites\/all\/modules\/tripal\/tripal_ds\/theme\/js\/tripal_ds.js":1,"1":1,"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/jquery\/3.1.0\/jquery.min.js":1,"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/jstree\/3.2.1\/jstree.min.js":1,"https:\/\/www.gstatic.com\/charts\/loader.js":1,"2":1,"sites\/all\/modules\/custom\/tripal_analysis_go\/theme\/js\/tripal_analysis_go.js":1},"css":{"modules\/system\/system.base.css":1,"modules\/system\/system.menus.css":1,"modules\/system\/system.messages.css":1,"modules\/system\/system.theme.css":1,"modules\/comment\/comment.css":1,"sites\/all\/modules\/date\/date_api\/date.css":1,"modules\/field\/theme\/field.css":1,"modules\/node\/node.css":1,"modules\/search\/search.css":1,"sites\/all\/modules\/tripal\/tripal\/theme\/css\/tripal.css":1,"sites\/all\/modules\/custom\/tripal_analysis_blast\/theme\/css\/tripal_analysis_blast.css":1,"sites\/all\/modules\/tripal\/tripal_chado\/theme\/css\/tripal_chado.css":1,"sites\/all\/modules\/tripal\/legacy\/tripal_core\/theme\/css\/tripal_core.css":1,"sites\/all\/modules\/tripal\/legacy\/tripal_organism\/theme\/css\/tripal_organism.css":1,"sites\/all\/modules\/tripal\/tripal_ws\/theme\/css\/tripal_ws.css":1,"modules\/user\/user.css":1,"sites\/all\/modules\/views\/css\/views.css":1,"sites\/all\/modules\/ctools\/css\/ctools.css":1,"sites\/all\/modules\/custom\/mainlab_chado_loader\/theme\/css\/mcl.css":1,"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/jstree\/3.3.2\/themes\/default\/style.min.css":1,"sites\/all\/modules\/custom\/tripal_analysis_go\/theme\/css\/tripal_analysis_go.css":1,"sites\/all\/modules\/tripal\/tripal_ds\/theme\/css\/tripal_ds.css":1,"sites\/all\/modules\/tripal\/tripal_ds\/theme\/fonts\/font-awesome-4.7.0\/css\/font-awesome.min.css":1,"themes\/bartik\/css\/layout.css":1,"themes\/bartik\/css\/style.css":1,"themes\/bartik\/css\/colors.css":1,"themes\/bartik\/css\/print.css":1,"themes\/bartik\/css\/ie.css":1,"themes\/bartik\/css\/ie6.css":1}}});
//--><!]]>
</script>
</head>
<body class="html not-front not-logged-in no-sidebars page-tripal-api page-tripal-api-user page-tripal-api-user-tokenjson" >
  <div id="skip-link">
    <a href="#main-content" class="element-invisible element-focusable">Skip to main content</a>
  </div>
    <div id="page-wrapper"><div id="page">

  <div id="header" class="without-secondary-menu"><div class="section clearfix">

          <a href="/" title="Home" rel="home" id="logo">
        <img src="http://localhost:8083/themes/bartik/logo.png" alt="Home" />
      </a>

          <div id="name-and-slogan">

                              <div id="site-name">
              <strong>
                <a href="/" title="Home" rel="home"><span>localhost</span></a>
              </strong>
            </div>

      </div> <!-- /#name-and-slogan -->

  </div></div> <!-- /.section, /#header -->

  <div id="main-wrapper" class="clearfix"><div id="main" class="clearfix">

    <div id="content" class="column"><div class="section">
            <a id="main-content"></a>
                    <h1 class="title" id="page-title">
          Page not found        </h1>
                          <div class="tabs">
                  </div>
                        The requested page "/tripal_api/user/token.json" could not be found.
    </div></div> <!-- /.section, /#content -->

  </div></div> <!-- /#main, /#main-wrapper -->

  <div id="footer-wrapper"><div class="section">

  </div></div> <!-- /.section, /#footer-wrapper -->

</div></div> <!-- /#page, /#page-wrapper -->
  </body>
</html>

Unexpected response from tripal while getting CSRF token 404: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN"
  "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" version="XHTML+RDFa 1.0" dir="ltr"
  xmlns:content="http://purl.org/rss/1.0/modules/content/"
  xmlns:dc="http://purl.org/dc/terms/"
  xmlns:foaf="http://xmlns.com/foaf/0.1/"
  xmlns:og="http://ogp.me/ns#"
  xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
  xmlns:sioc="http://rdfs.org/sioc/ns#"
  xmlns:sioct="http://rdfs.org/sioc/types#"
  xmlns:skos="http://www.w3.org/2004/02/skos/core#"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema#">

<head profile="http://www.w3.org/1999/xhtml/vocab">
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="Generator" content="Drupal 7 (http://drupal.org)" />
<link rel="http://www.w3.org/ns/hydra/core#apiDocumentation" href="http://localhost:8083/web-sevices//doc/v0.1" />
<link rel="shortcut icon" href="http://localhost:8083/misc/favicon.ico" type="image/vnd.microsoft.icon" />
  <title>Page not found | localhost</title>
  <style type="text/css" media="all">
@import url("http://localhost:8083/modules/system/system.base.css?p7jiba");
@import url("http://localhost:8083/modules/system/system.menus.css?p7jiba");
@import url("http://localhost:8083/modules/system/system.messages.css?p7jiba");
@import url("http://localhost:8083/modules/system/system.theme.css?p7jiba");
</style>
<style type="text/css" media="all">
@import url("http://localhost:8083/modules/comment/comment.css?p7jiba");
@import url("http://localhost:8083/sites/all/modules/date/date_api/date.css?p7jiba");
@import url("http://localhost:8083/modules/field/theme/field.css?p7jiba");
@import url("http://localhost:8083/modules/node/node.css?p7jiba");
@import url("http://localhost:8083/modules/search/search.css?p7jiba");
@import url("http://localhost:8083/sites/all/modules/tripal/tripal/theme/css/tripal.css?p7jiba");
@import url("http://localhost:8083/sites/all/modules/custom/tripal_analysis_blast/theme/css/tripal_analysis_blast.css?p7jiba");
@import url("http://localhost:8083/sites/all/modules/tripal/tripal_chado/theme/css/tripal_chado.css?p7jiba");
@import url("http://localhost:8083/sites/all/modules/tripal/legacy/tripal_core/theme/css/tripal_core.css?p7jiba");
@import url("http://localhost:8083/sites/all/modules/tripal/legacy/tripal_organism/theme/css/tripal_organism.css?p7jiba");
@import url("http://localhost:8083/sites/all/modules/tripal/tripal_ws/theme/css/tripal_ws.css?p7jiba");
@import url("http://localhost:8083/modules/user/user.css?p7jiba");
@import url("http://localhost:8083/sites/all/modules/views/css/views.css?p7jiba");
</style>
<style type="text/css" media="all">
@import url("http://localhost:8083/sites/all/modules/ctools/css/ctools.css?p7jiba");
@import url("http://localhost:8083/sites/all/modules/custom/mainlab_chado_loader/theme/css/mcl.css?p7jiba");
</style>
<link type="text/css" rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.3.2/themes/default/style.min.css" media="all" />
<style type="text/css" media="all">
@import url("http://localhost:8083/sites/all/modules/custom/tripal_analysis_go/theme/css/tripal_analysis_go.css?p7jiba");
@import url("http://localhost:8083/sites/all/modules/tripal/tripal_ds/theme/css/tripal_ds.css?p7jiba");
@import url("http://localhost:8083/sites/all/modules/tripal/tripal_ds/theme/fonts/font-awesome-4.7.0/css/font-awesome.min.css?p7jiba");
</style>
<style type="text/css" media="all">
@import url("http://localhost:8083/themes/bartik/css/layout.css?p7jiba");
@import url("http://localhost:8083/themes/bartik/css/style.css?p7jiba");
@import url("http://localhost:8083/themes/bartik/css/colors.css?p7jiba");
</style>
<style type="text/css" media="print">
@import url("http://localhost:8083/themes/bartik/css/print.css?p7jiba");
</style>

<!--[if lte IE 7]>
<link type="text/css" rel="stylesheet" href="http://localhost:8083/themes/bartik/css/ie.css?p7jiba" media="all" />
<![endif]-->

<!--[if IE 6]>
<link type="text/css" rel="stylesheet" href="http://localhost:8083/themes/bartik/css/ie6.css?p7jiba" media="all" />
<![endif]-->
  <script type="text/javascript" src="http://localhost:8083/misc/jquery.js?v=1.4.4"></script>
<script type="text/javascript" src="http://localhost:8083/misc/jquery.once.js?v=1.2"></script>
<script type="text/javascript" src="http://localhost:8083/misc/drupal.js?p7jiba"></script>
<script type="text/javascript" src="http://localhost:8083/misc/jquery.cookie.js?v=1.0"></script>
<script type="text/javascript" src="http://localhost:8083/misc/jquery.form.js?v=2.52"></script>
<script type="text/javascript" src="http://localhost:8083/misc/form.js?v=7.58"></script>
<script type="text/javascript" src="http://localhost:8083/sites/all/modules/tripal/tripal/theme/js/tripal.js?p7jiba"></script>
<script type="text/javascript" src="http://localhost:8083/sites/all/modules/custom/tripal_analysis_blast/theme/js/tripal_analysis_blast.js?p7jiba"></script>
<script type="text/javascript" src="http://localhost:8083/sites/all/modules/tripal/legacy/tripal_core/theme/js/tripal_core.js?p7jiba"></script>
<script type="text/javascript" src="http://localhost:8083/misc/progress.js?v=7.58"></script>
<script type="text/javascript" src="http://localhost:8083/misc/collapse.js?v=7.58"></script>
<script type="text/javascript" src="http://localhost:8083/sites/all/modules/custom/mainlab_chado_loader/theme/js/mcl.js?p7jiba"></script>
<script type="text/javascript">
<!--//--><![CDATA[//><!--

    var baseurl  = 'http://localhost:8083';
    var isClean  =  1;
    var tripal_path = '/sites/all/modules/tripal/tripal';
//--><!]]>
</script>
<script type="text/javascript" src="http://localhost:8083/misc/ajax.js?p7jiba"></script>
<script type="text/javascript" src="http://localhost:8083/sites/all/modules/tripal/tripal_ds/theme/js/tripal_ds.js?p7jiba"></script>
<script type="text/javascript">
<!--//--><![CDATA[//><!--
var ds_theme_dir  = '/sites/all/modules/tripal/tripal_ds/theme';
//--><!]]>
</script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.2.1/jstree.min.js"></script>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
<!--//--><![CDATA[//><!--
if (typeof feature_viewer_jquery == 'undefined') {var feature_viewer_jquery = jQuery.noConflict(true);}
//--><!]]>
</script>
<script type="text/javascript" src="http://localhost:8083/sites/all/modules/custom/tripal_analysis_go/theme/js/tripal_analysis_go.js?p7jiba"></script>
<script type="text/javascript">
<!--//--><![CDATA[//><!--
jQuery.extend(Drupal.settings, {"basePath":"\/","pathPrefix":"","ajaxPageState":{"theme":"bartik","theme_token":"G2wbngehlTl6iX7kc2XlYowfx1eF2Hd1yUXO8RRSS7U","js":{"misc\/jquery.js":1,"misc\/jquery.once.js":1,"misc\/drupal.js":1,"misc\/jquery.cookie.js":1,"misc\/jquery.form.js":1,"misc\/form.js":1,"sites\/all\/modules\/tripal\/tripal\/theme\/js\/tripal.js":1,"sites\/all\/modules\/custom\/tripal_analysis_blast\/theme\/js\/tripal_analysis_blast.js":1,"sites\/all\/modules\/tripal\/legacy\/tripal_core\/theme\/js\/tripal_core.js":1,"misc\/progress.js":1,"misc\/collapse.js":1,"sites\/all\/modules\/custom\/mainlab_chado_loader\/theme\/js\/mcl.js":1,"0":1,"misc\/ajax.js":1,"sites\/all\/modules\/tripal\/tripal_ds\/theme\/js\/tripal_ds.js":1,"1":1,"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/jquery\/3.1.0\/jquery.min.js":1,"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/jstree\/3.2.1\/jstree.min.js":1,"https:\/\/www.gstatic.com\/charts\/loader.js":1,"2":1,"sites\/all\/modules\/custom\/tripal_analysis_go\/theme\/js\/tripal_analysis_go.js":1},"css":{"modules\/system\/system.base.css":1,"modules\/system\/system.menus.css":1,"modules\/system\/system.messages.css":1,"modules\/system\/system.theme.css":1,"modules\/comment\/comment.css":1,"sites\/all\/modules\/date\/date_api\/date.css":1,"modules\/field\/theme\/field.css":1,"modules\/node\/node.css":1,"modules\/search\/search.css":1,"sites\/all\/modules\/tripal\/tripal\/theme\/css\/tripal.css":1,"sites\/all\/modules\/custom\/tripal_analysis_blast\/theme\/css\/tripal_analysis_blast.css":1,"sites\/all\/modules\/tripal\/tripal_chado\/theme\/css\/tripal_chado.css":1,"sites\/all\/modules\/tripal\/legacy\/tripal_core\/theme\/css\/tripal_core.css":1,"sites\/all\/modules\/tripal\/legacy\/tripal_organism\/theme\/css\/tripal_organism.css":1,"sites\/all\/modules\/tripal\/tripal_ws\/theme\/css\/tripal_ws.css":1,"modules\/user\/user.css":1,"sites\/all\/modules\/views\/css\/views.css":1,"sites\/all\/modules\/ctools\/css\/ctools.css":1,"sites\/all\/modules\/custom\/mainlab_chado_loader\/theme\/css\/mcl.css":1,"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/jstree\/3.3.2\/themes\/default\/style.min.css":1,"sites\/all\/modules\/custom\/tripal_analysis_go\/theme\/css\/tripal_analysis_go.css":1,"sites\/all\/modules\/tripal\/tripal_ds\/theme\/css\/tripal_ds.css":1,"sites\/all\/modules\/tripal\/tripal_ds\/theme\/fonts\/font-awesome-4.7.0\/css\/font-awesome.min.css":1,"themes\/bartik\/css\/layout.css":1,"themes\/bartik\/css\/style.css":1,"themes\/bartik\/css\/colors.css":1,"themes\/bartik\/css\/print.css":1,"themes\/bartik\/css\/ie.css":1,"themes\/bartik\/css\/ie6.css":1}}});
//--><!]]>
</script>
</head>
<body class="html not-front not-logged-in no-sidebars page-tripal-api page-tripal-api-user page-tripal-api-user-tokenjson" >
  <div id="skip-link">
    <a href="#main-content" class="element-invisible element-focusable">Skip to main content</a>
  </div>
    <div id="page-wrapper"><div id="page">

  <div id="header" class="without-secondary-menu"><div class="section clearfix">

          <a href="/" title="Home" rel="home" id="logo">
        <img src="http://localhost:8083/themes/bartik/logo.png" alt="Home" />
      </a>

          <div id="name-and-slogan">

                              <div id="site-name">
              <strong>
                <a href="/" title="Home" rel="home"><span>localhost</span></a>
              </strong>
            </div>

      </div> <!-- /#name-and-slogan -->

  </div></div> <!-- /.section, /#header -->

  <div id="main-wrapper" class="clearfix"><div id="main" class="clearfix">

    <div id="content" class="column"><div class="section">
            <a id="main-content"></a>
                    <h1 class="title" id="page-title">
          Page not found        </h1>
                          <div class="tabs">
                  </div>
                        The requested page "/tripal_api/user/token.json" could not be found.
    </div></div> <!-- /.section, /#content -->

  </div></div> <!-- /#main, /#main-wrapper -->

  <div id="footer-wrapper"><div class="section">

  </div></div> <!-- /.section, /#footer-wrapper -->

</div></div> <!-- /#page, /#page-wrapper -->
  </body>
</html>
abretaud commented 6 years ago

Ok, the 404 error comes from tripaille trying to use the /tripal_api/user/token.json url to authenticate. This url is provided by the tripal_rest_api module. Can you double check that is is enabled (and that you used the 7.x-3.x branch of the module). Also, look in the admin section of your tripal instance, in Structure then Services, there you should have a tripal_rest_api that is enabled.

bradfordcondon commented 6 years ago

Ah thanks, I didnt know where the REST module would show up. I'm on hte correct branch and module is enabled.

screen shot 2018-04-23 at 9 29 19 am

Fiddling with the settings, I see that the box for "return the CSRF" token is checked....

There's no server configured though, could that be the problem?

abretaud commented 6 years ago

Strange... Are you testing with a docker image?

bradfordcondon commented 6 years ago

no, OSX running Apache

abretaud commented 6 years ago

Do you get something if you browse to http://localhost:8501/tripal/tripal_api/ ?

bradfordcondon commented 6 years ago

i do not, page not found... When you set up the REST API theres no further configuration necessary?

abretaud commented 6 years ago

Oh, sorry, the url I gave was wrong, you need to adapt it to your setup, so for you I guess (looking at the logs) it would be http://localhost:8083/tripal_api/ I don't remember configuring anything else to make it work, and as I develop it with a freshly started docker image (https://github.com/galaxy-genome-annotation/python-tripal/blob/master/test-data/tripal_v3/docker-compose.yml), it's quite reproducible for me... You didn't get any error when enabling the module? I tested with drupal 7.58, don't know if it breaks with older versions...

bradfordcondon commented 6 years ago

I tried both URLs. I'm running 7.58. My webserver config is Apache/2.4.29 (Unix) PHP/7.1.14.

I'll try testing with our dockers later (we stopped developing with dockers because the file system mappings are extremely slow on OSX).

Thanks for your help, I'd guess theres something with my services configuration thats wrong... Can you confirm that in your sites you have an existing "server" to select from the services dropdown? At admin/structure/services/list/tripal_rest_api

screen shot 2018-04-23 at 11 37 07 am

bradfordcondon commented 6 years ago

Although I had the services module enabled, I did not have the rest_server module enabled. After enabling, the API works (at least, visiting http://localhost:8083/tripal_api gives me a success message )

Maybe rest_server should be an explicit requirement for the tripal_rest_API module? My best guess is something else in your setup enables this module. (or maybe you thought people had enough common sense to enable it ;) )

bradfordcondon commented 6 years ago

For clarity: as you can see, now the Server dropdown has a REST option whereas before there were no select options.

screen shot 2018-04-23 at 4 41 02 pm

abretaud commented 6 years ago

Ah thanks, I understand now, the install of rest_server was done in the docker image: https://github.com/erasche/docker-tripal/blob/master/scripts/pre-launch.d/50modules#L34 I've added the dependency in the tripal_rest_api module now

So now does everything work as expected?

bradfordcondon commented 6 years ago

yes I created an organism via the API. Very neat. Thanks for the help.