This document describes the Magpi Outbound API, which allows Magpi Enterprise users client applications to pull information from the Magpi server at api.magpi.com . To push data to Magpi's servers, you will need to use the Magpi Inbound API.
To fetch subform data, please use version 2 url on the Get Survey Data API.
We are still working on version 2 of the List Questions API which will include subform questions.
The Magpi API allows Enterprise users' client applications to request :
- a list of a forms
- a list of questions for a specified form
- form data
The data is returned as JSON representation.
To use the API, first create an accesstoken on the API settings page - the page can be accessed by clicking the Settings link at the top of any Magpi page, and then choosing the API tab. Click generate or use the existing. The accesstoken is used in the header.
- List Forms
Description:
This action gets a list of all the Magpi forms for which the user has data view access.
URL: https://api.magpi.com/api/forms
Header:
Key | Value |
Authorization | Your accesstoken |
Host | api.magpi.com |
Parameters:
Key | Value |
mine | true |
shared | true |
isPublic | false |
template | false |
Note: The values of the parameters are boolean values which are used to filter the requested form list. They can either be true or false depending on the list of forms you want to get.
Allowed HTTP Method: GET
URL: https://api.magpi.com/api/forms?
mine=true&shared=true&isPublic=false&template=false
Sample JSON Output:
{ "status": 200, "data": { "total": 2, "start": 0, "limit": 25, "forms": [ { "id": 11111, "name": "form_one", "description": "", "externalId": "44444444444444", "dateCreated": "2020-04-14", "lastUpdated": "2020-04-14", "lastDataAdded": null, "recordCount": 10, "subformsCount": 0, "isSubForm": false, "owner": { "id": 232323, "email": "[email protected]" }, "tags": [ ], "uuid": "ddfgr502-crr7-61cb-85ct-026bt9248yek" }, { "id": 22222, "name": "form_two", "description": "", "externalId": "2222222222222", "dateCreated": "2021-10-04", "lastUpdated": "2021-10-14", "lastDataAdded": "2021-10-04", "recordCount": 1, "subformsCount": 1, "isSubForm": false, "owner": { "id": 212121, "email": "[email protected]" }, "tags": [ ], "uuid": "d8e4d47b-ib27-41fb-53cr-156h2624t3eu" } ] } }
- List Questions
Description:
This action gets a list of all questions for the specified form.
URL: https://api.magpi.com/api/form/{formExternalId}
Headers:
Key | Value |
Authorization | Your accesstoken |
Host | api.magpi.com |
Allowed HTTP Method: GET
Sample URL 1: https://api.magpi.com/api/form/44444444444444
Sample JSON Output:
List Form questions without a subform question(s)
{ "status": 200, "data": { "id": 11111, "externalId": "44444444444444", "name": "form_one", "description": "", "gpsStamp": true, "dataPublic": false, "formPublic": true, "numbering": "ALL", "tags": [], "isSubForm": false, "owner": { "id": 333333, "email": "[email protected]" }, "questions": [ { "id": 12380208, "qIndex": 2, "name": "Origin_Country", "label": "Origin_Country", "type": "dropdown", "options": [ { "id": 9373931, "code": "US", "label": "US", "checked": false, "opIndex": 1, "jumpTo": null }, { "id": 9373932, "code": "France", "label": "France", "checked": false, "opIndex": 2, "jumpTo": null }, { "id": 9373933, "code": "Italy", "label": "Italy", "checked": false, "opIndex": 3, "jumpTo": null }, { "id": 9373934, "code": "Kenya", "label": "Kenya", "checked": false, "opIndex": 4, "jumpTo": null }, { "id": 9373935, "code": "India", "label": "India", "checked": false, "opIndex": 5, "jumpTo": null } ], "required": false, "cascading": false, "cascadingRef": "", "autofil": false, "relevant": "", "relevantLogic": null, "constraint": null, "constraintMessage": null, "constraintLogic": null, "calculate": null, "calculateLogic": null, "subFormName": "", "subFormQuestions": [], "subFormId": "", "subFormKeyword": "", "jumpToNoOption": null, "rangeMin": "", "rangeMax": "", "rangeMessage": "" }, { "id": 12380214, "qIndex": 3, "name": "Gender", "label": "Gender", "type": "dropdown", "options": [ { "id": 9373936, "code": "Male", "label": "Male", "checked": false, "opIndex": 1, "jumpTo": null }, { "id": 9373937, "code": "Female", "label": "Female", "checked": false, "opIndex": 2, "jumpTo": null }, { "id": 9373938, "code": "Others", "label": "Others", "checked": false, "opIndex": 3, "jumpTo": null } ], "required": false, "cascading": false, "cascadingRef": "", "autofil": false, "relevant": "", "relevantLogic": null, "constraint": null, "constraintMessage": null, "constraintLogic": null, "calculate": null, "calculateLogic": null, "subFormName": "", "subFormQuestions": [], "subFormId": "", "subFormKeyword": "", "jumpToNoOption": null, "rangeMin": "", "rangeMax": "", "rangeMessage": "" }, { "id": 12380219, "qIndex": 4, "name": "Covid19_Vaccinated", "label": "Covid19_Vaccinated", "type": "dropdown", "options": [ { "id": 9373940, "code": "Yes", "label": "Yes", "checked": false, "opIndex": 1, "jumpTo": null }, { "id": 9373941, "code": "No", "label": "No", "checked": false, "opIndex": 2, "jumpTo": null } ], "required": false, "cascading": false, "cascadingRef": "", "autofil": false, "relevant": "", "relevantLogic": null, "constraint": null, "constraintMessage": null, "constraintLogic": null, "calculate": null, "calculateLogic": null, "subFormName": "", "subFormQuestions": [], "subFormId": "", "subFormKeyword": "", "jumpToNoOption": null, "rangeMin": "", "rangeMax": "", "rangeMessage": "" } ], "submitters": [ { "email": "[email protected]" } ], "publish": {}, "uuid": "d6eee028-cb27-11eb-80cc-026b272483ed" } }
Sample URL 2: https://api.magpi.com/api/form/2222222222222
Sample JSON Output:
List Form questions with a subform question(s) and skip logic
{ "status": 200, "data": { "id": 22222, "externalId": "2222222222222", "name": "form_two", "description": "", "gpsStamp": true, "dataPublic": false, "formPublic": true, "numbering": "ALL", "tags": [], "isSubForm": false, "owner": { "id": 212121, "email": "[email protected]" }, "questions": [ { "id": 12503564, "qIndex": 1, "name": "prompt__1594652169930", "label": "Welcome", "type": "label", "options": [], "required": false, "cascading": false, "cascadingRef": "", "autofil": false, "relevant": "", "relevantLogic": null, "constraint": null, "constraintMessage": null, "constraintLogic": null, "calculate": null, "calculateLogic": null, "subFormName": "", "subFormQuestions": [], "subFormId": "", "subFormKeyword": "", "jumpToNoOption": null, "rangeMin": "", "rangeMax": "", "rangeMessage": "" }, { "id": 12503565, "qIndex": 2, "name": "What_s_your_Name", "label": "What's your Name", "type": "plain", "options": [], "required": false, "cascading": false, "cascadingRef": "", "autofil": false, "relevant": "", "relevantLogic": null, "constraint": null, "constraintMessage": null, "constraintLogic": null, "calculate": null, "calculateLogic": null, "subFormName": "", "subFormQuestions": [], "subFormId": "", "subFormKeyword": "", "jumpToNoOption": null, "rangeMin": "", "rangeMax": "", "rangeMessage": "" }, { "id": 12503573, "qIndex": 4, "name": "About_myself", "label": "About myself ", "type": "subform", "options": [], "required": false, "cascading": false, "cascadingRef": "", "autofil": false, "relevant": null, "relevantLogic": null, "constraint": null, "constraintMessage": null, "constraintLogic": null, "calculate": null, "calculateLogic": null, "subFormName": "about_myself_subform", "subFormQuestions": [ { "id": 12503347, "qIndex": 1, "name": "prompt__1594641739418", "label": "Welcome", "type": "label", "options": [], "required": false, "cascading": false, "cascadingRef": "", "autofil": false, "relevant": "", "relevantLogic": null, "constraint": null, "constraintMessage": null, "constraintLogic": null, "calculate": null, "calculateLogic": null, "subFormName": "", "subFormQuestions": [], "subFormId": "", "subFormKeyword": "", "jumpToNoOption": null, "rangeMin": "", "rangeMax": "", "rangeMessage": "" }, { "id": 12503348, "qIndex": 2, "name": "How_Old_are_You_", "label": "How Old are You?", "type": "dropdown", "options": [ { "id": 9457475, "code": "Below_10", "label": "Below 10", "checked": false, "opIndex": 1, "jumpTo": null }, { "id": 9457476, "code": "Range_of_11_20", "label": "Range of 11-20", "checked": false, "opIndex": 2, "jumpTo": 12503357 }, { "id": 9457477, "code": "Range_of_21_30", "label": "Range of 21-30", "checked": false, "opIndex": 3, "jumpTo": 12503360 }, { "id": 9457478, "code": "Range_of_31_40", "label": "Range of 31-40", "checked": false, "opIndex": 4, "jumpTo": 12503363 }, { "id": 9457479, "code": "Above_41", "label": "Above 41", "checked": false, "opIndex": 5, "jumpTo": 12503366 } ], "required": false, "cascading": false, "cascadingRef": "", "autofil": false, "relevant": "", "relevantLogic": null, "constraint": null, "constraintMessage": null, "constraintLogic": null, "calculate": null, "calculateLogic": null, "subFormName": "", "subFormQuestions": [], "subFormId": "", "subFormKeyword": "", "jumpToNoOption": null, "rangeMin": "", "rangeMax": "", "rangeMessage": "" }, { "id": 12503354, "qIndex": 3, "name": "What_do_you_want_to_be_when_yo", "label": "What do you want to be when you grow up?", "type": "dropdown", "options": [ { "id": 9457480, "code": "Doctor", "label": "Doctor", "checked": false, "opIndex": 1, "jumpTo": null }, { "id": 9457481, "code": "Engineer", "label": "Engineer", "checked": false, "opIndex": 2, "jumpTo": null }, { "id": 9457492, "code": "Politician", "label": "Politician", "checked": false, "opIndex": 3, "jumpTo": null }, { "id": 9457493, "code": "Not_Sure", "label": "Not_Sure", "checked": false, "opIndex": 4, "jumpTo": null }, { "id": 9457494, "code": "None_of_the_above", "label": "None_of_the_above", "checked": false, "opIndex": 5, "jumpTo": null } ], "required": false, "cascading": false, "cascadingRef": "", "autofil": false, "relevant": "selected( /data/How_Old_are_You_ , 'Range_of_11_20' ) or selected( /data/How_Old_are_You_ , 'Range_of_21_30' ) or selected( /data/How_Old_are_You_ , 'Range_of_31_40' ) or selected( /data/How_Old_are_You_ , 'Above_41' )", "relevantLogic": null, "constraint": null, "constraintMessage": null, "constraintLogic": null, "calculate": null, "calculateLogic": null, "subFormName": "", "subFormQuestions": [], "subFormId": "", "subFormKeyword": "", "jumpToNoOption": null, "rangeMin": "", "rangeMax": "", "rangeMessage": "" }, { "id": 12503357, "qIndex": 4, "name": "Do_you_Love_School", "label": "Do you Love School", "type": "dropdown", "options": [ { "id": 9457482, "code": "Yes", "label": "Yes", "checked": false, "opIndex": 1, "jumpTo": null }, { "id": 9457483, "code": "No", "label": "No", "checked": false, "opIndex": 2, "jumpTo": null } ], "required": false, "cascading": false, "cascadingRef": "", "autofil": false, "relevant": "selected( /data/How_Old_are_You_ , 'Range_of_21_30' ) or selected( /data/How_Old_are_You_ , 'Range_of_31_40' ) or selected( /data/How_Old_are_You_ , 'Above_41' )", "relevantLogic": null, "constraint": null, "constraintMessage": null, "constraintLogic": null, "calculate": null, "calculateLogic": null, "subFormName": "", "subFormQuestions": [], "subFormId": "", "subFormKeyword": "", "jumpToNoOption": null, "rangeMin": "", "rangeMax": "", "rangeMessage": "" }, { "id": 12503360, "qIndex": 5, "name": "Which_career_course_are_you_ta", "label": "Which career course are you taking?", "type": "dropdown", "options": [ { "id": 9457484, "code": "Am_Confused", "label": "Am Confused", "checked": false, "opIndex": 1, "jumpTo": null }, { "id": 9457485, "code": "Lets_talk_about_this_when_am_30", "label": "Lets talk about this when am 30", "checked": false, "opIndex": 2, "jumpTo": null }, { "id": 9457494, "code": "I_will_share_my_career_details", "label": "I will share my career details", "checked": false, "opIndex": 3, "jumpTo": null } ], "required": false, "cascading": false, "cascadingRef": "", "autofil": false, "relevant": "selected( /data/How_Old_are_You_ , 'Range_of_31_40' ) or selected( /data/How_Old_are_You_ , 'Above_41' )", "relevantLogic": null, "constraint": null, "constraintMessage": null, "constraintLogic": null, "calculate": null, "calculateLogic": null, "subFormName": "", "subFormQuestions": [], "subFormId": "", "subFormKeyword": "", "jumpToNoOption": null, "rangeMin": "", "rangeMax": "", "rangeMessage": "" }, { "id": 12503363, "qIndex": 6, "name": "Are_you_Married", "label": "Are you Married", "type": "dropdown", "options": [ { "id": 9457486, "code": "Yes", "label": "Yes", "checked": false, "opIndex": 1, "jumpTo": null }, { "id": 9457487, "code": "Not_Yet", "label": "Not Yet", "checked": false, "opIndex": 2, "jumpTo": null }, { "id": 9457495, "code": "Won_t_get_Married", "label": "Won't get Married", "checked": false, "opIndex": 3, "jumpTo": null } ], "required": false, "cascading": false, "cascadingRef": "", "autofil": false, "relevant": "selected( /data/How_Old_are_You_ , 'Above_41' )", "relevantLogic": null, "constraint": null, "constraintMessage": null, "constraintLogic": null, "calculate": null, "calculateLogic": null, "subFormName": "", "subFormQuestions": [], "subFormId": "", "subFormKeyword": "", "jumpToNoOption": null, "rangeMin": "", "rangeMax": "", "rangeMessage": "" }, { "id": 12503366, "qIndex": 7, "name": "How_many_children_do_you_have", "label": "How many children do you have", "type": "dropdown", "options": [ { "id": 9457488, "code": "One", "label": "One", "checked": false, "opIndex": 1, "jumpTo": null }, { "id": 9457489, "code": "Two", "label": "Two", "checked": false, "opIndex": 2, "jumpTo": null }, { "id": 9457496, "code": "Three", "label": "Three", "checked": false, "opIndex": 3, "jumpTo": null }, { "id": 9457497, "code": "More_than_Three", "label": "More than Three", "checked": false, "opIndex": 4, "jumpTo": null }, { "id": 9457498, "code": "None", "label": "None", "checked": false, "opIndex": 5, "jumpTo": null } ], "required": false, "cascading": false, "cascadingRef": "", "autofil": false, "relevant": "", "relevantLogic": null, "constraint": null, "constraintMessage": null, "constraintLogic": null, "calculate": null, "calculateLogic": null, "subFormName": "", "subFormQuestions": [], "subFormId": "", "subFormKeyword": "", "jumpToNoOption": null, "rangeMin": "", "rangeMax": "", "rangeMessage": "" }, { "id": 12503369, "qIndex": 8, "name": "Did_you_Enjoy_the_Questions_", "label": "Did you Enjoy the Questions?", "type": "dropdown", "options": [ { "id": 9457490, "code": "Yes", "label": "Yes", "checked": false, "opIndex": 1, "jumpTo": null }, { "id": 9457491, "code": "Not_at_all", "label": "Not at all", "checked": false, "opIndex": 2, "jumpTo": null } ], "required": false, "cascading": false, "cascadingRef": "", "autofil": false, "relevant": "", "relevantLogic": null, "constraint": null, "constraintMessage": null, "constraintLogic": null, "calculate": null, "calculateLogic": null, "subFormName": "", "subFormQuestions": [], "subFormId": "", "subFormKeyword": "", "jumpToNoOption": null, "rangeMin": "", "rangeMax": "", "rangeMessage": "" } ], "subFormId": "7777777777777", "subFormKeyword": "about myself", "jumpToNoOption": null }, { "id": 12503719, "qIndex": 5, "name": "Picture_of_myself", "label": "Picture of myself", "type": "image", "options": [], "required": false, "cascading": false, "cascadingRef": "", "autofil": false, "relevant": "", "relevantLogic": null, "constraint": null, "constraintMessage": null, "constraintLogic": null, "calculate": null, "calculateLogic": null, "subFormName": "", "subFormQuestions": [], "subFormId": "", "subFormKeyword": "", "jumpToNoOption": null, "rangeMin": "", "rangeMax": "", "rangeMessage": "" }, { "id": 12503720, "qIndex": 6, "name": "Birth_Date", "label": "Birth Date", "type": "date", "options": [], "required": false, "cascading": false, "cascadingRef": "", "autofil": false, "relevant": "", "relevantLogic": null, "constraint": null, "constraintMessage": null, "constraintLogic": null, "calculate": null, "calculateLogic": null, "subFormName": "", "subFormQuestions": [], "subFormId": "", "subFormKeyword": "", "jumpToNoOption": null, "rangeMin": "", "rangeMax": "", "rangeMessage": "" }, { "id": 12515823, "qIndex": 7, "name": "Favorite_Food", "label": "Favorite Food", "type": "subform", "options": [], "required": false, "cascading": false, "cascadingRef": "", "autofil": false, "relevant": null, "relevantLogic": null, "constraint": null, "constraintMessage": null, "constraintLogic": null, "calculate": null, "calculateLogic": null, "subFormName": "favourite_food_subform", "subFormQuestions": [ { "id": 12515816, "qIndex": 1, "name": "prompt__1595227582890", "label": "Best Food", "type": "label", "options": [], "required": false, "cascading": false, "cascadingRef": "", "autofil": false, "relevant": "", "relevantLogic": null, "constraint": null, "constraintMessage": null, "constraintLogic": null, "calculate": null, "calculateLogic": null, "subFormName": "", "subFormQuestions": [], "subFormId": "", "subFormKeyword": "", "jumpToNoOption": null, "rangeMin": "", "rangeMax": "", "rangeMessage": "" }, { "id": 12515817, "qIndex": 2, "name": "Which_is_your_favorite_food", "label": "Which is your favorite food", "type": "dropdown", "options": [ { "id": 9464943, "code": "Rice", "label": "Rice", "checked": false, "opIndex": 1, "jumpTo": null }, { "id": 9464944, "code": "Chicken", "label": "Chicken", "checked": false, "opIndex": 2, "jumpTo": null }, { "id": 9464945, "code": "Potato_chips_", "label": "Potato chips ", "checked": false, "opIndex": 3, "jumpTo": null }, { "id": 9464946, "code": "Meat", "label": "Meat", "checked": false, "opIndex": 4, "jumpTo": null } ], "required": false, "cascading": false, "cascadingRef": "", "autofil": false, "relevant": "", "relevantLogic": null, "constraint": null, "constraintMessage": null, "constraintLogic": null, "calculate": null, "calculateLogic": null, "subFormName": "", "subFormQuestions": [], "subFormId": "", "subFormKeyword": "", "jumpToNoOption": null, "rangeMin": "", "rangeMax": "", "rangeMessage": "" } ], "subFormId": "999999999999", "subFormKeyword": "food", "jumpToNoOption": null } ], "submitters": [ { "email": "[email protected]" }, { "email": "[email protected]" }, { "email": "[email protected]" } ], "publish": {}, "uuid": "d6f5f239-cb27-11eb-80cc-026b272483ed" } }
- Get Survey Data
Description:
This action gets the data for the form specified in the request parameters.
URL: https://api.magpi.com/api/form/{formExternalId}/answers
Header:
Key | Value |
Authorization | Your accesstoken |
Host | api.magpi.com |
Parameters:
Key | Value |
start | Start record data count to be returned. For example; if the total records returned are a total of 3000 and the start is initialized as 2000, records to be returned will be from 2000 to 2100. |
limit | This is the limit of record data to be returned. Note: the default limit is 100 and the maximum limit of record data is 500 |
searchQuery | Search the data by entering a name in the records. |
sort | Allows users to sort data by specific column name. Default value: lastSubmission. Possible values: dateCreated, startRecord, endRecord, lastSubmission, lastSubmitter, createdBy. |
order | Order the data either in ascending or descending order. the value can be (asc/desc) |
startDate | Start date of the data to be returned. Filtering is done based on the DateStamp and is inclusive. (Optional). The date format should be the same one as the one on the data tab/ The date format should be the same one as the one on the data tab. The format is YYYY-MM-DD. e.g 2020-01-01 |
endDate | End date of the data to be returned. Filtering is done based on the DateStamp and is inclusive. (Optional). The format is YYYY-MM-DD. e.g 2020-12-31 |
lastSubmitterEmail | Last Submitter (Member) Email |
Note: All parameters are Optional
Allowed HTTP Method: GET
Sample URL 1: https://api.magpi.com/api/form/44444444444444/answers?
start=0&limit=100&searchQuery&order=asc&startDate=2020-02-17&endDate=2021-11-11&lastSubmitterEmail
Sample JSON Output:
Get Survey data without a subform question(s)
{ "status": 200, "data": { "total": 2, "start": 0, "limit": 100, "answers": [ { "meta": { "id": 11257343, "createdBy": "[email protected]", "lastSubmitter": "[email protected]", "startRecord": "2020-05-14 16:56:57", "endRecord": "2020-05-14 16:57:13", "lastSubmission": "2020-05-14 16:57:13", "geoTag": "", "formExternalId": "44444444444444", "uuid": "b796de9e5ba7b9ad-5589174646243" }, "answers": [ { "name": "Origin_Country", "type": "dropdown", "answer": "US" }, { "name": "Gender", "type": "dropdown", "answer": "Female" }, { "name": "Covid19_Vaccinated", "type": "dropdown", "answer": "No" } ] }, { "meta": { "id": 11257345, "createdBy": "[email protected]", "lastSubmitter": "[email protected]", "startRecord": "2020-05-14 16:57:14", "endRecord": "2020-05-14 16:57:26", "lastSubmission": "2020-05-14 16:57:26", "geoTag": "", "formExternalId": "44444444444444", "uuid": "r7986e9e3ba7b1af-3589464446648" }, "answers": [ { "name": "Origin_Country", "type": "dropdown", "answer": "France" }, { "name": "Gender", "type": "dropdown", "answer": "Male" }, { "name": "Covid19_Vaccinated", "type": "dropdown", "answer": "Yes" } ] }, ] } }
Sample URL 2: https://api.magpi.com/api/form/2222222222222/answers?
start=0&limit=100&searchQuery&order=asc&startDate=2020-02-17&endDate=2021-11-11&lastSubmitterEmail
Sample JSON Output:
Get Survey data with a subform question(s)
{ "status": 200, "data": { "total": 3, "start": 0, "limit": 100, "answers": [ { "meta": { "id": 11430800, "createdBy": "[email protected]", "lastSubmitter": "[email protected]", "startRecord": "2021-07-31 10:30:24", "endRecord": "2021-07-31 10:30:54", "lastSubmission": "2021-07-31 10:30:54", "geoTag": "", "formExternalId": "2222222222222", "uuid": "2dad5f785922df5c-1596180654369" }, "answers": [ { "name": "What_s_your_Name", "type": "plain", "answer": "John" }, { "name": "About_myself", "type": "subform", "answer": 1 }, { "name": "Picture_of_myself", "type": "image", "answer": "https://www.dropbox.com/d/gujyrprpai30lkg/2dvd5f785932df5c-6596380654362.png?dl=0" }, { "name": "Birth_Date", "type": "date", "answer": "1997-07-01" }, { "name": "Favorite_Food", "type": "subform", "answer": 1 } ] }, { "meta": { "id": 11430091, "createdBy": "[email protected]", "lastSubmitter": "[email protected]", "startRecord": "2021-07-31 10:28:27", "endRecord": "2021-07-31 10:29:03", "lastSubmission": "2021-08-03 17:02:05", "geoTag": "", "formExternalId": "2222222222222", "uuid": "2dad5f785922df5c-1596180543679" }, "answers": [ { "name": "What_s_your_Name", "type": "plain", "answer": "Peter" }, { "name": "About_myself", "type": "subform", "answer": 0 }, { "name": "Picture_of_myself", "type": "image", "answer": "https://www.dropbox.com/d/k4v2pantpuecedz/2dad7f785822db5a-3596183543678.png?dl=0" }, { "name": "Birth_Date", "type": "date", "answer": "2001-04-07" }, { "name": "Favorite_Food", "type": "subform", "answer": 0 } ] }, { "meta": { "id": 11438970, "createdBy": "[email protected]", "lastSubmitter": "[email protected]", "startRecord": "2021-08-04 12:00:07", "endRecord": "2021-08-04 12:00:54", "lastSubmission": "2021-08-04 12:00:54", "geoTag": "", "formExternalId": "2222222222222", "uuid": "2dad5f785922df5c-1596531635478" }, "answers": [ { "name": "What_s_your_Name", "type": "plain", "answer": "Muthaka" }, { "name": "About_myself", "type": "subform", "answer": 1 }, { "name": "Picture_of_myself", "type": "image", "answer": "" }, { "name": "Birth_Date", "type": "date", "answer": "2001-08-26" }, { "name": "Favorite_Food", "type": "subform", "answer": 0 } ] } ] } }
Get Sub-form data
Description:
This action gets the data for the sub-form specified in the parent record UUID.
URL: https://api.magpi.com/api/answer/{formExternalId}/{uuid}/{questionName}
{formExternalId} - Main form External ID
{uuid} - Question Answer UUID fetched from the Main form answer meta data
{questionName} - Subform question name as it is in the main form
Header:
Key | Value |
Authorization | Your accesstoken |
Host | api.magpi.com |
Parameters:
Key | Value |
start | Start record data count to be returned. For example; if the total records returned are a total of 3000 and the start is initialized as 2000, records to be returned will be from 2000 to 2100. |
limit | This is the limit of record data to be returned. Note: the default limit is 100 and the maximum limit of record data is 500 |
searchQuery | Search the data by entering a name in the records. |
sort | Allows users to sort data by specific column name. Default value: lastSubmission. Possible values: dateCreated, startRecord, endRecord, lastSubmission, lastSubmitter, createdBy. |
order | Order the data either in ascending or descending order. the value can be (asc/desc) |
startDate | Start date of the data to be returned. Filtering is done based on the DateStamp and is inclusive. (Optional). The date format should be the same one as the one on the data tab/ The date format should be the same one as the one on the data tab. The format is YYYY-MM-DD. e.g 2020-01-01 |
endDate | End date of the data to be returned. Filtering is done based on the DateStamp and is inclusive. (Optional). The format is YYYY-MM-DD. e.g 2020-12-31 |
lastSubmitterEmail | Last Submitter (Member) Email |
Note: All parameters are Optional
Allowed HTTP Method: GET
Sample URL: https://api.magpi.com/api/answer/2222222222222/2dad5f785922df5c-1596180654369/About_myself?
start=&limit=&searchQuery=&orde=r&startDate=&endDate=&lastSubmitterEmail
The sample URL above has used {uuid} and {questionName} received in the Get Survey data with a subform question(s) JSON response
Sample JSON Output:
{ "status": 200, "data": { "total": 1, "start": null, "limit": null, "answers": [ { "meta": { "id": 11438971, "createdBy": "[email protected]", "lastSubmitter": "[email protected]", "startRecord": "2021-08-04 12:00:37", "endRecord": "2021-08-04 12:00:47", "lastSubmission": "2021-08-04 12:00:54", "geoTag": "", "formExternalId": "1111122222", "uuid": "2dad5f785922df5c-1596531647200" }, "answers": [ { "name": "How_Old_are_You_", "type": "dropdown", "answer": "Range_of_31_40" }, { "name": "What_do_you_want_to_be_when_yo", "type": "dropdown", "answer": "" }, { "name": "Do_you_Love_School", "type": "dropdown", "answer": "" }, { "name": "Which_career_course_are_you_ta", "type": "dropdown", "answer": "" }, { "name": "Are_you_Married", "type": "dropdown", "answer": "Not_Yet" }, { "name": "How_many_children_do_you_have", "type": "dropdown", "answer": "Three" }, { "name": "Did_you_Enjoy_the_Questions_", "type": "dropdown", "answer": "Not_at_all" } ] } ] } }