Error when i use ruodk odata_submission_get with media (image)

Hi, i use ruODK to download the submissions for a survey with photo. When i use submission_export it's ok with a file .zip wich contain a directory media with the images but when i use odata_submission_get i obtain a directory media with the file (same name as the image) with a bad content. In fact the file is a html text file wich contains :

Please enable JavaScript to continue.

Powered by ODK .....
Somebody can explain me?
Thanks for advance.

What version of Central are you using? And what version of ruODK?

Hi i use 1.5.3 odk central , 4.2.1 ruODK.

ODK Collect v2022.4.1

Hello, I don't understand the response. Is there nobody who use 1.5.3 odk central and ruodk (with API, not in zip mode) .

@Florian_May Any ideas what might be wrong?

Hi @Alain_Benard,

v4.2.1 seems like the R version - that's recent enough to exclude any issues with R itself. ruODK's latest version is 1.3.12.

Just to make sure you've used the correct settings, see - you'll want to use the "OData Service URL" from the "Analyze via OData" button in the Submissions tab as svc:

  svc = "", 
  un = "your username", 
  pw = "your password",
  tz = "Australia/Perth",
  verbose = TRUE

# Verify that settings work:

# should look like 
> ruODK::form_detail()
# A tibble: 1 × 12
  name                     fid              version state submi…¹ creat…² creat…³ creat…⁴ updat…⁵ publi…⁶ last_…⁷ hash 
  <chr>                    <chr>            <chr>   <chr>   <int> <chr>     <int> <chr>   <chr>   <chr>   <chr>   <chr>
1 Marine Wildlife Incident Marine-Wildlife… 162944… open      248 2020-1…       5 Floria… 2022-1… 2021-0… 2022-1… 81c5…
# … with abbreviated variable names ¹​submissions, ²​created_at, ³​created_by_id, ⁴​created_by, ⁵​updated_at,
#   ⁶​published_at, ⁷​last_submission

Once you've got that working, it might be worth saving your credentials as environment variables as shown in the vignette.
If you still run into errors, feel free to post your sessionInfo() to look at the ruODK version you're running, and let us know what ruODK::form_detail() tells you (minus any sensitive info).

thank you Florian, you're right it's a url problem.
I am developing functions based on RUODK to finalize submission fetching. One of the functions establishes the connection to the ODK platform and I don't remember why it adds a hash character to the url (I haven't been using ruodk for a long time and we started with an old version platform):

 <ruODK settings>
     Default ODK Central Project ID: 3
     Default ODK Central Form ID: my_form 
     Default ODK Central URL:

With this url the ruODK::submission_export function works well, the ruODK::odata_submission_get function retrieves the tables but the media folder only contains files with the message "Please enable JavaScript to continue".

If the service url contains a / character at the end of the string (https://myplatform/) then ruODK::odata_submission_get issues an error message for each media file:

 Not Found (HTTP 404). Failed to download media attachment

Each media file will then contain an error message: {"message":"Expected an API version (eg /v1) at the start of the request URL.","code":404.2}

If the url is correct everything works. :grinning: :grinning:
What is disturbing is that the tables are well recovered by the API and that only the media files pose a problem (and still not with ruODK::submission_export).
Anyway my problem is solved, thanks again.

1 Like