Installation

  • Download the zipped project from downloads page or clone the git repository to your computer.
  • Once you have the project folder in your system, launch Eclipse, click File -> Import.
  • Select "Existing Android Code Into Workspace", browse to the project folder and click finish.
  • Right click on you own android project (the one that you want to use the library with) and click properties.
  • Click "Android" tab and add "jotform-api-android" project using the Add button in the Library section.

Sample Usage

Once you successfully added the library as a dependency to your project, you can use it in your Application as follows;

Examples

Print all forms of the user

package com.example;

import android.app.Activity;

// import Jotform client library
// and its reponse handler
import com.jotform.api.JotformAPIClient;
import com.loopj.android.http.JsonHttpResponseHandler;

public class MyActivity extends Avtivity{

    private JotformAPIClient apiClient;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);

        // this is for demonstration purposes only
        // you should not harcode API Keys, it is different for each user
        apiClient = new JotformAPIClient("API_KEY_GOES_HERE");

        apiClient.getForms(new JsonHttpHandler(){

            @Override
            public void onSuccess(JSONObject formsResponse){
                try {
                    forms = formsResponse.getJSONArray("content");

                    // do something with the forms jsonArray;

                } catch (JSONException e){
                    // fail
                }

            }
        });
    }
}

Get latest 100 submissions ordered by creation date

    public class MyActivity extends Avtivity{

    private JotformAPIClient apiClient;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);

        // this is for demonstration purposes only
        // you should not harcode API Keys, it is different for each user
        apiClient = new JotformAPIClient("API_KEY_GOES_HERE");

        apiClient.getSubmissions(100, null, new JsonHttpHandler(){

            @Override
            public void onSuccess(JSONObject submissionsResponse){
                try {
                    submissions = submissionsResponse.getJSONArray("content");

                    // do something with the submissions jsonArray;

                } catch (JSONException e){
                    // fail
                }

            }
        });
    }
}

Submission filter example

    public class MyActivity extends Avtivity{

    private JotformAPIClient apiClient;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);

        // this is for demonstration purposes only
        // you should not harcode API Keys, it is different for each user
        apiClient = new JotformAPIClient("API_KEY_GOES_HERE");

        HashMap<String, String> filter = new HashMap<String, String>();
        filter.put("status", "ACTIVE");
        filter.put("flag", "0");
        filter.put("updated_at", "2013-06-24 08:17:44");

        JSONObject filterObject = new JSONObject(filter);

        apiClient.getSubmissions(100, "created_at", filterObject, new JsonHttpHandler(){

            @Override
            public void onSuccess(JSONObject submissionsResponse){

                try {
                    submissions = submissionsResponse.getJSONArray("content");

                    // do something with the submissions jsonArray;

                } catch (JSONException e){
                    // fail
                }

            }
        });
    }
}

Delete Submission example

    public class MyActivity extends Avtivity{

    private JotformAPIClient apiClient;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);

        // this is for demonstration purposes only
        // you should not harcode API Keys, it is different for each user
        apiClient = new JotformAPIClient("API_KEY_GOES_HERE");

        long submissionId = SUBMISSION_ID

        apiClient.deleteSubmission(submissionId, new JsonHttpHandler(){

            @Override
            public void onSuccess(JSONObject submissionsResponse){

                try {

                    // do something with the submissions jsonArray;

                        } catch (JSONException e){
                    // fail
                }

            }
        });
    }
}

jotform-api-csharp

JotForm API - C# Client

Installation

Install via git clone:

    $ git clone git://github.com/jotform/jotform-api-csharp.git
    $ cd jotform-api-csharp

Documentation

You can find the docs for the API of this client at http://api.jotform.com/docs/

Authentication

JotForm API requires API key for all user related calls. You can create your API Keys at API section of My Account page.

Examples

Print all forms of the user

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using JotForm;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace JotFormTest
{
    class PrintFormList
    {
        static void Main(string[] args)
        {
            var client = new JotForm.APIClient("YOUR API KEY");

            var forms = client.getForms()["content"];

            var formTitles = from form in forms
                             select form.Value<string>("title");

            foreach (var item in formTitles)
            {
                Console.Out.WriteLine(item);
            }

            Console.ReadLine();
        }
    }
}

Get submissions of the latest form

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using JotForm;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace JotFormTest
{
    class PrintFormSubmissions
    {
        static void Main(string[] args)
        {
            var client = new JotForm.APIClient("YOUR API KEY");

            var forms = client.getForms(0, 1, null, "")["content"];

            var latestForm = forms[0];

            var submissions = client.getFormSubmissons(Convert.ToInt64(latestForm["id"]));

            Console.Out.WriteLine(submissions);

            Console.ReadLine();
        }
    }
}

Get latest 100 submissions ordered by creation date

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using JotForm;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace JotFormTest
{
    class PrintLastSubmissions
    {
        static void Main(string[] args)
        {
            var client = new JotForm.APIClient("YOUR API KEY");

            var submissions = client.getSubmissions(0, 100, null, "created_at");

            Console.Out.WriteLine(submissions);

            Console.ReadLine();
        }
    }
}

Submission and form filter examples

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using JotForm;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace JotFormTest
{
    class Filters
    {
        static void Main(string[] args)
        {
            var client = new JotForm.APIClient("YOUR API KEY");

            Dictionary<String, String> submissionFilter = new Dictionary<string, string>();
            submissionFilter.Add("id:gt", "FORM ID");
            submissionFilter.Add("created_at:gt", "DATE");

            var submissions = client.getSubmissions(0, 0, submissionFilter, "");
            Console.Out.WriteLine(submissions);

            Dictionary<String, String> formFilter = new Dictionary<string, string>();
            formFilter.Add("id:gt", "FORM ID");

            var forms = client.getForms(0, 0, formFilter, "");
            Console.Out.WriteLine(forms);

            Console.ReadLine();
        }
    }
}

Delete last 50 submissions

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using JotForm;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace JotFormTest
{
    class DeleteSubmissions
    {
        static void Main(string[] args)
        {
            var client = new JotForm.APIClient("YOUR API KEY");

            var submissions = client.getSubmissions(0, 50, null, "")["content"];

            foreach (var submission in submissions)
            {
                var result = client.deleteSubmission(Convert.ToInt64(submission["id"]));
                Console.Out.WriteLine(result);
            }

            Console.ReadLine();
        }
    }
}

First the APIClient class is included from the jotform-api-csharp/APIClient.cs file. This class provides access to JotForm's API. You have to create an API client instance with your API key. In case of an exception (wrong authentication etc.), you can catch it or let it fail with a fatal error.

jotform-api-go

JotForm API - GO Client

Installation

Install via git clone:

    $ git clone git://github.com/jotform/jotform-api-go.git
    $ cd jotform-api-go

Documentation

You can find the docs for the API of this client at http://api.jotform.com/docs/

Authentication

JotForm API requires API key for all user related calls. You can create your API Keys at API section of My Account page.

Examples

Get latest 100 submissions ordered by creation date

package main

import (
        "jotform-api-go"
        "fmt"
)

func main() {

    jotformAPI := jotform.NewJotFormAPIClient("YOUR API KEY")

    submissions := jotformAPI.GetSubmissions("", "100", nil, "created_at")
    fmt.Println(string(submissions))
}

Submission and form filter examples

package main

import (
        "jotform-api-go"
        "fmt"
)

func main() {

    jotformAPI := jotform.NewJotFormAPIClient("YOUR API KEY")


    submissionFilter := map[string]string {
            "id:gt": "FORM ID",
            "created_at:gt": "DATE",
    }

    submissions := jotformAPI.GetSubmissions("", "", submissionFilter, "")
    fmt.Println(string(submissions))

    formFilter := map[string]string {
            "id:gt": "FORM ID",       
    }

    forms := jotformAPI.GetForm("", "", formFilter, "")
    fmt.Println(string(forms))
}

First the jotform package is imported from the jotform-api-go/JotForm.go file. This package provides access to JotForm's API. You have to create an API client instance with your API key. In case of an exception (wrong authentication etc.), you can catch it or let it fail with a fatal error.

jotform-api-ios

JotForm API - iOS

Installation

Download the zipped project from downloads page or clone the git repository to your computer.

  $ git clone git://github.com/jotform/jotform-api-ios.git
  $ cd jotform-api-ios

Please open the project and select target "JotForm-Universal" and build it and select "Products/libJotForm.a" and click mouse-right button and click "Show in Finder" Please look all the files in "Release-iphoneuniversal" directory and copy all the files and add them to you project. All libraries that we use are as following:

  * ASIHTTPRequest
  * SBJson

If you have build conflicts with any of the libraries above, you have the choice of either removing the the particular library from ExternalLib/XXX.m and .h, or you can remove the conflicting files from your app.

Documentation

You can find the docs for the API of this client at http://api.jotform.com/docs/

Examples

Print all forms of the user

#import <JotForm/JotForm.h>

JotForm *jotform;

jotform = [[JotForm alloc] initWithApiKey:"Your API KEY" debugMode:NO];
jotform.delegate = self;

[jotform setDidFinishSelector:@selector(getFormsFinish:)];
[jotform setDidFailSelector:@selector(getFormsFail:)];
[jotform getForms];

// get successfully forms
- (void) getFormsFinish : (id) result
{
    NSLog(@"response = %@", result);
}

// there was an error getting forms
- (void) getFormsFail : (id) error
{
    NSLog(@"response = %@", result);
}

Get latest 100 submissions ordered by creation date

#import <JotForm/JotForm.h>

JotForm *jotform;

jotform = [[JotForm alloc] initWithApiKey:"Your API KEY" debugMode:NO];
jotform.delegate = self;

[jotform setDidFinishSelector:@selector(getSubmissionsFinish:)];
[jotform setDidFailSelector:@selector(getSubmissionsFail:)];
[jotform getSubmissions:0 limit:100 orderBy:@"created_at" filter:nil];

// get successfully submissions
- (void) getSubmissionsFinish : (id) result
{
    NSLog(@"response = %@", result);
}

// there was an error getting submissions
- (void) getSubmissionsFail : (id) error
{
    NSLog(@"response = %@", result);
}

Submission filter examples

#import <JotForm/JotForm.h>

JotForm *jotform;

jotform = [[JotForm alloc] initWithApiKey:"Your API KEY" debugMode:NO];
jotform.delegate = self;


NSMutableDictionary *submissionFilter = [[NSMutableDictionary alloc] init];
[submissionFilter setObject:@"2013-08-06 21:10:08" forKey:@"created_at:gt"];

[jotform setDidFinishSelector:@selector(getSubmissionsFinish:)];
[jotform setDidFailSelector:@selector(getSubmissionsFail:)];
[jotform getSubmissions:0 limit:0 orderBy:nil filter:submissionFilter];

// get successfully submissions
- (void) getSubmissionsFinish : (id) result
{
    NSLog(@"response = %@", result);
}

// there was an error getting submissions
- (void) getSubmissionsFail : (id) error
{
    NSLog(@"response = %@", result);
}

Delete submission

#import <JotForm/JotForm.h>

JotForm *jotform;

jotform = [[JotForm alloc] initWithApiKey:"Your API KEY" debugMode:NO];
jotform.delegate = self;

[jotform setDidFinishSelector:@selector(deleteSubmissionFinish:)];
[jotform setDidFailSelector:@selector(deleteSubmissionFail:)];
[jotform deleteSubmission:32243555745860];

// deleted successfully submission
- (void) deleteSubmissionFinish : (id) result
{
    NSLog(@"response = %@", result);
}

// there was an error deleting submission
- (void) deleteSubmissionFail : (id) error
{
    NSLog(@"response = %@", result);
}

jotform-api-java

JotForm API - Java Client

Installation

Install via git clone:

    $ git clone git://github.com/jotform/jotform-api-java.git
    $ cd jotform-api-java

Documentation

You can find the docs for the API of this client at http://api.jotform.com/docs/

Authentication

JotForm API requires API key for all user related calls. You can create your API Keys at API section of My Account page.

Examples

Print all forms of the user

package com.jotform.api.samples;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import com.jotform.api.*;

public class PrintFormList {

    public static void main(String[] args) {

        JotForm client = new JotForm("YOUR API KEY");


        JSONObject formsResponse = client.getForms();

        try {
            JSONArray forms = formsResponse.getJSONArray("content");

            for (int i=0; i<forms.length(); i++){
                JSONObject form = forms.getJSONObject(i);

                System.out.println(form.get("title") + " (Total:" +form.get("count") + " New:" + form.get("new") + ")");
            }
        } catch (JSONException e) {
            e.printStackTrace();
        }

    }
}

Get submissions of the latest form

package com.jotform.api.samples;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import com.jotform.api.*;

public class LatestFormSubmissions {

    public static void main(String[] args) {

        JotForm client = new JotForm("YOUR API KEY");

        JSONObject formsResponse = client.getForms("", "1", null, "");

        try {
            JSONArray forms = formsResponse.getJSONArray("content");

            JSONObject latestForm = forms.getJSONObject(0);

            long latestFormID = Long.parseLong(latestForm.get("id").toString());

            JSONObject submissions = client.getFormSubmissions(latestFormID);

            System.out.println(submissions);

        } catch (JSONException e) {
            e.printStackTrace();
        }
    }
}

Get latest 100 submissions ordered by creation date

package com.jotform.api;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public class PrintLastSubmissions {


    public static void main(String[] args) {

        JotForm client = new JotForm("YOUR API KEY");

        JSONObject submissions = client.getSubmissions("", "100", null, "created_at");

        System.out.println(submissions);

    }

}

Submission and form filter examples

package com.jotform.api.samples;

import java.util.HashMap;

import org.json.JSONObject;
import com.jotform.api.*;

public class SubmissionFormFilters {

    public static void main(String[] args) {

        JotForm client = new JotForm("YOUR API KEY");

        HashMap<String, String> submissionFilter = new HashMap<String, String>();
        submissionFilter.put("id:gt", "FORM ID");
        submissionFilter.put("created_at:gt", "DATE");

        JSONObject submissions = client.getSubmissions("", "", submissionFilter, "");

        System.out.println(submissions);

        HashMap<String, String> formFilter = new HashMap<String, String>();
        formFilter.put("id:gt", "FORM ID");

        JSONObject forms = client.getForms("", "", formFilter, "");

        System.out.println(forms);
    }
}

Delete last 50 submissions

package com.jotform.api.samples;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import com.jotform.api.*;

public class Delete50Submissions {

    public static void main(String[] args) {

        JotForm client = new JotForm("YOUR API KEY");

        JSONObject submissionsResponse = client.getSubmissions("", "50", null, "");

        JSONArray submissions;
        try {
            submissions = submissionsResponse.getJSONArray("content");

            for (int i=0; i<submissions.length(); i++){
                JSONObject submission = submissions.getJSONObject(i);

                JSONObject result = client.deleteSubmission(Long.parseLong(submission.get("id").toString()));

                System.out.println(result);
            }
        } catch (JSONException e) {
            e.printStackTrace();
        }    
    }
}

First the JotForm class is included from the jotform-api-java/JotForm.java file. This class provides access to JotForm's API. You have to create an API client instance with your API key. In case of an exception (wrong authentication etc.), you can catch it or let it fail with a fatal error.

jotform-api-javascript

JotForm API - JavaScript Client

Installation

Copy and paste the script below to your page

<script src="http://js.jotform.com/JotForm.js"></script>

Documentation

You can find the docs for the API of this client at http://api.jotform.com/docs/

Authentication

JotForm API requires API key for all user related calls. You can create your API Keys at API section of My Account page.

Examples

Print all forms of the user


JF.getForms(function(response){
    /**
     successful response including user forms array
     *
     */
    for(var i=0; i<response.length; i++){
        document.write(response[i].title);
    }
});

Print all submissions of the user


JF.getSubmissions(function(response){
    /**
     successful response including user submissions data
     .
     */
    for(var i=0; i<response.length; i++){
        document.write(response[i].form_id);
    }    
});

See Documentation for full list of methods available

jotform-api-nodejs

JotForm API - NodeJS Client

Installation

npm install jotform

Documentation

You can find the docs for the API of this client at http://api.jotform.com/docs/

Authentication

JotForm API requires API key for all user related calls. You can create your API Keys at API section of My Account page.

Examples

var jotform = require("jotform")

jf.options({
    debug: true,
    apiKey: "YOUR_API_KEY"
});

jf.getUser()
.then(function(r){
    /* successful response after request */
})
.fail(function(e){
    /* handle error */
}

See Documentation for full list of methods available

jotform-api-php

JotForm API - PHP Client

Installation

Install via git clone:

    $ git clone git://github.com/jotform/jotform-api-php.git
    $ cd jotform-api-php

or

Install via Composer package manager (http://getcomposer.org/)

composer.json

    {
        "require": {
            "jotform/jotform-api-php": "dev-master"
        }
    }
    $ php composer.phar install

Documentation

You can find the docs for the API of this client at http://api.jotform.com/docs/

Authentication

JotForm API requires API key for all user related calls. You can create your API Keys at API section of My Account page.

Examples

Print all forms of the user

<?php

    include "jotform-api-php/JotForm.php";

    $jotformAPI = new JotForm("YOUR API KEY");
    $forms = $jotformAPI->getForms();

    foreach ($forms as $form) {
        print $form["title"];
    }

?>

Get submissions of the latest form

<?php

    try {
        include "jotform-api-php/JotForm.php";

        $jotformAPI = new JotForm("YOUR API KEY");

        $forms = $jotformAPI->getForms(0, 1, null, null);

        $latestForm = $forms[0];

        $latestFormID = $latestForm["id"];

        $submissions = $jotformAPI->getFormSubmissions($latestFormID);

        var_dump($submissions);

    }
    catch (Exception $e) {
        var_dump($e->getMessage());
    }

?>

Get latest 100 submissions ordered by creation date

<?php

    try {
        include "jotform-api-php/JotForm.php";

        $jotformAPI = new JotForm("YOUR API KEY");

        $submissions = $jotformAPI->getSubmissions(0, 100, null, "created_at");

        var_dump($submissions);
    }
    catch (Exception $e) {
        var_dump($e->getMessage());
    }

?>

Submission and form filter examples

<?php

    try {
        include "jotform-api-php/JotForm.php";

        $jotformAPI = new JotForm("YOUR API KEY");

        $filter = array(
                "id:gt" => "239252191641336722",
                "created_at:gt" => "2013-07-09 07:48:34",
        );

        $subs = $jotformAPI->getSubmissions(0, 0, $filter, "");
        var_dump($subs); 

        $filter = array(
                "id:gt" => "239176717911737253",
        );

        $formSubs = $jotformAPI->getForms(0, 0, 2, $filter);
        var_dump($formSubs);
    } catch (Exception $e) {
            var_dump($e->getMessage());
    }

?>

Delete last 50 submissions

<?php

    try {
        include "jotform-api-php/JotForm.php";

        $jotformAPI = new JotForm("YOUR API KEY");

        $submissions = $jotformAPI->getSubmissions(0, 50, null, null);

        foreach ($submissions as $submission) {
            $result = $jotformAPI->deleteSubmission($submission["id"]);
            print $result;
        }
    }
    catch (Exception $e) {
        var_dump($e->getMessage());
    }

?>

First the JotForm class is included from the jotform-api-php/JotForm.php file. This class provides access to JotForm's API. You have to create an API client instance with your API key. In case of an exception (wrong authentication etc.), you can catch it or let it fail with a fatal error.

jotform-api-python

JotForm API - Python Client

Installation

Install via git clone:

    $ git clone git://github.com/jotform/jotform-api-python.git
    $ cd jotform-api-python

Install via pip:

    $ pip install jotform

Install via pip (latest version)

    $ pip install git+git://github.com/jotform/jotform-api-python.git

Documentation

You can find the docs for the API of this client at http://api.jotform.com/docs/

Authentication

JotForm API requires API key for all user related calls. You can create your API Keys at API section of My Account page.

Examples

Print all forms of the user

from jotform import *

def main():

    jotformAPIClient = JotformAPIClient('YOUR API KEY')

    forms = jotformAPIClient.get_forms()

    for form in forms:
        print form["title"]

if __name__ == "__main__":
    main()

Get submissions of the latest form

from jotform import *

def main():

    jotformAPIClient = JotformAPIClient('YOUR API KEY')

    forms = jotformAPIClient.get_forms(None, 1, None, None)

    latestForm = forms[0]

    latestFormID = latestForm["id"]

    submissions = jotformAPIClient.get_form_submissions(latestFormID)

    print submissions

if __name__ == "__main__":
    main()

Get latest 100 submissions ordered by creation date

from jotform import *

def main():

    jotformAPIClient = JotformAPIClient('YOUR API KEY')

    submissions = jotformAPIClient.get_submissions(0, 100, None, "created_at")

    print submissions

if __name__ == "__main__":
    main()

Submission and form filter examples

from jotform import *

def main():

    jotformAPIClient = JotformAPIClient('YOUR API KEY')

    submission_filter = {"id:gt":"FORM ID", "created_at": "DATE"}

    submission = jotformAPIClient.get_submissions(0, 0, submission_filter, "") 
    print submission

    form_filter = {"id:gt": "FORM ID"}

    forms = jotformAPIClient.get_forms(0,0, form_filter, "")
    print forms

if __name__ == "__main__":
    main()

Delete last 50 submissions

from jotform import *

def main():

    jotformAPIClient = JotformAPIClient('YOUR API KEY')

    submissions = jotformAPIClient.get_submissions(0, 50, None, None)

    for submission in submissions:
        result = jotformAPIClient.delete_submission(submission["id"])
        print result

if __name__ == "__main__":
    main()

First the JotformAPIClient class is included from the jotform-api-python/jotForm.py file. This class provides access to JotForm's API. You have to create an API client instance with your API key. In case of an exception (wrong authentication etc.), you can catch it or let it fail with a fatal error.

jotform-api-ruby

JotForm API - Ruby Client

Installation

Install via git clone:

    $ git clone git://github.com/jotform/jotform-api-ruby.git
    $ cd jotform-api-ruby

Documentation

You can find the docs for the API of this client at http://api.jotform.com/docs/

Authentication

JotForm API requires API key for all user related calls. You can create your API Keys at API section of My Account page.

Examples

Print all forms of the user

#!/usr/bin/env ruby
require_relative 'JotForm'

jotform = JotForm.new("APIKey")
forms = jotform.getForms()

forms.each do |form|
    puts form["title"]
end

Get latest submissions of the user

#!/usr/bin/env ruby
require_relative 'JotForm'

jotform = JotForm.new("APIKey")
submissions = jotform.getSubmissions()

submissions.each do |submission|
    puts submission["created_at"] + " " 
    submission["answers"].each do | answer|
        puts "\t" + answer.join(" ")
    end
end

First the JotForm class is included from the jotform-api-ruby/JotForm.rb file. This class provides access to JotForm's API. You have to create an API client instance with your API key. In case of an exception (wrong authentication etc.), you can catch it or let it fail with a fatal error.

jotform-api-scala

JotForm API - Scala Client

Installation

Install via git clone:

    $ git clone git://github.com/jotform/jotform-api-scala.git
    $ cd jotform-api-scala

Documentation

You can find the docs for the API of this client at http://api.jotform.com/docs/

Authentication

JotForm API requires API key for all user related calls. You can create your API Keys at API section of My Account page.

Examples

Print all forms of the user

package com.jotform.api.samples

import com.jotform.api._
import org.json._

object PrintFormList {

  def main(args: Array[String]) {
    val client = new JotForm()
    client.setAPIKey("YOUR API KEY")

    val response: JSONObject = client.getForms()

    val forms: JSONArray = response.getJSONArray("content")

    for (i <- 0 until forms.length()){
        val form: JSONObject = forms.getJSONObject(i)

        println(form.get("title") + " (Total:" +form.get("count") + " New:" + form.get("new") + ")")
    }
  }
}

Get submissions of the latest form

package com.jotform.api.samples

import com.jotform.api._
import org.json._

object LatestFormSubmissions {

  def main(args: Array[String]) {
    val client = new JotForm()
    client.setAPIKey("YOUR API KEY")

    val response: JSONObject = client.getForms(0, 1, null, null)

    val forms: JSONArray = response.getJSONArray("content")

    val latestForm: JSONObject = forms.getJSONObject(0)

    val latestFormID: Long = latestForm.getLong("id")

    val submissions: JSONObject = client.getFormSubmissions(latestFormID)

    println(submissions)

  }
}

Get latest 100 submissions ordered by creation date

package com.jotform.api.samples

import com.jotform.api._
import org.json._

object Latest100Submissions {

  def main(args: Array[String]) {
    val client = new JotForm()
    client.setAPIKey("YOUR API KEY")

    val response: JSONObject = client.getSubmissions(0, 100, null, "created_at")

    println(response)

  }
}

Submission and form filter examples

package com.jotform.api.samples

import com.jotform.api._
import org.json._

object SubmissionFormFilters {

  def main(args: Array[String]) {
    val client = new JotForm()
    client.setAPIKey("YOUR API KEY")

    val submissionfilter = Map("id:gt" -> "244605793257787946", "created_at:gt" -> "2013-09-06 03:18:44")

    val submissions: JSONObject = client.getSubmissions(0, 0, submissionfilter, null)

    println(submissions)

    val formFilter = Map("id:gt" -> "32522773744962")

    val forms: JSONObject = client.getForms(0, 0, formFilter, null)

    println(forms)
  }
}

Delete last 50 submissions

package com.jotform.api.samples

import com.jotform.api._
import org.json._

object Delete50Submissions{

  def main(args: Array[String]) {
    val client = new JotForm()
    client.setAPIKey("YOUR API KEY")

    val response: JSONObject = client.getSubmissions(0, 2, null, null)

    val submissions = response.getJSONArray("content")

    for(i <- 0 until submissions.length()) {
      val submission: JSONObject = submissions.getJSONObject(i)

      val result: JSONObject = client.deleteSubmission(submission.getLong("id"))

      println(submission.getLong("id") + " deleted.")
    }

  }
}

First the JotForm class is included from the jotform-api-scala/JotForm.scala file. This class provides access to JotForm's API. You have to create an API client instance with your API key. In case of an exception (wrong authentication etc.), you can catch it or let it fail with a fatal error.