ODK Api download submission return 400

odk-aggregate

(Dimas Djs) #1

I try to get and api from odk aggregate using this :
GET /view/downloadSubmission?formId=my_odk_form[@version=null and @uiVersion=null]/data[@key=uuid:38fd4ef4-28b9-441e-a818-dd8cbe514b2c]

but it always return 400

is there any idea why it always return 400?

there is no error log , in tomcat log.

I delpoyed odk 1.7.1, in aws , under centos 7/

I tried to check version of from , in its null.


(Guillermo) #2

Hi, @Dimas_Djs.

An HTTP 400 means that the data you're sending is somehow wrong.

I've checked the requests Briefcase sends:
/view/downloadSubmission?formId=choice-lists%5B%40version%3Dnull+and+%40uiVersion%3Dnull%5D%2Fdata%5B%40key%3Duuid%3A4099b62e-a405-47e5-bd57-8f31e9ae80ad%5D

I think you need to url-encode the value of the formId query string param's value.

From my example:

  • url-encoded value choice-lists%5B%40version%3Dnull+and+%40uiVersion%3Dnull%5D%2Fdata%5B%40key%3Duuid%3A4099b62e-a405-47e5-bd57-8f31e9ae80ad%5D
  • decoded value choice-lists[@version=null and @uiVersion=null]/data[@key=uuid:4099b62e-a405-47e5-bd57-8f31e9ae80ad]

(Dimas Djs) #3

Hi mr.ggalmazor

Thank you for your explanation sir.

So did i get a wrong url , so the ODK return 400?

do i have to execute the url encoded in browser, or di decode ?

Thanks before sir.

Regards
Dimas


(Yaw Anokwa) #4

@Dimas_Djs You are correct that you've probably got the wrong (or rather improperly encoded) URL. Whatever programming language you are using to send that request to Aggregate has a way to url encode the URL before you send it.