API Documentation

This API allows you to generate HTML, CSS, and JavaScript code for a website based on a prompt. You can retrieve the code by calling the API with an API key, website name, and prompt.

API Endpoint

The API endpoint is:

https://ai.htmlwaveapp.com/api

Parameters

The API requires the following parameters:

Name Description
key The API key for your account.
type The type of the content you want to generate. use full-page to generate a full page, or element for a single component.
website-name The name of the website you want to generate code for. Don't add this parameter if you are generating a single component.
prompt The prompt for the website you want to generate code for. This can be any text that describes the website, such as "a personal portfolio with blue colors".

Response

The API returns a JSON object with the following fields:

Name Description
status A boolean value indicating whether the API call was successful.
html The HTML code for the website/component.
css The CSS code for the website/component.
javascript The JavaScript code for the website/component.
error If the API call was not successful, this field will contain an error message explaining why.

Examples

Here are some examples of how to call the API in some different programming languages:

PHP

<?php
$api_key = "api_key_here";
$website_name = "website_name_here";
$prompt = "prompt_here";

$url = "https://ai.htmlwaveapp.com/api?key=" . $api_key . "&type=full-page&website-name=" . $website_name . "&prompt=" . urlencode($prompt);

$response = file_get_contents($url);
$data = json_decode($response, true);

if ($data["status"]) {
    $html = $data["html"];
    $css = $data["css"];
    $javascript = $data["javascript"];
    echo "<p>HTML:</p><textarea>" . htmlspecialchars($html) . "</textarea><br>";
    echo "<p>CSS:</p><textarea>" . htmlspecialchars($css) . "</textarea><br>";
    echo "<p>JavaScript:</p><textarea>" . htmlspecialchars($javascript) . "</textarea><br>";
} else {
    echo "<p>Error:</p>" . $data["error"];
}
?>

Python

import urllib.request
import json

api_key = "api_key_here"
website_name = "website_name_here"
prompt = "prompt_here"

url = f"https://ai.htmlwaveapp.com/api?key={api_key}&type=full-page&website-name={website_name}&prompt={prompt}"

response = urllib.request.urlopen(url).read().decode()
data = json.loads(response)

if data["status"]:
    html = data["html"]
    css = data["css"]
    javascript = data["javascript"]
    print("HTML:", html)
    print("CSS:", css)
    print("JavaScript:", javascript)
else:
    print("Error:", data["error"])

C#

using System;
using System.Net;
using Newtonsoft.Json;

class Program
{
    static void Main(string[] args)
    {
        string api_key = "api_key_here";
        string website_name = "website_name_here";
        string prompt = "prompt_here";

        string url = $"https://ai.htmlwaveapp.com/api?key={api_key}&type=full-page&website-name={website_name}&prompt={WebUtility.UrlEncode(prompt)}";

        using (var wc = new WebClient())
        {
            var response = wc.DownloadString(url);
            dynamic data = JsonConvert.DeserializeObject(response);
            bool dataStatus = (bool)data.status.Value;

            if (dataStatus)
            {
                string html = data.html;
                string css = data.css;
                string javascript = data.javascript;
                Console.WriteLine($"HTML: {html}");
                Console.WriteLine($"CSS: {css}");
                Console.WriteLine($"JavaScript: {javascript}");
            }
            else
            {
                Console.WriteLine($"Error: {data.error}");
            }
        }
    }
}

JavaScript (jQuery)

$(document).ready(function() {
  var api_key = "api_key_here";
  var website_name = "website_name_here";
  var prompt = "prompt_here";
  var url = "https://ai.htmlwaveapp.com/api?key=" + api_key + "&type=full-page&website-name=" + website_name + "&prompt=" + encodeURIComponent(prompt);
  $.getJSON(url, function(data) {
    if (data.status) {
      $('#html').html(data.html);
      $('#css').text(data.css);
      $('#javascript').text(data.javascript);
    } else {
      console.log(data.error);
    }
  });
});

React (JSX)

import React, { useState, useEffect } from 'react';
import axios from 'axios';

function App() {
  const [html, setHtml] = useState('');
  const [css, setCss] = useState('');
  const [javascript, setJavascript] = useState('');

  useEffect(() => {
    const fetchData = async () => {
      const api_key = 'api_key_here';
      const website_name = 'website_name_Here';
      const prompt = 'prompt_here';
      const url = `https://ai.htmlwaveapp.com/api?key=${api_key}&type=full-page&website-name=${website_name}&prompt=${encodeURIComponent(prompt)}`;
      const response = await axios.get(url);
      if (response.data.status) {
        setHtml(response.data.html);
        setCss(response.data.css);
        setJavascript(response.data.javascript);
      } else {
        console.log(response.data.error);
      }
    };
    fetchData();
  }, []);

  return (
    <div>
      <h1>HTML:</h1>
      <div dangerouslySetInnerHTML={{ __html: html }} />
      <h1>CSS:</h1>
      <pre>{css}</pre>
      <h1>JavaScript:</h1>
      <pre>{javascript}</pre>
    </div>
  );
}

export default App;