Question

I'm using CKAN to develop an open data portal. It uses Python as the language and Pylons as the framework

I use the below code snippets the get the API link as mentioned in the question. Please refer this question for more info. But it does not work for me.

Method 1

<b>API: </b><a href="${h.url_for(controller='api', register='package', action='show', id=c.pkg.name, ver='2')}">
${h.url_for(controller='api', register='package', action='show', id=c.pkg.name, ver='2')}
</a>

Method 2

<b>API: </b><a href="{% h.url_for(controller='api', register='package', action='show', id=c.pkg.name, ver='2') %}">
{% h.url_for(controller='api', register='package', action='show', id=c.pkg.name, ver='2') %}
</a>

Both above throw 500 error as shown below in the images.

enter image description here

How could I fix this error?

Was it helpful?

Solution

<a class="btn btn-primary resource-url-analytics resource-type-{{ res.resource_type }}" href="{{h.url_for(controller='api', register='package', action='show', id=c.pkg.name, ver=2)}}">
    <i class="icon-eye-open"></i> {{ _('API') }}
</a>

Above code works fine for me.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top