Skip to main content

Forms samples

You'll find here PHP code samples.

If cURL doesn't actually work in your environment, this could help you to install it.

Here is an example of a HTTP request to get the list of all forms :


<?php

// Initialisation of the request
$curl = curl_init();

// Definition of the Headers
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://forms.kizeo.com/rest/v3/forms/',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"Authorization: YOUR_TOKEN",
"cache-control: no-cache",
"content-type: application/json"
),
));

// Send request and show response
$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}

The following example shows how to get details of a chosen form


<?php

$formId;
// Initialisation of the request
$curl = curl_init();

// Definition of the Headers
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://forms.kizeo.com/rest/v3/forms/' . $formId,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"Authorization: YOUR_TOKEN",
"cache-control: no-cache",
"content-type: application/json"
),
));

// Send request and show response
$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}

You'll find here Java code samples.

Here is an example of a HTTP request to get the list of all forms :


OkHttpClient client = new OkHttpClient();

// Definition of request's parameters
Request request = new Request.Builder()
.url("https://forms.kizeo.com/rest/v3/forms/")
.get()
.addHeader("content-type", "application/json")
.addHeader("Authorization", "YOUR_TOKEN")
.addHeader("cache-control", "no-cache")
.build();

// Send request and show response
Response response = client.newCall(request).execute();

The following example shows how to get details of a chosen form


string formId;
OkHttpClient client = new OkHttpClient();

// Definition of request's parameters
Request request = new Request.Builder()
.url("https://forms.kizeo.com/rest/v3/forms/" . formId)
.get()
.addHeader("content-type", "application/json")
.addHeader("Authorization", "YOUR_TOKEN")
.addHeader("cache-control", "no-cache")
.build();

// Send request and show response
Response response = client.newCall(request).execute();

You'll find here Javascript code samples.

Here is an example of a HTTP request to get the list of all forms :

// Definition of request's parameters
var settings = {
async: true,
crossDomain: true,
url: "https://forms.kizeo.com/rest/v3/forms/",
method: "GET",
headers: {
"content-type": "application/json",
Authorization: "YOUR_TOKEN",
"cache-control": "no-cache",
},
};

// Send request and show response
$.ajax(settings).done(function (response) {
console.log(response);
});

The following example shows how to get details of a chosen form

var formId;
// Definition of request's parameters
var settings = {
async: true,
crossDomain: true,
url: "https://forms.kizeo.com/rest/v3/forms/".formID,
method: "GET",
headers: {
"content-type": "application/json",
Authorization: "YOUR_TOKEN",
"cache-control": "no-cache",
},
};

// Send request and show response
$.ajax(settings).done(function (response) {
console.log(response);
});