curl -X POST "https://api.playground.try.be/shop/intake-form-sections/abc123/questions?site_id=site_abc123" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"question": "Do you have any allergies?",
"type": "additional_details",
"multiple_choice_answers": [
{
"id": 1,
"text": "string"
}
],
"multiple_select_option": "string",
"multiple_selection": false,
"additional_details": false,
"exact_number": "string",
"range": [
1
],
"terms_statement": "string",
"placeholder": "string",
"required": false
}'
const response = await fetch('https://api.playground.try.be/shop/intake-form-sections/abc123/questions?site_id=site_abc123', {
method: 'POST',
headers: {
Authorization: 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
Accept: 'application/json',
},
body: JSON.stringify({
"question": "Do you have any allergies?",
"type": "additional_details",
"multiple_choice_answers": [
{
"id": 1,
"text": "string"
}
],
"multiple_select_option": "string",
"multiple_selection": false,
"additional_details": false,
"exact_number": "string",
"range": [
1
],
"terms_statement": "string",
"placeholder": "string",
"required": false
}),
})
if (!response.ok) {
throw new Error(`Trybe API ${response.status}: ${await response.text()}`)
}
const data = await response.json()
import httpx
response = httpx.post(
"https://api.playground.try.be/shop/intake-form-sections/abc123/questions?site_id=site_abc123",
headers={
"Authorization": "Bearer YOUR_API_KEY",
"Accept": "application/json",
"Content-Type": "application/json",
},
json={
"question": "Do you have any allergies?",
"type": "additional_details",
"multiple_choice_answers": [
{
"id": 1,
"text": "string"
}
],
"multiple_select_option": "string",
"multiple_selection": False,
"additional_details": False,
"exact_number": "string",
"range": [
1
],
"terms_statement": "string",
"placeholder": "string",
"required": False
},
)
response.raise_for_status()
data = response.json()
<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('POST', 'https://api.playground.try.be/shop/intake-form-sections/abc123/questions?site_id=site_abc123', [
'headers' => [
'Authorization' => 'Bearer YOUR_API_KEY',
'Accept' => 'application/json',
'Content-Type' => 'application/json',
],
'json' => [
'question' => 'Do you have any allergies?',
'type' => 'additional_details',
'multiple_choice_answers' => [
[
'id' => 1,
'text' => 'string'
]
],
'multiple_select_option' => 'string',
'multiple_selection' => false,
'additional_details' => false,
'exact_number' => 'string',
'range' => [
1
],
'terms_statement' => 'string',
'placeholder' => 'string',
'required' => false
],
]);
$data = json_decode($response->getBody(), true);
package main
import (
"bytes"
"encoding/json"
"net/http"
)
func main() {
payload, _ := json.Marshal(map[string]interface{}{
"question": "Do you have any allergies?",
"type": "additional_details",
"multiple_choice_answers": []interface{}{
map[string]interface{}{
"id": 1,
"text": "string",
},
},
"multiple_select_option": "string",
"multiple_selection": false,
"additional_details": false,
"exact_number": "string",
"range": []interface{}{
1,
},
"terms_statement": "string",
"placeholder": "string",
"required": false,
})
req, _ := http.NewRequest("POST", "https://api.playground.try.be/shop/intake-form-sections/abc123/questions?site_id=site_abc123", bytes.NewBuffer(payload))
req.Header.Set("Authorization", "Bearer YOUR_API_KEY")
req.Header.Set("Accept", "application/json")
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
var data map[string]interface{}
json.NewDecoder(resp.Body).Decode(&data)
}