...
Language Mismatch: Compares the language of the OE answer with the survey language determined from the transaction ID.
AI Detection: Detects patterns to flag if the answer is AI-generated content.
Excluded textIncoherent Response: Flags any unacceptable responses such as jibberishgibberish, curse words, etc.
PureText Deduplication: Ensures the answer's uniqueness through deduplication.
...
For expected responses with at least one meaningful sentence (not categorical responses such as brand names, people and place names, slang, etc)
Expected responses are in the same language as survey language (For example, if the survey is in French, response should be only in French)
The API can be utilized after every open-ended question individually, or at the end of the survey for all open-ended questions. In either case the API response shows you the result for each answer separately.
ATTN: Max. number of open-ended answers that can be processed is 20.
Request
POST $apihost/$basepath/v3/transactions/ps_api_fail
($apihost is the environment against which you are testing, $basepath is the base path with the api version. All Buy API calls will require access-token parameter in the header.)
Parameters for 1 answer:
Body:
Code Block | ||
---|---|---|
| ||
{ "transaction_id": "4mWpY50Z5ZpovKkXjt7Liw", "questions": [ { "question_id": alpha numeric, "text": "string" } ] } |
Result:
Response Body:
Code Block | ||
---|---|---|
| ||
{ "transaction_id": "4mWpY50Z5ZpovKkXjt7Liw"alpha numberic",, "data": [ { "puretext_api_fail": 0, "ai_generated_response": 0, "incoherent_response": 0, "duplicate_response": 0, "language_mismatch": 0, "question_id": “string” } ] } |
Parameters for 2+ answers:
Body:
Code Block | ||
---|---|---|
| ||
{ "transaction_id": "4mWpY50Z5ZpovKkXjt7Liw", "questions": [ { "question_id": alpha numeric, "text": "string" }, { "transacion "question_id": alpha numeric, "2W6ZHlCrBZIgyf9kH04Stb" "text": "string" } ] } |
Result:
Response Body:
Code Block | ||
---|---|---|
| ||
{ "transaction_id": "4mWpY50Z5ZpovKkXjt7Liw", "data": [ { "2W6ZHlCrBZIgyf9kH04Stb","puretext_api_fail": 0, "ai_generated_response": 0, "incoherent_response": 0, "duplicate_response": 0, "buyer_ps_api_fail": true, } |
...
"language_mismatch": 0,
"question_id": “string”
},
{
"puretext_api_fail": 0,
"ai_generated_response": 0,
"incoherent_response": 0,
"duplicate_response": 0,
"language_mismatch": 0
"question_id": "string"
}
]
} |
If "puretext_api_fail": true1
we recommend to terminate the session with status code 84. However, you can create your own termination logic with all the information provided. For example, if you have a survey which is in French but also accepts English responses, to not terminate sessions where "language_mismatch": 1
.
URL: https://spectrumsurveys.com/surveydone?st=84&transaction_id=[transaction_id]
...
Code Block | ||
---|---|---|
| ||
{ "ps_buypuretext_api_status_code": 1014, "ps_api_response_message": "Invalid transaction" } |
...
Code Block | ||
---|---|---|
| ||
{ "ps_buypuretext_api_status_code": 1014, "ps_api_response_message": "Invalid parameters: Answer Text, Question Code/Id or Transaction Id is missing." } |
Example
...
for a termination due to AI detection:
POST https://spectrumsurveys.com/buyers/v2v3/transactions/ps_api_fail
Body:
Code Block | ||
---|---|---|
| ||
{ "questiontransaction_id": "123", "4mWpY50Z5ZpovKkXjt7Liw", "questions": [ { "question_id": 123A, "text": "As an AI language model I don't have a personal opinion.", } "transaction_id": "2W6ZHlCrBZIgyf9kH04Stb" ] } |
Response which results in a termination:
Code Block | ||
---|---|---|
| ||
{ "transaction_id": "2W6ZHlCrBZIgyf9kH04Stb4mWpY50Z5ZpovKkXjt7Liw", "buyer_ps_api_fail": true, } |
...
"data": [
{
"puretext_api_fail": 1,
"ai_generated_response": 1,
"incoherent_response": 0,
"duplicate_response": 0,
"language_mismatch": 0,
"question_id": “123A”
}
]
} |
Example for a termination due to PureText Deduplication:
POST https://spectrumsurveys.com/buyers/v2v3/transactions/ps_api_fail
Body:
Code Block | ||
---|---|---|
| ||
{ "questiontransaction_id": "4mWpY50Z5ZpovKkXjt7Liw", "456", "questions": [ { "question_id": ABC987, "text": "I prefer white chocolate over any other chocolate." } ] } |
Response which results in a termination:
Code Block | ||
---|---|---|
| ||
{ "transaction_id": "4mWpY50Z5ZpovKkXjt7Liw", "data": [ { "puretext_api_fail": 1, "ai_generated_response": 0, "incoherent_response": 0, "duplicate_response": 1, "language_mismatch": 0, "original_transaction_id": 3rWnTCAisTABjZEa2P3ZMF, "2W6ZHlCrBZIgyf9kH04Stb" } |
...
"question_id": “ABC987”
}
]
} |
When processing "transaction_id": "4mWpY50Z5ZpovKkXjt7Liw"
we found a duplicate answer which was first stated by "original_transaction_id": 3rWnTCAisTABjZEa2P3ZMF.
Example which processes 2 questions:
POST https://spectrumsurveys.com/buyers/v3/transactions/ps_api_fail
Body:
Code Block | ||
---|---|---|
| ||
{ "transaction_id": "4mWpY50Z5ZpovKkXjt7Liw", "questions": [ { "question_id": 1573, "text": "2W6ZHlCrBZIgyf9kH04Stb",I prefer dark chocolate over white chocolate. " }, { "buyer_ps_api_fail": true, "question_id": 1575, "text": "I prefer white chocolate over dark chocolate. " } ] } |
Response:
Code Block | ||
---|---|---|
| ||
{ "transaction_id": "4mWpY50Z5ZpovKkXjt7Liw", "data": [ { "puretext_api_fail": 0, "ai_generated_response": 0, "incoherent_response": 0, "duplicate_response": 0, "original_transactionlanguage_mismatch": 0, "question_id": 1573 }, "5WnZHkorNWIgyl7kH08gBt" { "puretext_api_fail": 0, "ai_generated_response": 0, "incoherent_response": 0, "duplicate_response": 0, "language_mismatch": 0, "question_id": 1575 } ] } |