Query Link to "View Submission" via API

HI there

Thanks for the great work and support on Kobo and the Forum!

We are heavily using the Kobo API to import data from Kobo into our Ruby-on-Rails backend. But for more complicated forms it sometimes makes sense to just link to the submission (instead of importing all the data to our own schema).

But we are currently struggling to find the URL to the submission-url in the API-results (or how to compose it).

We are looking for something like this: https://ee.kobotoolbox.org/view/xxx?instance_id=xxx-02f8-48f9-a1ea-a807137784d9&return_url=false

I could solve it myself :slight_smile:

  1. get the “_xform_id_string” from the api result
  2. get the “_id” from the api result
  3. get the url with the following code:
    url = "https://kf.kobotoolbox.org/api/v2/assets/<xform_id>/data/<_id>/enketo/view/"

    uri = URI(url)
    req = Net::HTTP::Get.new(uri)
    req['Authorization'] = "Token #{Rails.application.credentials[:kobo_api_token]}"
    req['accept'] = 'application/json'
    req_options = {
      use_ssl: uri.scheme == 'https'
    response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|
    str = response.body
    data = JSON.parse(str)
    url = data["url"]

    puts url

Welcome to the community, @kobokobokobo! Thank you for sharing the solution with the entire community! :clap: :heart: :partying_face: