This is the CTA url where you want the user to be redirected to when they click on the button.
Response
curl -X POST \
-H "X-API-Key: YOUR_API_KEY_HERE" \
-H "Content-Type: application/json" \
-d '{
"url": "http://example.com",
"guidelines": "This is the CTA guidelines."
}' \
<BASE_URL>/cta-text
$url = '<BASE_URL>/cta-text';
$data = array(
'url' => 'https://example.com',
'guidelines' => 'This is the CTA guidelines.'
);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'X-API-Key: YOUR_API_KEY'
));
$response = curl_exec($ch);
curl_close($ch);
import requests
headers = {
'X-API-Key': 'YOUR_API_KEY_HERE',
'Content-Type': 'application/json'
}
data = {
'url': 'http://example.com',
'guidelines': 'This is the CTA guidelines.'
}
response = requests.post('<BASE_URL>/cta-text', headers=headers, json=data)
if response.status_code == 201:
cta_text = response.json()['cta_text']
print(cta_text)
else:
print(response.json()['error'])
const url = '<BASE_URL>/cta-text';
const data = {
url: 'http://example.com',
guidelines: 'This is the CTA guidelines.'
};
fetch(url, {
method: 'POST',
headers: {
'X-API-Key': 'YOUR_API_KEY_HERE',
'Content-Type': 'application/json'
},
body: JSON.stringify(data)
})
.then(response => response.json())
.then(data => {
if (data.cta_text) {
console.log(data.cta_text);
} else {
console.error(data.error);
}
})
.catch(error => console.error('Error:', error));
{
"cta_text": {
"cta1": {
"button": "Sign up now",
"header": "Sign up for our Meal Prep Service",
"text": "Enjoy chef-crafted fresh, healthy, and ready-to-eat meals throughout the week. Choose the one which fits your goals and lifestyle."
},
"cta2": {
"button": "Choose your plan",
"header": "Get Started with Houston Meal Prep",
"text": "Choose from our variety of meal plans. Free delivery all over Houston. Starting at $12.99/Meal."
},
"cta3": {
"button": "Order Now",
"header": "Boost Your Health with Our Pineapple Ginger Shot",
"text": "Try our powerful immune and digestive system booster. Free delivery all over Houston."
}
}
}