When you need more flexibility than a simple e-mail or Google Spreadsheet, use the HTTP(S) 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. 

Optionally, you could also specify that a Word or PDF document be sent over HTTP(S). In this article we'll go over the HTTP Destination. Please note that the HTTP(S) Destination is only available with our Advanced and Enterprise Plans.

We also 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.

Setting up your HTTP Destination on Device Magic

To set this up, go to your "Forms" page and click the link in the Destinations column of the form you would like to add the Destination to.

Note: If there are no Destinations added to your account, this button will read "0".

This will take you to the "Destinations" page, where you will then need to click "New Destination".

A new page will load, and on it you will see different destinations to send your data. Click "HTTP(S)".

You will then be given a selection of formats to choose from. Click on the format you require. For this example, the "JSON" format has been selected.

You will also see an option to send your images to a service other than Device Magic. If you would like to do this, select from the services provided. Please note, choosing a service other than "None (inline)" will result in a hyperlink to the hosted image being placed in the file generated by this destination instead of the actual image.

Step 4 will give you the option to add a Description to your destination. You can also set your destination to be Active or not here.

Step 5 contains your HTTP(S) Options. This is where you will need to insert your server’s URL. You will also be able to set custom HTTP headers. Placeholders are also available for you to insert. These are optional. 

In Step 6, you have the option to create Destination Rules on when you want the Destination to be active. To learn more about how Destination Rules work, visit our article here.

Lastly, all you need to do is click the "Create Destination" button at the bottom of the page.

You will then be directed to the Destinations page for your form where you will see the Destinations you've made for it - now including the HTTP(S) one you have created.

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?