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 here.

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 up this destination, go to your Forms page and locate your form. Then, click the settings icon to view the menu and select Destinations. On the following page, click New Destination.

Note: By default, two destinations are added every form created.

Note: Depending on the subscription package you have, your available destination options will vary.

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.

Supported Formats

XML

JSON

Word .docx

Excel .xlsx

Adobe .pdf

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. See this help article for more information.

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 7, you have the option to create Destination Rules for when you want the Destination to be active. To learn more Destination Rules, visit this article.

Lastly, click the Create Destination button at the bottom of the page.

A Note on Filtering Destination Deliveries by IP Address

We’ve received a few requests asking about firewall restrictions for the IP addresses of our HTTP(S) destination deliveries. Check out this article for more information on how Device Magic’s delivery services work, and how that relates to specific IP addresses for those services.

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.

Did this answer your question?