Skip to content

Binary Choice

Binary Choice

The binaryChoice API is used to submit a Binary Choice to the Feedback API. This API is used to collect feedback from users in the form of a binary choice response.

API BASE URL: https://addhuri.com/api/lib/feedback

POST API

This POST request can be used to submit a Binary Choice to the Feedback API.

Request Endpoint

POST /binaryChoice

Request Headers

Use the poster API key in the request headers to authenticate the request.

{
"Content-Type": "application/json",
"x-api-key-poster": "YOUR_POSTER_API_KEY",
}

Request Body

{
"question": "string",
"options": [
{
"text": "string",
"value": "string",
"data": {}
}
],
"selectedOptions": [
{
"text": "string",
"value": "string",
"data": {}
}
],
"data": {}
}

Response Body

{
"data": {
"id": "string"
},
"message": "Feedback saved successfully",
"status": "success"
}

Example

Here is an example of how to submit a Binary Choice to the Feedback API using different programming languages and tools.

const API_BASE_URL = 'https://addhuri.com/api/lib/feedback'
const URL = `${API_BASE_URL}/binaryChoice`
const POSTER_API_KEY = 'YOUR_POSTER_API_KEY'
fetch(URL, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-api-key-poster': POSTER_API_KEY
},
body: JSON.stringify({
question: "Was this document helpful?",
options: [
{
text: "Yes",
value: "true",
data: {}
},
{
text: "No",
value: "false",
data: {}
}
],
selectedOptions: [
{
text: "Yes",
value: "true",
data: {}
}
],
data: {}
})
})

GET API

This GET request can be used to retrieve records from the Feedback API.

Request Endpoint

GET /binaryChoice

Request Headers

Use the master API key in the request headers to authenticate the request.

{
"Content-Type": "application/json",
"x-api-key-master": "YOUR_MASTER_API_KEY",
}

Request Query Parameters

Use the following query parameters to retrieve records from the Feedback API.

GET /binaryChoice?page=1&limit=10

ParameterTypeDefaultMinMaxDescription
pagenumber11-The page number to retrieve.
limitnumber101100The number of items to retrieve per page.

Response Body

The response will contain an array of Binary Choice.

{
"data": [
{
"type": "BinaryChoice",
"id": "a618334e-71a2-4a33-8545-4afb68b524af",
"createdAt": "2025-01-05T12:19:00.252Z",
"updatedAt": "2025-01-05T12:19:00.252Z",
"question": "Did you experience any errors or inconsistencies while using our API?",
"options": [
{
"text": "Yes",
"value": true,
"data": {}
},
{
"text": "No",
"value": false,
"data": {}
}
],
"selectedOptions": [
{
"text": "No",
"value": false,
"data": {}
}
],
"data": {}
},
{
"type": "BinaryChoice",
"id": "6149da05-8f8e-497c-b391-178a03e8818d",
"createdAt": "2025-01-05T12:17:35.567Z",
"updatedAt": "2025-01-05T12:17:35.567Z",
"question": "Were the API documentation and resources provided sufficient for your needs?",
"options": [
{
"text": "Yes",
"value": true,
"data": {}
},
{
"text": "No",
"value": false,
"data": {}
}
],
"selectedOptions": [
{
"text": "Yes",
"value": true,
"data": {}
}
],
"data": {}
}
],
"page": 1,
"limit": 10,
"total": 2,
"totalPages": 1,
"message": "",
"status": "success"
}

Example

Here is an example of how to submit a Binary Choice to the Feedback API using different programming languages and tools.

const API_BASE_URL = 'https://addhuri.com/api/lib/feedback'
const URL = `${API_BASE_URL}/binaryChoice`
const MASTER_API_KEY = 'YOUR_MASTER_API_KEY'
fetch(URL, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
'x-api-key-master': MASTER_API_KEY
}
})