tellform/public/swagger.json
2017-04-20 21:36:40 -07:00

878 lines
18 KiB
JSON

{
"swagger": "2.0",
"info": {
"version": "1.0.0",
"title": "TellForm API",
"contact": {
"name": "TellForm Team",
"email": "team@tellform.com"
}
},
"externalDocs": {
"description": "Find out how to host your own TellForm instance.",
"url": "https://github.com/whitef0x0/tellform"
},
"host": "api.tellform.com",
"basePath": "/",
"schemes": [
"http",
"https"
],
"tags": [{
"name": "form",
"description": "Everything about your Forms"
},
{
"name": "user",
"description": "Everything about your Account"
}
],
"securityDefinitions": {
"api_key": {
"type": "apiKey",
"name": "apikey",
"in": "header"
}
},
"paths": {
"/forms": {
"get": {
"tags": [
"form"
],
"summary": "Find 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"
}
}
}
},
"security": [{
"api_key": [
]
}]
}
},
"/form/:form_id": {
"get": {
"tags": [
"form"
],
"summary": "Find form by ID",
"responses": {
"200": {
"description": "forms response",
"schema": {
"$ref": "#/definitions/Form"
},
"headers": {
"x-expires": {
"type": "string"
}
}
}
},
"security": [{
"api_key": [
]
}]
},
"post": {
"tags": [
"form"
],
"summary": "Create a new form",
"description": "Create and save a new form",
"operationId": "addForm",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"parameters": [{
"in": "body",
"name": "body",
"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": [{
"api_key": [
]
}],
"x-code-samples": [
]
},
"put": {
"tags": [
"form"
],
"summary": "Update an existing form",
"description": "",
"operationId": "updateForm",
"consumes": [
"application/json"
],
"produces": [
"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": [{
"api_key": [
]
}],
"x-code-samples": [
]
}
},
"/users/me": {
"get": {
"tags": [
"user"
],
"summary": "Retrieve current User",
"description": "",
"operationId": "getUser",
"produces": [
"application/json"
],
"responses": {
"500": {
"description": "Could not Update User"
},
"401": {
"description": "User is not Signed in"
},
"403": {
"description": "User is not Authorized"
},
"404": {
"description": "User does not exsit"
},
"200": {
"description": "successful operation",
"schema": {
"$ref": "#/definitions/User"
}
}
},
"security": [{
"api_key": [
]
}]
}
},
"/users": {
"put": {
"tags": [
"user"
],
"summary": "Update the current user",
"description": "",
"operationId": "updateUser",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"parameters": [{
"in": "body",
"name": "body",
"description": "User object that needs to be updated",
"required": true,
"schema": {
"$ref": "#/definitions/User"
}
}],
"responses": {
"500": {
"description": "Could not Update User"
},
"401": {
"description": "User is not Signed in"
},
"403": {
"description": "User is not Authorized"
},
"404": {
"description": "User does not exsit"
},
"200": {
"description": "successful operation",
"schema": {
"$ref": "#/definitions/User"
}
}
},
"security": [{
"api_key": [
]
}],
"x-code-samples": [
]
}
}
},
"definitions": {
"User": {
"type": "object",
"required": [
"language",
"email",
"username"
],
"properties": {
"firstName": {
"type": "string",
"description": "First name of User",
"example": "John"
},
"lastName": {
"type": "string",
"description": "First name of User",
"example": "Doe"
},
"language": {
"type": "string",
"enum": [
"en",
"fr",
"es",
"it",
"de"
],
"default": "en",
"required": "User must have a language",
"description": "Language of User (for internationalization)",
"example": "fr"
},
"email": {
"type": "string",
"format": "email",
"required": "User email cannot be blank",
"unique": "true",
"description": "Email of User",
"example": "john.doe@somewhere.com"
},
"username": {
"type": "string",
"required": "Username cannot be blank",
"unique": "true",
"description": "Username of User",
"example": "johndoe"
},
"roles": {
"type": "array",
"items": {
"type": "string",
"enum": [
"user",
"admin",
"superuser"
]
},
"default": [
"user"
],
"description": "Security Roles of User"
}
},
"lastModified": {
"type": "date",
"description": "Date that user was last modified",
"example": "2016-08-26T20:19:30.146Z"
},
"created": {
"type": "date",
"description": "Date that user was created on",
"example": "5dHuKJgeCZmFOdJTnmg0lrxApmz0tbbBrM59rTv4k79"
},
"resetPasswordToken": {
"type": "string",
"description": "Reset password token of User",
"example": "5dHuKJgeCZmFOdJTnmg0lrxApmz0tbbBrM59rTv4k79"
},
"resetPasswordExpires": {
"type": "date",
"example": "2016-08-26T20:19:30.146Z",
"description": "Date that the User's password reset token expires"
},
"token": {
"type": "string",
"description": "Verification token of User",
"example": "5dHuKJgeCZmFOdJTnmg0lrxApmz0tbbBrM59rTv4k79"
},
"apiKey": {
"type": "string",
"unique": true,
"index": true,
"sparse": true,
"description": "API Key of User",
"example": "5dHuKJgeCZmFOdJTnmg0lrxApmz0tbbBrM59rTv4k79"
}
},
"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,
"description": "Specifies whether Field is part of a Submission or not",
"example": true
},
"submissionId": {
"type": "string",
"description": "ID of Submission that this Field belongs to",
"example": "57bca0969ca8e18b825bcc2b"
},
"title": {
"type": "string",
"trim": true,
"required": "Field Title cannot be blank",
"description": "Description of Field",
"example": "Your Current University"
},
"description": {
"type": "string",
"default": "",
"description": "Description of Field",
"example": "Please do not use abbreviations for your school name"
},
"logicJump": {
"$ref": "#/definitions/FormField"
},
"ratingOptions": {
"type": "#/definitions/RatingField"
},
"fieldOptions": {
"type": "array",
"items": {
"type": "FieldOption"
}
},
"required": {
"type": "boolean",
"default": true,
"description": "Specifies whether Field is required",
"example": true
},
"disabled": {
"type": "boolean",
"default": false,
"description": "Specifies whether Field is disabled",
"example": true
},
"deletePreserved": {
"type": "boolean",
"default": false,
"description": "Specifies whether Field should be preserved if it is deleted",
"example": 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"
],
"description": "Type of Field",
"example": "textfield"
},
"fieldValue": {
"type": "string",
"description": "Value of Field",
"example": "University of British Columbia"
}
}
},
"VisitorData": {
"type": "object",
"properties": {
"referrer": {
"type": "string",
"description": "Referring site of Form Visitor",
"example": "http://google.com"
},
"lastActiveField": {
"type": "string",
"description": "ID of Last Active Field",
"example": "57bca0969ca8e18b825bcc2b"
},
"timeElapsed": {
"type": "number",
"description": "Time Elasped for Visitor on Form (in seconds)",
"example": "333.33"
},
"isSubmitted": {
"type": "boolean",
"description": "Specifies whether user submitted form before leaving page",
"example": false
},
"language": {
"type": "string",
"description": "Language of User using form",
"example": "en"
},
"ipAddr": {
"type": "string",
"default": "",
"description": "IP Address of User",
"example": "324.332.322.333"
},
"deviceType": {
"type": "string",
"enum": [
"desktop",
"phone",
"tablet",
"other"
],
"default": "other",
"description": "Device Type of User",
"example": "phone"
},
"userAgent": {
"type": "string",
"description": "User Agent of User",
"example": "Mozilla/5.0 (Linux; <Android Version>; <Build Tag etc.>) AppleWebKit/<WebKit Rev> (KHTML, like Gecko) Chrome/<Chrome Rev> Mobile Safari/<WebKit Rev>"
}
}
},
"Button": {
"type": "object",
"properties": {
"url": {
"type": "string",
"format": "url",
"description": "URL of Button Link",
"example": "http://you-are-awesome.com"
},
"action": {
"type": "string",
"description": "Angular Action fired during Button click",
"example": "openModal()"
},
"text": {
"type": "string",
"description": "Text of Button",
"example": "Go to HomePage"
},
"bgColor": {
"type": "string",
"pattern": "/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/",
"default": "#5bc0de",
"description": "Background Color of Button (in hex)",
"example": "#5bc0de"
},
"color": {
"type": "string",
"pattern": "/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/",
"default": "#ffffff",
"description": "Font Color of Button (in hex)",
"example": "#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": {
"title": {
"type": "string",
"required": "Form Title cannot be blank",
"description": "Public Title of Form",
"example": "UBC CPSC221 Course Waitlist Form"
},
"language": {
"type": "string",
"enum": [
"en",
"fr",
"es",
"it",
"de"
],
"default": "en",
"required": "Form must have a language",
"description": "Language of Form",
"example": "en"
},
"analytics": {
"type": "object",
"description": "Analytics of Form",
"properties": {
"gaCode": {
"type": "string",
"description": "Analytics of Form",
"example": "UA-000000-01"
},
"visitors": {
"type": "array",
"items": {
"type": "#/definitions/VisitorData"
}
}
}
},
"form_fields": {
"type": "array",
"items": {
"type": "FormField"
}
},
"submissions": {
"type": "array",
"items": {
"$ref": "#/definitions/FormSubmission"
}
},
"admin": {
"type": "User",
"description": "User that this Form belongs to"
},
"startPage": {
"type": "object",
"properties": {
"showStart": {
"type": "boolean",
"default": false,
"description": "Specifies whether Form StarPage should be displayed",
"example": false
},
"introTitle": {
"type": "string",
"default": "Welcome to Form",
"description": "Title of Form's StartPage",
"example": "Welcome to our Awesome Form!"
},
"introParagraph": {
"type": "string",
"description": "Introduction paragraph for Form's StartPage.",
"example": "Welcome to our Awesome Form!"
},
"introButtonText": {
"type": "string",
"default": "Start",
"description": "StartPage Continue Button",
"example": "Continue"
},
"buttons": {
"type": "array",
"items": {
"type": "Button"
}
}
}
},
"hideFooter": {
"type": "boolean",
"default": false,
"description": "Specifies whether to hide or show Form Footer",
"example": true
},
"isLive": {
"type": "boolean",
"default": false,
"description": "Specifies whether form is Publically available or Private",
"example": true
},
"design": {
"type": "object",
"properties": {
"colors": {
"type": "object",
"properties": {
"backgroundColor": {
"type": "string",
"pattern": "/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/",
"default": "#fff",
"description": "Background color of Form",
"example": "#4c4c4c"
},
"questionColor": {
"type": "string",
"match": "/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/",
"default": "#333",
"description": "Question text font color (in hex)",
"example": "#fff"
},
"answerColor": {
"type": "string",
"match": "/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/",
"default": "#333",
"description": "Answer text font color (in hex)",
"example": "#f9f9f9"
},
"buttonColor": {
"type": "string",
"match": "/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/",
"default": "#fff",
"description": "Background color of Form Buttons (in hex)",
"example": "#555"
},
"buttonTextColor": {
"type": "string",
"pattern": "/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/",
"default": "#333",
"description": "Font color of Form Buttons (in hex)",
"example": "#fff"
}
}
},
"font": {
"type": "string"
}
}
}
}
}
}
}