FormCrafts API

Authentication

FormCrafts uses API keys to authenticate users. You can find your keys on the Account page.

Authentication is done via HTTP basic auth. Your API key is the username, and password field should be left empty.

A simply ping would return your account email. Use this link in the browser, and use your API key as username and leave the password blank:

GET https://formcrafts.com/api/v1

# Authenticate request
$ curl https://formcrafts.com/api/v1/
  -u MYAPIKEY:
{
	"email": "example@formcrafts.com"
}

Get Forms

Fetch a list of forms on the account.

GET https://formcrafts.com/api/v1/forms

{
	"type": "forms",
	"total": 2,
	"page": 1,
	"hasMore": false,
	"data": [
		{
			"id": 123,
			"created_at": "2020-06-12 14:32:57",
			"updated_at": "2020-06-13 14:05:14",
			"name": "Contact Us",
			"counter": 145,
			"formLink": "https://formcrafts.com/api/v1/form/123",
			"responsesLink": "https://formcrafts.com/api/v1/form/123/responses"
		},
		{
			"id": 124,
			"created_at": "2019-12-01 14:56:16",
			"updated_at": "2019-12-09 17:12:51",			
			"name": "Annual Pig Rescue Fundraiser",
			"counter": 239,
			"formLink": "https://formcrafts.com/api/v1/form/124",
			"responsesLink": "https://formcrafts.com/api/v1/form/124/responses"
		},
	]
}

Get Form Info

Fetch form info, including fields

GET https://formcrafts.com/api/v1/form/[id]

{
	"id": "123",
	"created_at": "2019-12-01 14:56:16",
	"updated_at": "2019-12-09 17:12:51",
	"name": "Annual Pig Rescue Fundraiser",
	"counter": 239,
	"responsesLink": "https://formcrafts.com/api/v1/form/123/responses",
	"fields": [
		{
			"page_title": "Donation Page",
			"page_fields": [
				{
					"id": "field67",
					"label": "Your Name",
					"type": "one-line-text",
					"required": true
				},
				{
					"id": "field69",
					"label": "Donation Amount",
					"type": "dropdown",
					"required": true,
					"options": [
						{
							"value": "10",
							"label": "Ten Bucks"
						},
						{
							"value": "20",
							"label": "Twenty Bucks"
						},
						{
							"value": "100",
							"label": "All Yhe Way"
						}
					],
				}
			]
		}
	]
}

Get Responses

Fetch a list of responses on the form

GET https://formcrafts.com/api/v1/form/[id]/responses

{
	"type": "responses",
	"total": 1,
	"page": 1,
	"hasMore": false,
	"form_name": "Annual Pig Rescue Fundraiser",
	"data": [
		{
			"id": 1154,
			"created": "2020-06-15 18:42:35",
			"updated": "2020-06-15 18:42:35",
			"visitor": {
				"city": "Toronto",
				"division": "Ontario",
				"country": "Canada"
			},
			"metadata": null,
			"content": [
				{
					"id": "field67",
					"label": "Your Name",
					"answer": "Abu rahman"
				},
				{
					"id": "field69",
					"label": "Donation Amount",
					"answer": [
						"All The Way"
					],
					"answer.value": [
						100
					]
				}
			]
		},
	]
}

Certain fields have a value associated with the answer. Example, a checkbox field showing donut types would have the price of each donut as the value. In the above example this value is the answer.value object.

For file upload fields the answer.value object would contain a link to download the files.