The Case Converter API allows you to convert text between different letter cases such as Lower Case, Upper Case, Upsidedown, Reverse, Random, Proper, and Toggle.
"https://openapi-idk8.onrender.com/"
GET `/case`
Description: Converts the provided text to the specified case type.
GET `https://openapi-idk8.onrender.com/case?convert=Hello%20World&type=uppercase`
{
"api_info": {
"api_name": "Case Converter",
"description": "Easily convert text between different letter cases: Lower Case, Upper Case, Upsidedown, Reverse, Random, Proper, and Toggle. This API is ideal for developers who need to manipulate text formats for different use cases, such as user input normalization, text processing, or data presentation.",
"author": "OpenAPI"
},
"original": "Hello World",
"converted": "HELLO WORLD",
"type": "uppercase"
}
GET `/case/converters`
Description: Retrieves a list of available case conversion types.
GET `https://openapi-idk8.onrender.com/case/converters`
{
"converters": [
"uppercase",
"lowercase",
"upsidedown",
"reverse",
"random",
"proper",
"toggle"
]
}
400 Bad Request: Returned when the required query parameters are missing.
{
"error": "Both "convert" and "type" query parameters are required."
}
The API uses a conversion function to handle the text transformations:
const upsideDownMap = {
"a": "ɐ", "b": "q", "c": "ɔ", "d": "p", "e": "ǝ", "f": "ɟ", "g": "ƃ", "h": "ɥ", "i": "ᴉ",
"j": "ɾ", "k": "ʞ", "l": "l", "m": "ɯ", "n": "u", "o": "o", "p": "d", "q": "b", "r": "ɹ",
"s": "s", "t": "ʇ", "u": "n", "v": "ʌ", "w": "ʍ", "x": "x", "y": "ʎ", "z": "z",
"A": "∀", "B": "ᗺ", "C": "Ɔ", "D": "ᗡ", "E": "Ǝ", "F": "Ⅎ", "G": "⅁", "H": "H", "I": "I",
"J": "ſ", "K": "ʞ", "L": "⅃", "M": "W", "N": "N", "O": "O", "P": "Ԁ", "Q": "Ό", "R": "ᴚ",
"S": "S", "T": "⊥", "U": "∩", "V": "Λ", "W": "M", "X": "X", "Y": "⅄", "Z": "Z",
"1": "Ɩ", "2": "ᄅ", "3": "Ɛ", "4": "ㄣ", "5": "ϛ", "6": "9", "7": "ㄥ", "8": "8", "9": "6",
"0": "0", ".": "˙", ",": "'", "?": "¿", "!": "¡", "\"": ",", "'": ",", "(": ")", ")": "(",
"[": "]", "]": "[", "{": "}", "}": "{", "<": ">", ">": "<", "&": "⅋", "_": "‾", " ": " "
};
function convertCase(text, type) {
switch (type) {
case 'uppercase':
return text.toUpperCase();
case 'lowercase':
return text.toLowerCase();
case 'upsidedown':
return text.split('').map(char => upsideDownMap[char] || char).reverse().join('');
case 'reverse':
return text.split('').reverse().join('');
case 'random':
return text.split('').map(char => Math.random() > 0.5 ? char.toUpperCase() : char.toLowerCase()).join('');
case 'proper':
return text.replace(/\w\S*/g, (txt) => txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase());
case 'toggle':
return text.split('').map(char => char === char.toUpperCase() ? char.toLowerCase() : char.toUpperCase()).join('');
default:
return "Invalid converter type";
}
}
To use the API, make a GET request to the `/case` endpoint with the required query parameters:
fetch('https://openapi-idk8.onrender.com/case?convert=Hello%20World&type=upsidedown')
.then(response => response.json())
.then(data => console.log(data));