REPORTING API - V1

Content


Sign In

Generate token

Creates token, which you have to pass every time in header

Request

Response

{
    "access_token": "49ff475fc5394b93b75bf817c4e624fd832de4bb44639405e5061b453c4a05f6",
    "expires_in": 15552000,
    "token_type": "bearer",
    "refresh_token": "e7e432997e8e24dc75b854cfc74692307ae15e7a82ee74de8ecf7db9be10d616"
}

Invalidate token

Invalidates token. You cannot use it for login anymore.

Request

Response

Success

Token was deleted

{
    "result": true
}

Error

Probabely wrong access_token, or request structure

{
    "result": false
}

Refresh token

Invalidates token. You cannot use it for login anymore.

Request

Response

Success

Returns new access and refresh Token

{
    "access_token": "7c3dce...",
    "token_type": "bearer",
    "expires_in": 15552000,
    "refresh_token": "8892be..."
}

Error

Probabely wrong access_token/refresh_token or token expired

{
    "error": "invalid_grant",
    "error_description": "Givent grant token is invalid or expired"
}


GET Project Requests

Homepage

Default (starting) URL

Request

Response Template

Returns JSON of projects array
STATUS can have values 1 (as active) and 2 (as closed)

{
    "projects": [
        {
            "id": "<project_id>",
            "name": "<project_name>",
            "status": "<status>",
            "start": "<start_date>",
            "end": "<end_date>"
        }
    ]
}

Response Real Example

Returns JSON of projects array

{
    "projects": [
        {
            "id": 797,
            "name": "Project name",
            "status": 1,
            "start": "2011-02-01",
            "end": "2011-02-15"
        },
        {
            "id": 802,
            "name": "Another project name ",
            "status": 2,
            "start": "2011-02-01",
            "end": "2011-02-15"
        }
    ]
}

List of Projects

Same response as Homepage (above). URL is different

Request


Project Detail

Detail info about project

Request

Response Template

Returns JSON with project info
STATUS may have values 1 (active) or 2 (closed)

{
    "id": "<project_id>",
    "name": "<project_name>",
    "status": "<status>",
    "start": "<start_date>",
    "end": "<end_date>",
}

Response Real Example

Returns JSON of project info

{
    "id": 797,
    "name": "Project Name",
    "status": 1,
    "start": "2011-02-01",
    "end": "2011-02-15"
}

List of Project Forms

Returns JSON with forms array. Each form has id and URL to form detail

Request

Response Template

Returns JSON of forms array

{
    "forms": [
        {
            "id": "<form_id>",
            "last_saved": "<form_last_saved>",
        }
    ]
}

Response Real Example

Returns JSON of forms array

{
    "forms": [
        {
            "id": 1,
            "last_saved": "2021-10-08 10:06:13",
        },
        {
            "id": 3,
            "last_saved": null
        }
    ]
}
  

Form Detail

Returns JSON with detail info of form

Request

Response Template

Returns JSON with form info
STATUS can be 1 (form to publish) or 2 (form to publish to all)
LAST SAVED Date and time the form was last modified (Y-m-d H:i:s)

There are three types of questions:

There are two types of indexes based on main index visibility:

{
    "id": "<form_id>",
    "status": "<status>",
    "last_saved": "<last_saved>",
    "index": [
        {
            "index_points": "<index_points>",
            "index_max_points": "<index_max_points>",
            "index": "<index>",
        },
        {
            "category_id": "<category_id>",
            "index_points": "<index_points>",
            "index_max_points": "<index_max_points>",
            "index": "<index>",
        },
    ],
    "questions": [
        {
            "id": "<question_id>",
            "value": "<question_value>"
        },
        {
            "id": "<question_id>",
            "option_id": "<option_id>"
        },
        {
            "id": "<question_id>",
            "attachments": [
                {
                    "attachment_name": "<attachment_name>",
                    "attachment_size": "<size>",
                    "attachment_link": "<attachment_url>"
                },
                {
                    "attachment_name": "<attachment_name>",
                    "attachment_size": "<size>",
                    "attachment_link": "<attachment_url>"
                }
            ]
        }
    ]
}

Response Real Example

Returns JSON with form info

{
    "id": 10,
    "status": 1,
    "last_saved": "2021-10-07 18:20:56",
    "index": [
        {
            "index_points": 28,
            "index_max_points": 100,
            "index": 28,
        },
        {
            "category_id": 75153,
            "index_points": 28,
            "index_max_points": 100,
            "index": 28,
        },
    ],
    "questions": [
        {
            "id": "T1",
            "value": 10,
        },
        {
            "id": "T2",
            "option_id": 1588,
        },
        {
            "id": "ATTACHMENT1",
            "attachments": [
                {
                    "attachment_name": "IMG_20201010_101010.jpg",
                    "attachment_size": 2001493,
                    "attachment_link": "https://reporting.marketvision-spring.com/api/v1/project/6434/attachment/123456"
                },
                {
                    "attachment_name": "IMG_20201111_111111.jpg",
                    "attachment_size": 2097853,
                    "attachment_link": "https://reporting.marketvision-spring.com/api/v1/project/6434/attachment/123457"
                }
            ]
        }
    ]
}
  

Questions Structure

Returns JSON with questions structure

Request

Response Template

Returns JSON with questions structure
There is more types of question type

Question can have category. Which is set by index_category_id. This category can have parent category, this is set by index_supercategory_id.

Fieldset_id is an id of fieldset. By fieldset are questions grouped together. Info about fieldset can be found bellow

index is number of points user can get for specific answer

In example response are all 4 posible types as example

{
    "questions": [
        {
            "id": "<question_id>",
            "name": "<question_name>",
            "type": "text",
            "type_text": "<type_text>",
            "index_category_id": "<category_id>",
            "index_supercategory_id": "<supercategory_id>",
            "fielset_id": "<fieldset_id>",
        },
        {
            "id": "<question_name>",
            "name": "<question_name>",
            "type": "single_response",
            "values": [
                {
                    "option_id": "<option_id>",
                    "value": "<option_value>",
                }, 
                {
                    "option_id": "<option_id>",
                    "value": "<option_value>",
                    "index": "<index>"
                }
            ],
            "index_category_id": "<category_id>",
            "index_supercategory_id": "<supercategory_id>",
            "fielset_id": "<fieldset_id>"
        },
        {
            "id": "<question_id>",
            "name": "<question_name>",
            "type": "multiple_response",
            "value": "<question_title>",
            "multiple_response_set_name": "<multiple_response_set_name>",
            "index_category_id": "<category_id>",
            "index_supercategory_id": "<supercategory_id>",
            "fielset_id": "<fieldset_id>",
        },
        {
            "id": "<question_id>",
            "name": "<question_name>",
            "attachment_type": "attachment",
            "index_category_id": "<category_id>",
            "index_supercategory_id": "<supercategory_id>",
            "fielset_id": "<fieldset_id>",
        }
    ]
}

Response Real Example

Returns JSON with questions structure

{
    "questions": [
        {
            "id": "A1",
            "name": "Typ scénáře",
            "type": "text",
            "type_text": "text",
            "index_category_id": 6787,
            "index_supercategory_id": 6788,
            "fielset_id": 1234,
        },
        {
            "variable": "F3",
            "name": "F3. Navázal s Vámi oční kontakt?",
            "type": "single_response",
            "options": [
                {
                    "option_id": "1",
                    "value": "ano",
                    "index": 3
                },
                {
                    "option_id": "2",
                    "value": "ne",
                    "index": 0
                },
                {
                    "option_id": "3",
                    "value": "nezodpovězeno"
                }
            ],
            "index_category_id": 6787,
            "index_supercategory_id": 6788,
            "fieldset_id": 1234,
        },
        {
            "id": "B4",
            "name": "Nesplněná kritéria",
            "type": "multiple_response",
            "value": Titulek otázky,
            "multiple_response_set_name": "Nesplněná kritéria",
            "index_category_id": 6787,
            "fielset_id": 1235,
        },
        {
            "variable": "ATTACHMENT1",
            "name": "M2. Příloha",
            "attachment_type": "image,others",
            "index_category_id": 6787,
            "index_supercategory_id": 6788,
            "fieldset_id": 1234,
        }
    ]
}

Categories Structure

Returns JSON with categories

Request

Response Template

Returns JSON with categories
type_of_category can be category or super_category
If id super_category, then there is property default_index. That can have values true or false. If is true, then TODO

{
    "categories": [
        {
            "id": "<category_id>",
            "name": "<category_name>",
            "type": "<type_of_category> ",
            "default_index": "<default_index>"
        }, 
        ...
    ]
}

Response Real Example

Returns JSON with categories

{
    "categories": [
        {
            "id": 6787,
            "name": "Category 1 name",
            "type": "category"
        }, 
        {
            "id": 6788,
            "name": "Category se Single response 22",
            "type": "super_category",
            "default_index": false
        },
        {
            "id": 6789,
            "name": "Category se Single response 22",
            "type": "super_category",
            "default_index": true
        }
    ]
}

Fieldsets Structure

Returns JSON with fieldsets. By fieldset are questions grouped together

Request

Response Template

Returns JSON with fieldsets

{
    "fieldsets": [
        {
            "id": "<fieldset_id>",
            "name": "<fieldset_name>"
        }, 
        ...
    ]
}

Response Real Example

Returns JSON with questions structure

{
    "fieldsets": [
        {
            "id": 1234,
            "name": "Fieldset 1 name"
        }, 
        {
            "id": 1235,
            "name": "Fieldset 2 name"
        }
    ]
}

Attachment structure

Returns attachment

Request