All Collections
Product Updates
How to Use API Post in Free Text Questionnaire
How to Use API Post in Free Text Questionnaire

This document outlines how to enable the POST to API functionality in the Free Text Questionnaire.

Tim Tietz avatar
Written by Tim Tietz
Updated over a week ago

Post to API in the Free Text Questionnaire (FTQ) can be a bit tricky, this article helps to overcome that with some common sense language and easy-to-follow steps.

  • In order to prepare your plugin (FTQ) for this you will need to enable the "Post to API" functionality. This can be done by:

  • Clicking on "Settings" in the FTQ Plugin

  • Clicking on the White Toggle button to the right of "Post to API" thus enables it.

Under this section you have the ability to select your content type
​

  • Text/Plain

  • Application/Json

Once enabled, you will want to enter your specified endpoint that accepts HTTP Post. This will allow the FTQ responses submitted through the API to be received.

Each user submission will now be sent to the designated endpoint.

The format of the JSON submitted response will depend on the number and type of questions in the questionnaire.


Here is a sample JSON format example of a questionnaire response payload that could be submitted through the API Post Method:
​
​{

"startedDateTime": "2023-03-13T20:25:51.071Z",

"finishedDateTime": "2023-03-13T20:26:43.428Z",

"user": { // user info

"_id": "62542b50000009a199",

"email": "test@gmail.com",

"displayName": "userName"

},

"answers": [ // list of answers format


{ // single selected Question

"answerId": "3c4e7ef1-23a8-434d-bdd2-f1aa1724533d", "questionId": "08763aa4-dafb-42a3-9ee3-59dab71b6d51", "nextQuestionId": "", "questionTitle": "Do you have any pets?", "questionBody": "<p class=\"bf-wysiwyg-top\">Do you have any pets?</p>", "questionType": "single",
"isPrivate": false, "answerText": "Yes", "template": "<p class=\"bf-wysiwyg-top\">the answer {answer}</p>", "index": 0, "score": 10 },

{ // free text Question

"answerId": "8b078800-c003-407a-8651-eff86dc9738e",

"questionTitle": "Who knows you best?",

"questionBody": "<p class=\"bf-wysiwyg-top\">Who knows you best?</p>",

"questionId": "e0942d3f-2f35-475b-b922-a8437493953c",

"questionType": "freeText",

"isPrivate": false,

"answerText": "My best friend",

"index": 0

},


{ // location Question

questionId": "a3fb6e1f-14a3-45d4-a035-89429aebbabe",

"questionTitle": "If you could travel anywhere in the world, where would

"questionBody": "<p class=\"bf-wysiwyg-top\">If you could travel anywhere

in the world, where would you go?</p>",

"questionType": "locationOnly",

"isPrivate": false,

"answerText": "New York, NY, USA",

"pinLat": 40.7127753,

"pinLng": -74.0059728,

"placeInfo": {

"plus_code": {

"compound_code": "RCHC+C5H Lebanon, KS, USA",

"global_code": "86F3RCHC+C5H"

},

"results": [

]

}

],

"formatted_address":"130 Rd, Lebanon, KS 66952, USA",

"geometry":{

"bounds":{

"northeast":{

"lat":39.82864250000001,

"lng":-98.579258

},

"southwest":{

"lat":39.8281895,

"lng":-98.5801006

} },

"location":{

"lat":39.8284177,

"lng":-98.57966979999999

},

"location_type":"GEOMETRIC_CENTER",

"viewport":{

"northeast":{

"lat":39.82976498029151,

"lng":-98.57833031970848

},

"southwest":{

"lat":39.82706701970851,

"lng":-98.5810282802915

}

} },

"place_id":"ChIJ68v8JVaPmIcR0NBATD3D8ZY",

"types":[

"route" ]

} ]

} },


Questions on this may not be able to be addressed from our direct front-line support, while we do make every effort to provide knowledge and understanding of advanced technical questions, If this does happen please reach out to support@buildfire.com we will work with our team to provide an answer.

Did this answer your question?