Putting and deleting forms on nodeJS

  • Profile Image
    shalomazar
    Asked on September 26, 2017 at 02:16 PM

    I don't see any sample instructions on the API page on how to put and delete forms on nodeJS. Is it even possible to put and delete forms on nodeJS?

  • Profile Image
    Sabbir
    Answered on September 26, 2017 at 02:30 PM

    Hello,

    You can go to our API page to get all the information regarding working with Jotform in NodeJS.

    This is the JotForm API for NodeJS: https://github.com/jotform/jotform-api-nodejs

    Also go to http://api.jotform.com/docs/

    Then from the left side drop down box, select NodeJS and you will find all the methods underneath to see how to use them in Jotform.

    Hope this will help.

    Let us know if you have any further query regarding this.

    Thanks


  • Profile Image
    shalomazar
    Answered on September 26, 2017 at 02:50 PM

    I already checked all those places and there are no instructions for methods of putting and deleting forms on nodeJS. Can you please put the instructions up, Thank you

  • Profile Image
    Sabbir
    Answered on September 26, 2017 at 03:02 PM

    Hello,

    The PUT, DELETE methods are already there for forms.

  • Profile Image
    shalomazar
    Answered on September 26, 2017 at 03:09 PM

    Hi,

    Methods are there as you illustrated but there is no coding or using the API sample like the get method in node or put and delete in Python and java. Is it possible that can be added?

  • Profile Image
    Kevin_G
    Answered on September 26, 2017 at 03:27 PM

    @shalomazar, 

    Please find some examples on this link: https://github.com/jotform/jotform-api-nodejs/blob/master/index.js 

    Create form.

    exports.createForm = function(formData) {

        var deferred = Q.defer();

        if(typeof formData != 'object' || formData == null) {

            return;

        }


        var endPoint = "/user/forms"

        , requestUrl = _url + (_version==="latest" ? "" : "/v"+_version) + endPoint + "?apiKey=" + _apiKey

        , requestVerb =  "post"

        , postData = formData


        sendRequest(deferred, requestUrl, requestVerb, postData);

        return deferred.promise;     

    }

    Delete Form.

    exports.deleteForm = function(formID) {

        var deferred = Q.defer();


        var endPoint = "/form/" + formID

        , requestUrl = _url + (_version==="latest" ? "" : "/v"+_version) + endPoint + "?apiKey=" + _apiKey

        , requestVerb =  "delete";


        sendRequest(deferred, requestUrl, requestVerb);

        return deferred.promise;    

    }

    You may find more information on the GitHub repository for our Node JS API: https://github.com/jotform/jotform-api-nodejs 

    I hope this helps.