Create new form (from API) based on existing form

  • AmSteve
    Asked on November 21, 2015 at 8:49 PM

    When I use the Rest API (

    https://api.jotform.com/form/{formID}/questions?apiKey={apiKey)

    to get an existing form I'm given a Json string where a collection of form controls are shown as (for example a control_hidden):

            "18": {
                "browserInfo": "No",
                "explicitySetByUser": "Yes",
                "name": "webinarid18",
                "order": "4",
                "qid": "18",
                "text": "WebinarID",
                "type": "control_hidden"
            }

    Because the form was created by the GUI it has not-pretty values for the 'name' property. I want to create a new from (not a Clone) where the only property i'm changed (from the existing) is the name property.

    I would like to use the output of the above GET statement, make the minor corrections to name prop, and the use that Json with the form/PUT method to create a new form with the updated field names. But it appears that the Questions: object is not the same for creating a form as opposed to what output by the GET.

    I've tried pasting:

    {"questions":[{
            "2": {
                "buttonAlign": "Center",
                "buttonStyle": "None",
                "clear": "No",
                "clearText": "Clear Form",
                "encryptIcon": "No",
                "name": "submit",
                "order": "14",
                "print": "No",
                "printText": "Print Form",
                "qid": "2",
                "text": "Submit",
                "type": "control_button"
            },
    ...

       }
    ]}
     "https://api.jotform.com/user/forms?apiKey=48618da72289962efebfa4b91cb780a5"
    }

     

    to your sandbox and gotten a

    : "Bad request (/user-forms) - JSON error"


    So I used http://www.jsoneditoronline.org/ to inspect the output of your http://api.jotform.com/docs/#put-forms sample and realized that I just need to delete the iterator from the list of questions. Where:

            "2": {
                "buttonAlign": "Center",
                "buttonStyle": "None",
                "clear": "No",
    ...

               "type": "control_button"
            },

    becomes:

            {
                "buttonAlign": "Center",
                "buttonStyle": "None",
                "clear": "No",
    ...

                "type": "control_button"
            },

     

    and stuff just works.

     

    Looks like you guys have turned in a very well behaved API. Kudos.

     

     

     

     

  • Welvin Support Team Lead
    Replied on November 22, 2015 at 9:28 AM

    Thank you for the feedback. If something is wrong and/or if you need help with our API, you can reach our API Team at api@jotform.com.

    Regards

  • AmSteve
    Replied on November 23, 2015 at 2:01 AM

    Thanks -- I've seen other references to direct contact to api@jotform.com which implies this forum is not considered to be a primary channel to them. Seems counter-intuitive that questions here don't get handled by them.

  • Charlie
    Replied on November 23, 2015 at 3:02 AM

    There are cases that we can answer some API questions here in the forum, however, for cases that might need more detailed and comprehensive answer, it would best to contact the API team on their direct email address. We also have a separate forum page for developers to discuss things about our API, you can check it here: http://developers.jotform.com/forum.

    Thank you.

  • AmSteve
    Replied on November 24, 2015 at 7:22 PM

    Thanks much for the link to the developer form -- it sort of re-inforces a point i've made either in this thread or another recent -- the visibility to developer-specific topics for the site is lacking. there's got to be room in your menuset for the link you've just posted me.

  • Kevin Support Team Lead
    Replied on November 24, 2015 at 10:52 PM

    Hi,

    As explained by my collegues above, this thread requires a detailed explanation related to our API,if you have posted your questions in the API Forum they will reply you as soon as possible.

    Let us know if you have questions related to our Form Builder, we will be glad to assist you.

    Regards.

  • jacksoni
    Replied on December 16, 2016 at 8:23 AM

    It is a very profitable post for me. I’ve enjoyed reading the post. It is very informative and useful post. I would like to visit the post once more its valuable content  json converter