Advice and answers from the Device Magic Team

When you need more flexibility than a simple e-mail or Google Spreadsheet, use the HTTP Destination to receive data at a web endpoint you specify. For each form submission received by the Mobile Forms server, a corresponding XML/JSON payload including both the form data and some metadata will be delivered to the URI you specify. In this article we'll go over the HTTP Destination. Please note that the HTTP Destination is only available with our Advanced Plan and above.

We have a .NET sample published on our Support Forums.

Using the “First Form” demo form as an example, this would be a corresponding XML/JSON payload:

Example XML Payload

<?xml version='1.0'?>
<instance dm:form_version='1.0' dm:submit_time='2012-04-02 12:33:26 UTC' dm:submitting_user='Dusan Babich' writeTime='2011-04-26T15:23:11.506' dm:form='A First Form' dm:submitting_device='iPhone_d6e2542effafbcc8d0e6bf0ef2917b76dea4faf8' xmlns:dm='http://mobileforms.devicemagic.com/xforms' xmlns='http://www.devicemagic.com/xforms/demo/2d3698c0-650c-012e-7e8e-12313b079c72'>
  <untitled_form_1>
    <quality_of_day>{{VALUE}}</quality_of_day>
    <inbox_overflow>{{VALUE}}</inbox_overflow>
    <next_holiday>{{VALUE}}</next_holiday>
    <comments>{{VALUE}}</comments>
  </untitled_form_1>
</instance>

Example JSON Payload

{
   "metadata": {
      "device_id": "iPhone_1asdzxc_sadxzc_asdasd",
      "user_id": null,
      "username": "Matt",
      "submitted_at": "2016-06-17 15:57:15 +02:00",
      "received_at": "2016-06-17 13:57:16 +00:00",
      "submission_id": "2",
      "device_submission_identifier": "5AF5C902-6CB9-4048-9CCE-F08664736D70",
      "form_name": "Everything Form",
      "form_namespace": "http://www.devicemagic.com/xforms/a617b1d0-1377-0134-2e7e-14109fd23119",
      "form_version": "1.01",
      "device": {
         "attribute_1": "hello"
      }
   },   "answers": {
      "Free_Text_Question": {
         "value": "Heh"
      },
      "Yes_No_Question": {
         "value": true
      },
      "Select_Question": {
         "value": "Second Option"
      },
      "Date_Question": {
         "value": "2016-06-17"
      },
      "Time_Question": {
         "value": "15:55:57"
      },
      "Date___Time_Question": {
         "value": "2016-06-17 15:55:58"
      },
      "Decimal_Question": {
         "value": 5430.55
      },
      "Integer_Question": {
         "value": 45437
      },
      "Location_Question": {
         "value": "lat=-33.863579, long=18.641930, alt=157.468994, hAccuracy=10.000000, vAccuracy=16.000000, timestamp=2016-06-17T13:56:12Z"
      },
      "Email_Question": {
         "value": "test@lol.com"
      },
      "Phone_No__Question": {
         "value": "49344"
      },
      "Image_Question": {
         "value": ""
      },
      "Password_Question": {
         "value": "jeksis"
      },
      "Calculated_Question": {
         "value": "WeO"
      }
   }
}

Once your server has finished processing the XML/JSON successfully, return a 20X-series of HTTP response.

Any other response code will be interpreted as a failure by the Mobile Forms server and will continue to attempt delivery at periodic intervals.

In this way, downtime or communication difficulties between our servers won’t result in lost data.

For diagnostics, please visit your “Delivery Problems” page from your organization’s dashboard. Note that this link won’t appear if there are no delivery problems for the various connectors you have configured.

This concludes our overview of the HTTP destination. If you have any questions or comments feel free to send us a message at support@devicemagic.com or leave us a comment below.

Did this answer your question?