Access DB content externally e.g. Laravel Site

Hi,

I am trying to access the Database content externally using Laravel. Is there any documentations that can help me?

Kind Regards,

Hi @RiaanDavids welcome to the forum! Please introduce yourself here!

By "DB Content" I'm assuming you're meaning submissions on Aggregate? If so there are various ways of exporting, publishing or accessing submission data from Aggregate that are documented here.

If you want to access submissions on Aggregate directly from a Laravel application I'd imagine your best way forward would be the Briefcase API.

Thank you.

I've introduced myself.

I will scanned through the Briefcase API. Seems a bit challenging. But I will attempt it and hopefully this will be what I require.

1 Like

hi @seadowg

I am trying to use the following in my php file and get an error.
/view/downloadSubmission?formId=form_id[@version=null%20and%20@uiVersion=null]

Would you be able to assist please?

HTTP Status 400 – Bad Request
Type Exception Report

Message Invalid character found in the request target. The valid characters are defined in RFC 7230 and RFC 3986

Description The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).

Exception

java.lang.IllegalArgumentException: Invalid character found in the request target. The valid characters are defined in RFC 7230 and RFC 3986
org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:479)
org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:684)
org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:806)
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498)
org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
java.lang.Thread.run(Thread.java:748)
Note The full stack trace of the root cause is available in the server logs.

That error looks like it's because of invalid characters in the URL rather than an Aggregate problem. I think it could be because %20 isn't valid in the query string. Potentially using + instead could help.

I had the + first, so I thought that might be the issue and changed it to %20.

I found the following and tried it.

$fixurl = urlencode('domain/view/downloadSubmission?formId=form_id[@version=null and @uiVersion=null]');
$xdurl= new SimpleXMLElement($fixurl, NULL, TRUE);
$keyname2 = $xdurl->data->GP_v7->SDD_ID_N[0];
echo $keyname2;

I was hoping to make the whole process dynamic. But at the moment working on a system where a .json file (from the ODK system) gets uploaded (to the platform I am working on) and the data gets stored into the DB.