Text
Generate SEO Friendly text can be used in your website/campaign:
Endpoint
Description
- Method:
POST - Origin:
https://seo.lwe.ai/api - Route:
/google/generateSEOText - Accept:
application/json - Auth:
API_KEY
Body
{
"searchTerm": "<topic of your text>",
"type": "<how you want your text work as>",
}
How to use?
- JavaScript
- Python
- cURL
First, Install axios if not already installed:
npm i axios
Second, Call /generateSEOText endpoint:
// import axios
import axios from "axios"
// request body
const body = {
searchTerm: "mo salah",
type: "description"
}
// add your API_KEY in headers
const config = {
headers: {
API_KEY: "YOUR_API_KEY"
}
}
// call axios request
axios.post("https://seo.lwe.ai/api/google/generateSEOText", body, config).then(res=> {
console.log(res.data) // process response data
}).catch(err => {
console.error(err.message)
})
First, Install requests if not already installed:
pip install requests
Second, Call /generateSEOText endpoint:
# import requests
import requests
# request body
body = {
"searchTerm": "mo salah",
"type": "description"
}
# add your API_KEY in headers
headers = {
"API_KEY": "YOUR_API_KEY"
}
# call request
try:
res = requests.post("https://seo.lwe.ai/api/google/generateSEOText", json=body, headers=headers)
res.raise_for_status() # Check for HTTP errors
print(res.json()) # Process the JSON response
except requests.exceptions.RequestException as err:
print(f"An error occurred: {err}")
curl -X POST https://seo.lwe.ai/api/google/generateSEOText \
-H "Content-Type: application/json" \
-H "API_KEY: YOUR_API_KEY" \
-d "{\"searchTerm\": \"mo salah\",\"type\": \"description"}"
One line command cURL request:
curl -X POST https://seo.lwe.ai/api/google/generateSEOText -H "Content-Type: application/json" -H "API_KEY: YOUR_API_KEY" -d "{\"searchTerm\": \"mo salah\",\"type\": \"description\"}"
Sample Reponse Data
{
seoText: "Mo Salah, known as the Egyptian King, is a football sensation. His journey is a football fairy tale. Fans admire his skills and dedication. Photos of Mo Salah capture his iconic moments. The تيشرت مو صلاح is popular among supporters. محمد صلاح مو صلاح is a name celebrated worldwide. Mo Salah's influence extends beyond the pitch. His story inspires many. Discover more about مو صلاح محمد صلاح and his achievements. Celebrate the legacy of مو صلاح مو صلاح مو صلاح.",
keywords: [
"mo salah",
"egyptian king mo salah",
"mo salah a football fairy tale",
"photos mo salah",
"تيشرت مو صلاح",
"محمد صلاح مو صلاح",
"مو صلاح",
"مو صلاح محمد صلاح",
"مو صلاح مو صلاح",
"مو صلاح مو صلاح مو صلاح"
]
}
React Use Case
- Assume you are required to build a short biography about public character like Mohammed Salah.
- You need to find a suitable seo friendly title and description to fill the blanks in your page.
First, Generate your title
function PlayerBiography () {
const [title, setTitle] = useState("Loading...")
useEffect(() => {
// generate seo title
axios.post("https://seo.lwe.ai/api/google/generateSEOText", {
searchTerm: "mo salah biography",
type: "title"
}, {
headers: {
API_KEY: "YOUR_API_KEY"
}
}).then(res => {
setTitle(res.data.seoText)
}).catch((err) => {
console.error(err.message)
})
}, [])
return <h1>{title}</h1>
}
Second, Generate your Description
function PlayerBiography () {
const [description, setDescription] = useState("Loading...")
useEffect(() => {
// generate seo description
axios.post("https://seo.lwe.ai/api/google/generateSEOText", {
searchTerm: "mo salah biography",
type: "description"
}, {
headers: {
API_KEY: "YOUR_API_KEY"
}
}).then(res => {
setDescription(res.data.seoText)
}).catch((err) => {
console.error(err.message)
})
}, [])
return <p>{description}</p>
}
Finally, All in your page
Live Editor
function PlayerBiography () { const [title, setTitle] = useState("Loading...") const [description, setDescription] = useState("Loading...") useEffect(() => { // generate seo title axios.post("https://seo.lwe.ai/api/google/generateSEOText", { searchTerm: "mo salah biography", type: "title" }, { headers: { API_KEY: "YOUR_API_KEY" } }).then(res => { setTitle(res.data.seoText) }).catch((err) => { console.error(err.message) }) // generate seo description axios.post("https://seo.lwe.ai/api/google/generateSEOText", { searchTerm: "mo salah biography", type: "description" }, { headers: { API_KEY: "YOUR_API_KEY" } }).then(res => { setDescription(res.data.seoText) }).catch((err) => { console.error(err.message) }) }, []) return ( <div> <h1>{title}</h1> <p>{description}</p> </div> ) }
Result
Loading...