New Layout: Using API, fields are retrieved in different order

  • Profile Image
    Roberto
    Asked on January 03, 2018 at 05:38 AM

    Hello,
    using this API

    GET / form / {id} / questions

    the JSON structure of the answers does not respect the order in which they were constructed and displayed online.

    I Created

    1) Name and Surname

    2) Email

    I get

    1) Name and Surname

    2) Address


    The link of the form: https://form.jotformeu.com/72691676319367

    the JSON answer
    {
        "id": "3907248464889084633",
        "form_id": "72691676319367",
        "ip": "82.59.128.84",
        "created_at": "2018-01-02 12:54:07",
        "status": "ACTIVE",
        "new": "0",
        "flag": "0",
        "updated_at": "2018-01-02 12:54:30",
        "answers": {
          "2": {
            "name": "datiGenitoreINPS",
            "text": "Dati genitore",
            "type": "control_fullname",
            "answer": {
              "first": "MARIO",
              "last": "ROSSI"
            },
            "prettyFormat": "MARIO ROSSI"
          },
          "3": {
            "name": "indirizzoGenitoreINPS",
            "text": "Indirizzo",
            "type": "control_address",
            "answer": {
              "addr_line1": "Via Milano, 51",
              "addr_line2": "",
              "city": "ROMA",
              "state": "",
              "postal": "00100",
              "country": ""
            },
            "prettyFormat": "Indirizzo: Via Milano, 51<br>Città: ROMA<br>Codice Postale: 00100<br>"
          },

  • Profile Image
    Adrian
    Answered on January 03, 2018 at 07:12 AM

    Can you please give us more information.

    Did you make any recent changes on your form? Also what Library are you using?

  • Profile Image
    JFRoberto
    Answered on January 03, 2018 at 09:16 AM

    Hi Adrian

    I realized the form and then I have added other controls.

    I invoke the API using c#.

    The problem is that the number of the items in the Json parts "answers" is not the same of what is displayed on line.

  • Profile Image
    Kevin_G
    Answered on January 03, 2018 at 11:07 AM

    I have been testing this and I can see what you're reporting, but the thing seems to be related to the fields of the form, I will forward it to our second level so this can be checked, as far as I know the fields should appear in the same order on both ends, the API calls as well as the builder. 

    We will keep you updated via this thread. 


  • Profile Image
    NeilVicente
    Answered on January 07, 2018 at 12:32 AM

    Form questions returned via the API are ordered chronologically, i.e., by the time each question was added to the form.

    To get the correct order by which the questions are displayed on the form, simply refer to the "order" property of the question object.

    15153031141337233.png

    Hope this answers your question.

    Cheers!

  • Profile Image
    NeilVicente
    Answered on January 07, 2018 at 12:42 AM

    As for submissions, you can always refer to the QID property (the index of the answers object) and rearrange it programatically.