Real-time URL request
Basic Request Syntax
Basic real-time requests to the Web API are made using the https://api.webit.live/api/v1/realtime/web endpoint. A simple request uses the following syntax:
curl -X POST 'https://api.webit.live/api/v1/realtime/web' \
--header 'Authorization: Basic <credential string>' \
--header 'Content-Type: application/json' \
--data-raw '{
"url": "https://www.example.com"
}'import requests
url = 'https://api.webit.live/api/v1/realtime/web'
headers = {
'Authorization': 'Basic <credential string>',
'Content-Type': 'application/json'
}
data = {
"url": "https://www.example.com"
}
response = requests.post(url, headers=headers, json=data)const axios = require('axios');
const url = 'https://api.webit.live/api/v1/realtime/web';
const headers = {
'Authorization': 'Basic <credential string>',
'Content-Type': 'application/json'
};
const data = {
"url": "https://www.example.com"
};
axios.post(url, data, { headers })
.then(response => {
console.log(response.status);
console.log(response.data);
})
.catch(error => {
console.error(error);
});package main
import (
"bytes"
"encoding/base64"
"fmt"
"net/http"
"encoding/json"
)
func main() {
url := "https://api.webit.live/api/v1/realtime/web"
payload := []byte(`{
"url": "https://www.example.com"
}`)
headers := map[string]string{
"Authorization": "Basic <credential string>",
"Content-Type": "application/json",
}
req, err := http.NewRequest("POST", url, bytes.NewBuffer(payload))
if err != nil {
fmt.Println(err)
return
}
for key, value := range headers {
req.Header.Set(key, value)
}
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer resp.Body.Close()
fmt.Println(resp.StatusCode)
// Read the response body if needed
// body, err := ioutil.ReadAll(resp.Body)
// fmt.Println(string(body))
}“URL” is the only required parameter that must be sent with each request besides the credential string, and defines the address from which to collect data. Additional parameters, such as geolocation targeting, parsing control, and custom headers can also be added.
Response
If successful, the WebAPI will return a 200 OK status with the following data structure:
{
"status": "success",
"html_content": string,
"parsing": {
"status": "success",
"entities": { },
"total_entities_count": 0,
"entities_count": { }
}
}The html_content node contains the full HTML of the requested page, and if parsing was enabled, the parsingnode will contain a structured JSON object of the data.
Last updated
