Form Integration

CKAN allows you to integrate its Edit Package and New Package forms forms into an external front-end. To that end, CKAN also provides a simple way to redirect these forms back to the external front-end upon submission.

Redirecting CKAN Forms

It is obviously simple enough for an external front-end to link to CKAN’s Edit Package and New Package forms, but once the forms are submitted, it would be desirable to redirect the user back to the external front-end, rather than CKAN’s package read page.

This is achieved with a parameter to the CKAN URL. The ‘return URL’ can be specified in two places:

  1. Passed as a URL-encoded value with the parameter return_to in the link to CKAN’s form page.
  2. Specified in the CKAN config keys package_new_return_url and package_edit_return_url (see config-package-urls).

(If the ‘return URL’ is supplied in both places, then the first takes precedence.)

Since the ‘return URL’ may need to include the package name, which could be changed by the user, CKAN replaces a known placeholder <NAME> with this value on redirect.


Note that the downside of specifying the ‘return URL’ in the CKAN config is that the CKAN web interface becomes less usable on its own, since the user is hampered by the redirects to the external interface.


An external front-end displays a package ‘ontariolandcoverv100’ here:

It displays a link to edit this package using CKAN’s form, which without the redirect would be:

At first, it may seem that the return link should be But when the user edits this package, the name may change. So the return link needs to be:<NAME>

And this is URL-encoded to become:

So, in summary, the edit link becomes:

During editing the package, the user changes the package name to canadalandcover, presses ‘preview’ and finally ‘commit’. The user is now redirected back to the external front-end at:

The same functionality could be achieved by this line in the config file (


package_edit_return_url =<NAME>