Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Description: This API checks for the Open-Ended (OE) survey responses to ensure data quality. It performs language comparison, AI-generated answer detection, exclusion list checks, and response deduplication. Implement the API endpoint after every open-ended question into your survey.

  • 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 text: Flags any unacceptable responses such as jibberish, curse words, etc.

  • PureText Deduplication: Ensures the answer's uniqueness through deduplication.

PureText should only be used:

  • 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)

Request

POST $apihost/$basepath/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:

Body:

{
  "question_id": "alpha numberic",
  "text": "string",
  "transacion_id": "2W6ZHlCrBZIgyf9kH04Stb"
}

Result:

Response Body:

{
    "transaction_id": "2W6ZHlCrBZIgyf9kH04Stb",
    "buyer_ps_api_fail": true,
}

If "buyer_ps_api_fail": true terminate the session with status code 84.

URL: https://spectrumsurveys.com/surveydone?st=84&transaction_id=[transaction_id]

Response Codes:

  • 200 OK: The validation process was completed successfully.

  • 400 Bad Request: Invalid input or missing fields in the payload.

Error:

The API can only be used for valid transactions.

{
    "ps_buy_api_status_code": 1014,
    "ps_api_response_message": "Invalid transaction"
}

The API requires all parameters to be valid and present.

{
    "ps_buy_api_status_code": 1014,
    "ps_api_response_message": "Invalid parameters: Answer Text, Question Code/Id or Transaction Id is missing."
}

Example 1 for a termination due to AI detection:

POST https://spectrumsurveys.com/buyers/v2/transactions/ps_api_fail

Body:

{
  "question_id": "123",
  "text": "As an AI language model I don't have a personal opinion.",
  "transaction_id": "2W6ZHlCrBZIgyf9kH04Stb"
}

Response which results in a termination:

{
    "transaction_id": "2W6ZHlCrBZIgyf9kH04Stb",
    "buyer_ps_api_fail": true,
}

Example 2 for a termination due to PureText Deduplication:

POST https://spectrumsurveys.com/buyers/v2/transactions/ps_api_fail

Body:

{
  "question_id": "456",
  "text": "I prefer white chocolate over any other chocolate.",
  "transaction_id": "2W6ZHlCrBZIgyf9kH04Stb"
}

Response which results in a termination:

{
    "transaction_id": "2W6ZHlCrBZIgyf9kH04Stb",
    "buyer_ps_api_fail": true,
    "original_transaction_id": "5WnZHkorNWIgyl7kH08gBt"
}

  • No labels