How to trigger an web service during form submitted in ODK Aggregate

How Can i Send formdata in json format to another server/CRM which submitted from ODK Collect to ODK Aggregate?

Is there any way to do this.

Please Reply ASAP.

Yes. You can use the 'Publish' services of Aggregate to accomplish this. See publish-data

i am already go through this section and also send data to google sheet, but unable to configure z-alpha json server.

Please let me know how o configure it. in my server

Hello Support,

I want to write an webservice during data submitted in ODK Aggregate from ODK Collect to save and display those data in my website.

I am already tried to solve with Publish Section In ODK Aggregate. That is not helpful for me.

Please give me any solution ASAP.

Hello,

Please guide me step by step integrate Z-Alpha Json Server.
I have an server with
Java Version: 1.8.0
Tomcat/8.0.53
MySql: 5.7.22

I am already tried with download zip from https://github.com/spatialthoughts/odk-post-receiver and upload it to tomcat webaps directory.

But its does not work at all.

Please help me urgent

If you need urgent help, you can post at https://forum.getodk.org/c/marketplace and try to hire someone.

Using the odk-post-receiver in Tomcat doesn't make sense. As it says in the readme, it's an App Engine application, and a Python one at that.

Whatever endpoint you are sending the data to needs to listen for a post and do the needful. https://github.com/opendatakit/opendatakit/wiki/Aggregate-Publishers-Implementation-Details#simple-json-publisher describes what to expect.

As Yaw alluded, if your situation is desparately urgent you may want to consider hiring a consultant with expertise in this area.

If it helps, this is what I did a while back to stream ODK submissions to another webserver (eg 1.2.3.4) to test it worked:

  • On ODK Aggregate, I config'd publishing a form:

Form Management -> Publish -> Publish -> Z-ALPHA JSON Server
Data = Both Upload Existing and Stream New Submission Data
URL = http://1.2.3.4/odkreceiver.php
Token =
Include Media = Links
email = foo@bar.com

  • On my 1.2.3.4 Apache webserver, I setup a PHP script called odkreceiver.php to receive the POST data and dump it into a /tmp file:
<?php $_POST = json_decode(file_get_contents('php://input'), true); $txt = file_get_contents('php://input'); $tmp = '/tmp/odkdata.json'; $myfile = fopen($tmp, "a") or die("Unable to open file!"); fwrite($myfile, "\n". $txt); fclose($myfile); ?>

Note, I've not tested this for quite some time so standard disclaimers apply: No warranty expressed or implied, YMMV, etc.

1 Like

Thanks Xiphware.

Its works for me as well.

I am modified your code. In place of save data in odkdata.json, store data in my DB using insert query in a custom table.

Thanks a lot for your help. Now my requirement is completely fulfilled with your help.

2 Likes

YW. Please remember, as described in publist-data, your endpoint should ideally handle the situation where you get a duplicate copy of a previously received submission, which my piece of PHP code makes no attempt to check.

BTW my hourly rate is 1 beer/hour... :wink:

1 Like