This API capitalizes the first letter of each sentence in a given text.
URL: https://api.apipip.com/v1/capitalize-first-letter-sentence/
Parameters
Name | Description |
---|---|
text |
(Required) (string): The input text to be capitalized. This should be a plain text string. |
Headers
Name | Description |
---|---|
X-Key |
(No required) |
How to use Capitalize First Letter of Each Sentence
import requests
# Set the API endpoint URL
url = 'https://api.apipip.com/v1/capitalize-first-letter-sentence/'
# Define the input text
data = {
"text": "hello. this is a sample text. welcome to the api."
}
# Send a POST request to the API endpoint
req = requests.post(url, json=data)
# Check if the request was successful
if req.status_code == 200:
# Retrieve the capitalized text from the response
capitalized_text = req.text
print(capitalized_text)
else:
print("Error:", req.text)
// Set the API endpoint URL
const url = 'https://api.apipip.com/v1/capitalize-first-letter-sentence/';
// Define the input text
const data = {
text: "hello. this is a sample text. welcome to the api."
};
// Send a POST request to the API endpoint
fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(data)
})
.then(response => {
// Check if the request was successful
if (response.ok) {
return response.text();
} else {
throw new Error('Error: ' + response.status);
}
})
.then(capitalizedText => {
// Retrieve the capitalized text from the response
console.log(capitalizedText);
})
.catch(error => {
console.log(error);
});
import Foundation
// Set the API endpoint URL
let url = URL(string: "https://api.apipip.com/v1/capitalize-first-letter-sentence/")!
// Define the input text
let text = "hello. this is a sample text. welcome to the api."
let data = ["text": text]
// Create the URLRequest
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpBody = try? JSONSerialization.data(withJSONObject: data)
// Send the request using URLSession
let task = URLSession.shared.dataTask(with: request) { (data, response, error) in
if let error = error {
print("Error: \(error)")
return
}
guard let data = data,
let responseString = String(data: data, encoding: .utf8) else {
print("Error: Invalid response data")
return
}
// Check if the request was successful
if let httpResponse = response as? HTTPURLResponse, httpResponse.statusCode == 200 {
// Retrieve the capitalized text from the response
print(responseString)
} else {
print("Error: \(responseString)")
}
}
task.resume()
API Response
{"Response":"Hello. This is a sample text. Welcome to the api."}
Note: The API works with all programming languages