Hi hi! I’m trying to run a filter for specific report types based on the form used to create them. I’m using the reports API and can get the basic call to export everything working no problem:
curl "https://medic:PASSWORD-HERE@SERVERHERE.org/api/v2/export/reports" > output.csv
However, when I go to filter this to only show reports named covid19_rdt_capture
using the example on the docs page, it doesn’t work. The call I’m using is:
curl "https://medic:PASSWORD-HERE@SERVERHERE.org/api/v2/export/reports?filters[search]=&filters[forms][selected][0][code]=covid19_rdt_capture" > output.csv
Instead of CSV output in output.csv
, I get JSON:
{"error":"not_found","reason":"Database does not exist."}
Calling the /api/v1/forms
to validate the form name is correct endpoint gives me this JSON:
["contact:clinic:create.xml","contact:clinic:edit.xml","contact:district_hospital:create.xml","contact:district_hospital:edit.xml","contact:health_center:create.xml","contact:health_center:edit.xml","contact:person:create.xml","contact:person:edit.xml","covid19_rdt_capture.xml","covid19_rdt_provision.xml"]
I’m not familiar enough with the underlying search API to know why I’m hitting the wrong database, presumably the wrong CouchDB database? I can find the record I’m after in fauxton here:
/_utils/#database/medic/ID_OF_RECORD_HERE
This all based on the COVID-19 reference app we’re developing.