{
    "swagger": "2.0",
    "x-navigateMethodsByName": true,
    "info": {
        "description": "This is the specification for our VisitReport REST API.",
        "version": "0.1.0",
        "title": "VisitReport REST API",
        "termsOfService": "https://www.snapaddy.com/de/agb.html",
        "contact": {
            "email": "info@snapaddy.com"
        },
        "license": {
            "name": "Apache 2.0",
            "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
        }
    },
    "host": "api.snapaddy.com",
    "basePath": "/visitreport/v1",
    "tags": [{
        "name": "questionnaire",
        "description": "Questionnaire"
    }, {
        "name": "group",
        "description": "Group"
    }, {
        "name": "question",
        "description": "Question"
    }, {
        "name": "questionOption",
        "description": "QuestionOption"
    }, {
        "name": "participant",
        "description": "Participant"
    }, {
        "name": "answer",
        "description": "Answer"
    }, {
        "name": "answerOption",
        "description": "AnswerOption"
    }, {
        "name": "attachment",
        "description": "Attachment"
    }],
    "schemes": ["https"],
    "paths": {
        "/attachment/{questionnaireId}/{participantId}/{attachmentId}": {
            "get": {
                "tags": ["attachment"],
                "summary": "Retrieve attachments of questionnaire participants",
                "description": "Retrieve attachments of questionnaire participants such as participant photos.",
                "operationId": "getParticipantAttachment",
                "produces": ["application/pdf", "image/png", "image/jpeg", "image/gif", "image/bmp"],
                "parameters": [{
                  "name": "questionnaireId",
                  "in": "path",
                  "description": "Id of the questionnaire",
                  "required": true,
                  "type": "string"
                }, {
                    "name": "participantId",
                    "in": "path",
                    "description": "Id of the participant to retrieve attachments for",
                    "required": true,
                    "type": "string"
                }, {
                    "name": "attachmentId",
                    "in": "path",
                    "description": "Id of the attachment to retrieve",
                    "required": true,
                    "type": "string"
                }],
                "responses": {
                    "200": {
                        "description": "Success"
                    },
                    "401": {
                        "description": "Unauthorized"
                    },
                    "404": {
                        "description": "Not Found"
                    }
                }
            }
        },
        "/backend/questionnaires/all": {
            "get": {
                "tags": ["questionnaire"],
                "summary": "Get all questionnaires",
                "description": "Retrieves all questionnaires",
                "operationId": "getAllQuestionnaires",
                "produces": ["application/json"],
                "parameters": [{
                    "name": "limit",
                    "in": "query",
                    "description": "Limit parameter",
                    "required": false,
                    "type": "integer",
                    "default": 0
                }, {
                    "name": "page",
                    "in": "query",
                    "description": "Page parameter",
                    "required": false,
                    "type": "integer",
                    "default": 0
                }, {
                    "name": "finalizedOnly",
                    "in": "query",
                    "description": "Only select finalized questionnaires",
                    "required": false,
                    "type": "boolean",
                    "default": false
                }, {
                    "name": "order",
                    "in": "query",
                    "description": "A comma-separated string of sorting column and sorting order",
                    "required": false,
                    "type": "string"
                }, {
                    "name": "filter",
                    "in": "query",
                    "description": "Filter by the state of a questionnaire",
                    "required": false,
                    "type": "string",
                    "enum": ["archived", "finalized", "drafts"]
                }, {
                    "name": "search",
                    "in": "query",
                    "description": "Search for this substring in the questionnaire's default title",
                    "required": false,
                    "type": "string"
                }],
                "responses": {
                    "200": {
                        "description": "Success",
                        "schema": {
                            "type": "array",
                            "items": {
                                "$ref": "#/definitions/Questionnaire"
                            }
                        }
                    }
                }
            }
        },
        "/backend/questionnaires/{questionnaireId}": {
            "get": {
                "tags": ["questionnaire"],
                "summary": "Get a questionnaire by id",
                "description": "Retrieves a single questionnaire by its id.",
                "operationId": "getQuestionnaire",
                "produces": ["application/json"],
                "parameters": [{
                    "name": "questionnaireId",
                    "in": "path",
                    "description": "ID of the questionnaire",
                    "required": true,
                    "type": "integer"
                }],
                "responses": {
                    "200": {
                        "description": "Success",
                        "schema": {
                            "$ref": "#/definitions/Questionnaire"
                        }
                    },
                    "401": {
                        "description": "Unauthorized",
                        "schema": {
                            "$ref": "#/definitions/401Error"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/404Error"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/500Error"
                        }
                    }
                }
            }
        },
        "/backend/questionnaires/{questionnaireId}/participants/all": {
            "get": {
                "tags": ["questionnaire"],
                "summary": "Get all participants for a single questionnaire",
                "description": "Retrieves all participants of a single questionnaire",
                "operationId": "getParticipantsForQuestionnaire",
                "produces": ["application/json"],
                "parameters": [{
                    "name": "questionnaireId",
                    "in": "path",
                    "description": "ID of the questionnaire",
                    "required": true,
                    "type": "integer"
                }, {
                    "name": "limit",
                    "in": "query",
                    "description": "Limit parameter",
                    "required": false,
                    "type": "integer",
                    "default": 0
                }, {
                    "name": "page",
                    "in": "query",
                    "description": "Page parameter",
                    "required": false,
                    "type": "integer",
                    "default": 0
                }, {
                    "name": "filter",
                    "in": "query",
                    "description": "Filter by the state of a participant",
                    "required": false,
                    "type": "string",
                    "enum": ["checked", "not-checked", "export-failed", "exported", "not-exported"]
                }],
                "responses": {
                    "200": {
                        "description": "Success",
                        "schema": {
                            "title": "All",
                            "properties": {
                                "questionnaires": {
                                    "type": "array",
                                    "items": {
                                        "$ref": "#/definitions/Questionnaire"
                                    }
                                },
                                "groups": {
                                    "type": "array",
                                    "items": {
                                        "$ref": "#/definitions/Group"
                                    }
                                },
                                "questions": {
                                    "type": "array",
                                    "items": {
                                        "$ref": "#/definitions/Question"
                                    }
                                },
                                "questionOptions": {
                                    "type": "array",
                                    "items": {
                                        "$ref": "#/definitions/QuestionOption"
                                    }
                                },
                                "participants": {
                                    "type": "array",
                                    "items": {
                                        "$ref": "#/definitions/Participant"
                                    }
                                },
                                "answers": {
                                    "type": "array",
                                    "items": {
                                        "$ref": "#/definitions/Answer"
                                    }
                                },
                                "answerOptions": {
                                    "type": "array",
                                    "items": {
                                        "$ref": "#/definitions/AnswerOption"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthorized",
                        "schema": {
                            "$ref": "#/definitions/401Error"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/404Error"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/500Error"
                        }
                    }
                }
            }
        },
        "/group/{groupId}": {
            "get": {
                "tags": ["group"],
                "summary": "Get a group by id",
                "description": "Retrieves a single group by its id.",
                "operationId": "getGroup",
                "produces": ["application/json"],
                "parameters": [{
                    "name": "groupId",
                    "in": "path",
                    "description": "ID of the group",
                    "required": true,
                    "type": "string"
                }],
                "responses": {
                    "200": {
                        "description": "Success",
                        "schema": {
                            "$ref": "#/definitions/Group"
                        }
                    },
                    "401": {
                        "description": "Unauthorized",
                        "schema": {
                            "$ref": "#/definitions/401Error"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/404Error"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/500Error"
                        }
                    }
                }
            }
        },
        "/question/{questionId}": {
            "get": {
                "tags": ["question"],
                "summary": "Get a question by id",
                "description": "Retrieves a single question by its id.",
                "operationId": "getQuestion",
                "produces": ["application/json"],
                "parameters": [{
                    "name": "questionId",
                    "in": "path",
                    "description": "ID of the question",
                    "required": true,
                    "type": "string"
                }],
                "responses": {
                    "200": {
                        "description": "Success",
                        "schema": {
                            "$ref": "#/definitions/Question"
                        }
                    },
                    "401": {
                        "description": "Unauthorized",
                        "schema": {
                            "$ref": "#/definitions/401Error"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/404Error"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/500Error"
                        }
                    }
                }
            }
        },
        "/questionOption/{questionOptionId}": {
            "get": {
                "tags": ["questionOption"],
                "summary": "Get a questionOption by id",
                "description": "Retrieves a single questionOption by its id.",
                "operationId": "getQuestionOption",
                "produces": ["application/json"],
                "parameters": [{
                    "name": "questionOptionId",
                    "in": "path",
                    "description": "ID of the questionOption",
                    "required": true,
                    "type": "string"
                }],
                "responses": {
                    "200": {
                        "description": "Success",
                        "schema": {
                            "$ref": "#/definitions/QuestionOption"
                        }
                    },
                    "401": {
                        "description": "Unauthorized",
                        "schema": {
                            "$ref": "#/definitions/401Error"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/404Error"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/500Error"
                        }
                    }
                }
            }
        },
        "/participant/{participantId}": {
            "get": {
                "tags": ["participant"],
                "summary": "Get a participant by id",
                "description": "Retrieves a single participant by its id.",
                "operationId": "getParticipant",
                "produces": ["application/json"],
                "parameters": [{
                    "name": "participantId",
                    "in": "path",
                    "description": "ID of the participant",
                    "required": true,
                    "type": "string"
                }],
                "responses": {
                    "200": {
                        "description": "Success",
                        "schema": {
                            "$ref": "#/definitions/Participant"
                        }
                    },
                    "401": {
                        "description": "Unauthorized",
                        "schema": {
                            "$ref": "#/definitions/401Error"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/404Error"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/500Error"
                        }
                    }
                }
            }
        },
        "/answer/{answerId}": {
            "get": {
                "tags": ["answer"],
                "summary": "Get a answer by id",
                "description": "Retrieves a single answer by its id.",
                "operationId": "getAnswer",
                "produces": ["application/json"],
                "parameters": [{
                    "name": "answerId",
                    "in": "path",
                    "description": "ID of the answer",
                    "required": true,
                    "type": "string"
                }],
                "responses": {
                    "200": {
                        "description": "Success",
                        "schema": {
                            "$ref": "#/definitions/Answer"
                        }
                    },
                    "401": {
                        "description": "Unauthorized",
                        "schema": {
                            "$ref": "#/definitions/401Error"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/404Error"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/500Error"
                        }
                    }
                }
            }
        },
        "/answerOption/{answerOptionId}": {
            "get": {
                "tags": ["answerOption"],
                "summary": "Get a answerOption by id",
                "description": "Retrieves a single answerOption by its id.",
                "operationId": "getAnswerOption",
                "produces": ["application/json"],
                "parameters": [{
                    "name": "answerOptionId",
                    "in": "path",
                    "description": "ID of the answerOption",
                    "required": true,
                    "type": "string"
                }],
                "responses": {
                    "200": {
                        "description": "Success",
                        "schema": {
                            "$ref": "#/definitions/AnswerOption"
                        }
                    },
                    "401": {
                        "description": "Unauthorized",
                        "schema": {
                            "$ref": "#/definitions/401Error"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/404Error"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/500Error"
                        }
                    }
                }
            }
        }
    },
    "securityDefinitions": {
        "api_key": {
            "type": "apiKey",
            "name": "X-API-Token",
            "in": "header"
        }
    },
    "security": [{
        "api_key": []
    }],
    "definitions": {
        "Questionnaire": {
            "description": "The Questionnaire entity",
            "title": "Questionnaire",
            "properties": {
                "id": {
                    "type": "string",
                    "readOnly": true
                },
                "mappingId": {
                    "type": "string",
                    "readOnly": true
                },
                "titles": {
                    "$ref": "#/definitions/StringDictionary"
                },
                "descriptions": {
                    "$ref": "#/definitions/StringDictionary"
                },
                "languages": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "organizationId": {
                    "type": "string",
                    "readOnly": true
                },
                "createdByUserId": {
                    "type": "string",
                    "readOnly": true
                },
                "url": {
                    "type": "string"
                },
                "logo": {
                    "type": "string",
                    "description": "Base64 representation of the logo"
                },
                "participantCounter": {
                    "type": "integer",
                    "readOnly": true
                },
                "finalized": {
                    "type": "boolean"
                },
                "archived": {
                    "type": "boolean"
                },
                "settings": {
                    "$ref": "#/definitions/RulesDictionary"
                }
            }
        },
        "Group": {
            "description": "The Group entity",
            "title": "Group",
            "properties": {
                "id": {
                    "type": "string",
                    "readOnly": true
                },
                "titles": {
                    "$ref": "#/definitions/StringDictionary"
                },
                "questionnaireId": {
                    "type": "integer",
                    "readOnly": true
                },
                "sequenceNumber": {
                    "type": "integer"
                }
            }
        },
        "Question": {
            "description": "The Question entity",
            "title": "Question",
            "properties": {
                "id": {
                    "type": "string",
                    "readOnly": true
                },
                "mappingId": {
                    "type": "string",
                    "readOnly": true
                },
                "groupId": {
                    "type": "string",
                    "readOnly": true
                },
                "sequenceNumber": {
                    "type": "integer"
                },
                "column": {
                    "type": "integer"
                },
                "questionType": {
                    "type": "integer"
                },
                "texts": {
                    "$ref": "#/definitions/StringDictionary"
                },
                "settings": {
                    "$ref": "#/definitions/RulesDictionary",
                    "description": "asdf"
                }
            }
        },
        "QuestionOption": {
            "description": "The QuestionOption entity",
            "title": "QuestionOption",
            "properties": {
                "id": {
                    "type": "string",
                    "readOnly": true
                },
                "mappingId": {
                    "type": "string",
                    "readOnly": true
                },
                "questionId": {
                    "type": "string",
                    "readOnly": true
                },
                "questionOptionType": {
                    "type": "integer"
                },
                "sequenceNumber": {
                    "type": "integer"
                },
                "texts": {
                    "$ref": "#/definitions/StringDictionary"
                },
                "value": {
                    "type": "string"
                },
                "validation": {
                    "$ref": "#/definitions/ValidationDictionary"
                }
            }
        },
        "Participant": {
            "description": "The Participant entity",
            "title": "Participant",
            "properties": {
                "id": {
                    "type": "string"
                },
                "created": {
                    "type": "string",
                    "description": "UTC timestamp of creation"
                },
                "firstName": {
                    "type": "string"
                },
                "lastName": {
                    "type": "string"
                },
                "organization": {
                    "type": "string"
                },
                "email": {
                    "type": "string"
                },
                "phone": {
                    "type": "string"
                },
                "bcImage": {
                    "type": "string"
                },
                "bcImageBackside": {
                    "type": "string"
                },
                "bcImageLocal": {
                    "type": "string"
                },
                "bcImageBacksideLocal": {
                    "type": "string"
                },
                "bcChecked": {
                    "type": "string"
                },
                "createdByUserId": {
                    "type": "string",
                    "readOnly": true
                },
                "drawing": {
                    "type": "string"
                },
                "image": {
                    "type": "string"
                },
                "note": {
                    "type": "string"
                },
                "gender": {
                    "type": "number"
                },
                "title": {
                    "type": "string"
                },
                "position": {
                    "type": "string"
                },
                "mobile": {
                    "type": "string"
                },
                "fax": {
                    "type": "string"
                },
                "website": {
                    "type": "string"
                },
                "vat": {
                    "type": "string"
                },
                "street": {
                    "type": "string"
                },
                "city": {
                    "type": "string"
                },
                "zip": {
                    "type": "string"
                },
                "poBox": {
                    "type": "string"
                },
                "state": {
                    "type": "string"
                },
                "country": {
                    "type": "string"
                },
                "xing": {
                    "type": "string"
                },
                "linkedin": {
                    "type": "string"
                },
                "facebook": {
                    "type": "string"
                },
                "twitter": {
                    "type": "string"
                },
                "attachments": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "type": {
                    "type": "string"
                },
                "fail": {
                    "type": "boolean"
                },
                "sequenceNumber": {
                    "type": "integer"
                },
                "snapaddyParserResponseText": {
                    "type": "string"
                },
                "orientation": {
                    "type": "string"
                },
                "failInternet": {
                    "type": "boolean"
                },
                "qrScan": {
                    "type": "boolean"
                },
                "questionnaireId": {
                    "type": "string"
                },
                "finished": {
                    "type": "boolean"
                },
                "exportedToExcel": {
                    "type": "boolean"
                },
                "exportedToIntegration": {
                    "type": "boolean"
                },
                "checked": {
                    "type": "boolean"
                },
                "checkedBy": {
                    "type": "string"
                },
                "checkedAt": {
                    "type": "string"
                },
                "imageLocal": {
                    "type": "string"
                },
                "isParentParticipant": {
                    "type": "boolean"
                },
                "isDeprecatedTypeOfParticipant": {
                    "type": "boolean"
                },
                "childrenSequenceNumberCounter": {
                    "type": "integer"
                },
                "takenInOfflineMode": {
                    "type": "boolean"
                }
            }
        },
        "Answer": {
            "description": "The Answer entity",
            "title": "Answer",
            "properties": {
                "id": {
                    "type": "string"
                },
                "questionId": {
                    "type": "string"
                },
                "participantId": {
                    "type": "string"
                }
            }
        },
        "AnswerOption": {
            "description": "The AnswerOption entity",
            "title": "AnswerOption",
            "properties": {
                "id": {
                    "type": "string"
                },
                "questionId": {
                    "type": "string"
                },
                "participantId": {
                    "type": "string"
                },
                "text": {
                    "type": "string"
                }
            }
        },
        "StringDictionary": {
            "title": "StringDictionary",
            "type": "object",
            "additionalProperties": {
                "type": "string"
            },
            "example": {
                "de": "deutscher Text",
                "en": "English text"
            }
        },
        "ValidationDictionary": {
            "description": "A dictionary with question types as keys and corresponding rule dictionaries as values.",
            "title": "ValidationDictionary",
            "properties": {
                "questionType": {
                    "$ref": "#/definitions/RulesDictionary"
                }
            }
        },
        "RulesDictionary": {
            "description": "A dictionary with rule names as key and corresponding rule objects as values.",
            "title": "RulesDictionary",
            "type": "object",
            "additionalProperties": {
                "type": "object"
            }
        },
        "BasicError": {
            "title": "BasicError",
            "properties": {
                "ERROR": {
                    "type": "string",
                    "description": "The corresponding error code"
                }
            }
        },
        "401Error": {
            "title": "HTTP 401 Error",
            "description": "The request was missing authentication headers or the sent headers were invalid.",
            "type": "object",
            "allOf": [{
                "$ref": "#/definitions/BasicError"
            }]
        },
        "404Error": {
            "title": "HTTP 404 Error",
            "description": "The requested resource could not be found.",
            "type": "object",
            "allOf": [{
                "$ref": "#/definitions/BasicError"
            }]
        },
        "500Error": {
            "title": "HTTP 500 Error",
            "description": "There was an internal server error. Please try again later.",
            "type": "object",
            "allOf": [{
                "$ref": "#/definitions/BasicError"
            }]
        }
    }
}
