tellform/public/swagger.json
2016-08-26 13:43:37 -07:00

689 lines
11 KiB
JSON

{
"swagger": "2.0",
"info": {
"version": "1.0.0",
"title": "TellForm API",
"contact": {
"name": "TellForm Team",
"url": "http://www.tellform.com"
}
},
"host": "api.tellform.com",
"basePath": "/api",
"schemes": [
"http"
],
"paths": {
"/forms": {
"get": {
"tags": [
"Form Operations"
],
"summary": "Finds all forms",
"responses": {
"405": {
"description": "Missing Form Input"
},
"400": {
"description": "Form is Invalid"
},
"404": {
"description": "Form not Found"
},
"200": {
"description": "forms response",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/Form"
}
},
"headers": {
"x-expires": {
"type": "string"
}
}
}
}
}
},
"/form/:form_id": {
"get": {
"tags": [
"Form Operations"
],
"summary": "Find form by ID",
"responses": {
"200": {
"description": "forms response",
"schema": {
"$ref": "#/definitions/Form"
},
"headers": {
"x-expires": {
"type": "string"
}
}
}
}
},
"post": {
"tags": [
"Form Operations"
],
"summary": "Create a new form",
"description": "Create and save a new form",
"operationId": "addForm",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"parameters": [
{
"in": "body",
"name": "form",
"description": "Form object that is to be created",
"required": true,
"schema": {
"$ref": "#/definitions/Form"
}
}
],
"responses": {
"405": {
"description": "Missing Form Input"
},
"400": {
"description": "Form is Invalid"
},
"404": {
"description": "Form not Found"
},
"200": {
"description": "successful operation",
"schema": {
"$ref": "#/definitions/Form"
}
}
},
"security": [
],
"x-code-samples": [
]
},
"put": {
"tags": [
"Form Operations"
],
"summary": "Update an existing form",
"description": "",
"operationId": "updateForm",
"consumes": [
"application/json",
"application/xml"
],
"produces": [
"application/xml",
"application/json"
],
"parameters": [
{
"in": "body",
"name": "form",
"description": "Form object that needs to be updated",
"required": true,
"schema": {
"$ref": "#/definitions/Form"
}
}
],
"responses": {
"405": {
"description": "Missing Form Input"
},
"400": {
"description": "Form is Invalid"
},
"404": {
"description": "Form not Found"
},
"200": {
"description": "successful operation",
"schema": {
"$ref": "#/definitions/Form"
}
}
},
"security": [
{
}
],
"x-code-samples": [
]
}
}
},
"definitions": {
"User": {
"type": "object",
"required": [
"language",
"email",
"username"
],
"properties": {
"id": {
"type": "string",
},
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
},
"language": {
"type": "string",
"enum": [
"en",
"fr",
"es",
"it",
"de"
],
"default": "en",
"required": "User must have a language"
},
"email": {
"type": "string",
"format": "email",
"required": "User email cannot be blank",
"unique": "true"
},
"username": {
"type": "string",
"required": "Username cannot be blank",
"unique": "true"
},
"passwordHash": {
"type": "string",
"default": ""
},
"salt": {
"type": "string"
},
"provider": {
"type": "string",
"required": "provider is required",
"default": "local"
},
"providerData": {
"type": "object"
},
"additionalProvidersData": {
"type": "object"
},
"roles": {
"type": "array",
"items": {
"type": "string",
"enum": [
"user",
"admin",
"superuser"
]
},
"default": [
"user"
]
}
},
"lastModified": {
"type": "date"
},
"created": {
"type": "date"
},
"resetPasswordToken": {
"type": "string"
},
"resetPasswordExpires": {
"type": "date"
},
"token": {
"type": "string"
},
"apiKey": {
"type": "string",
"unique": true,
"index": true,
"sparse": true
}
},
"LogicJump": {
"expressionString": {
"type": "string",
"enum": [
"field == static",
"field != static",
"field > static",
"field >= static",
"field <= static",
"field < static",
"field contains static",
"field !contains static",
"field begins static",
"field !begins static",
"field ends static",
"field !ends static"
]
},
"fieldA": {
$ref: "#/definitions/FormField",
},
"valueB": {
"type": "string"
},
"jumpTo": {
"$ref": "#/definitions/FormField",
}
},
"FieldOption": {
"type": "object",
"properties": {
"option_id": {
"type": "number"
},
"option_title": {
"type": "string"
},
"option_value": {
"type": "string",
"trim": true
}
}
},
"RatingField": {
"type": "object",
"properties": {
"steps": {
"type": "number",
"min": 1,
"max": 10
},
"shape": {
"type": "string",
"enum": [
"Heart",
"Star",
"thumbs-up",
"thumbs-down",
"Circle",
"Square",
"Check Circle",
"Smile Outlined",
"Hourglass",
"bell",
"Paper Plane",
"Comment",
"Trash"
]
},
"validShapes": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"FormField": {
"required": [
"title",
"fieldType"
],
"properties": {
"isSubmission": {
"type": "boolean",
"default": false
},
"submissionId": {
"type": "string"
},
"title": {
"type": "string",
"trim": true,
"required": "Field Title cannot be blank"
},
"description": {
"type": "string",
"default": ""
},
"logicJump": {
"$ref": "#/definitions/FormField"
},
"ratingOptions": {
"type": "#/definitions/RatingField",
},
"fieldOptions": {
"type": "array",
"items": "#/definitions/FieldOption"
},
"required": {
"type": "boolean",
"default": true
},
"disabled": {
"type": "boolean",
"default": false
},
"deletePreserved": {
"type": "boolean",
"default": false
},
"validFieldTypes": {
"type": "array",
"items": {
"type": "string"
}
},
"fieldType": {
"type": "string",
"required": true,
"enum": [
"textfield",
"date",
"email",
"link",
"legal",
"url",
"textarea",
"statement",
"welcome",
"thankyou",
"file",
"dropdown",
"scale",
"rating",
"radio",
"checkbox",
"hidden",
"yes_no",
"natural",
"stripe",
"number"
]
},
"fieldValue": {
"type": "string"
}
}
},
"VisitorData": {
"type": "object",
"properties": {
"referrer": {
"type": "string"
},
"lastActiveField": {
"type": "string"
},
"timeElapsed": {
"type": "number"
},
"isSubmitted": {
"type": "boolean"
},
"language": {
"type": "string"
},
"ipAddr": {
"type": "string",
"default": ""
},
"deviceType": {
"type": "string",
"enum": [
"desktop",
"phone",
"tablet",
"other"
],
"default": "other"
},
"userAgent": {
"type": "string"
}
}
},
"Button": {
"type": "object",
"properties": {
"url": {
"type": "string",
"format": "url"
},
"action": {
"type": "string"
},
"text": {
"type": "string"
},
"bgColor": {
"type": "string",
"pattern": "/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/",
"default": "5bc0de"
},
"color": {
"type": "string",
"pattern": "/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/",
"default": "#ffffff"
}
}
},
"FormSubmission": {
"type": "object",
"required": [
"language",
"admin",
"title"
],
"properties": {
"title": {
"type": "string",
"required": "Form Title cannot be blank"
},
"language": {
"type": "string",
"enum": [
"en",
"fr",
"es",
"it",
"de"
],
"default": "en",
"required": "Form must have a language"
},
"admin": {
"$ref": "#/definitions/User",
},
"ipAddr": {
"type": "string"
},
"geoLocation": {
"type": "object",
"properties": {
"Country": {
"type": "string"
},
"Region": {
"type": "string"
},
"City": {
"type": "string"
}
}
},
"device": {
"type": "object",
"properties": {
"type": {
"type": "string"
},
"name": {
"type": "string"
}
}
},
"pdfFilePath": {
"type": "string"
},
"pdf": {
"type": "string"
},
"timeElapsed": {
"type": "number"
},
"percentageComplete": {
"type": "number"
}
}
},
"Form": {
"type": "object",
"required": [
"language",
"admin",
"title"
],
"properties": {
"id": {
"type": "string",
},
"title": {
"type": "string",
"required": "Form Title cannot be blank"
},
"language": {
"type": "string",
"enum": [
"en",
"fr",
"es",
"it",
"de"
],
"default": "en",
"required": "Form must have a language"
},
"analytics": {
"type": "object",
"properties": {
"gaCode": {
"type": "string"
},
"visitors": {
"type": "array",
"items": {
"type": "#/definitions/VisitorData"
}
}
}
},
"form_fields": {
"type": "array",
"items": "#/definitions/FormField"
},
"submissions": {
"type": "array",
"items": {
"$ref": "#/definitions/FormSubmission"
}
},
"admin": {
"$ref": "#/definitions/User"
},
"pdf": {
"type": "object"
},
"pdfFieldMap": {
"type": "object"
},
"startPage": {
"properties": {
"showStart": {
"type": "boolean",
"default": false
},
"introTitle": {
"type": "string",
"default": "Welcome to Form"
},
"introParagraph": {
"type": "string"
},
"introButtonText": {
"type": "string",
"default": "Start"
},
"buttons": {
"type": "array",
"items": "#/definitions/Button"
}
}
},
"hideFooter": {
"type": "boolean",
"default": false
},
"isGenerated": {
"type": "boolean",
"default": false
},
"isLive": {
"type": "boolean",
"default": false
},
"autofillPDFs": {
"type": "boolean",
"default": false
},
"design": {
"colors": {
"backgroundColor": {
"type": "string",
"pattern": "/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/",
"default": "#fff"
},
"questionColor": {
"type": "string",
"match": "/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/",
"default": "#333"
},
"answerColor": {
"type": "string",
"match": "/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/",
"default": "#333"
},
"buttonColor": {
"type": "string",
"match": "/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/",
"default": "#fff"
},
"buttonTextColor": {
"type": "string",
"pattern": "/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/",
"default": "#333"
}
},
"font": "string"
}
}
}
}
}