Create Image
curl --request POST \
--url https://api.aisa.one/apis/v1/htmlcss-to-image/create-image \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data @- <<EOF
{
"html": "<div class='card'>Hello</div>",
"media_type": "screen",
"ms_delay": 5000,
"render_when_ready": false
}
EOFimport requests
url = "https://api.aisa.one/apis/v1/htmlcss-to-image/create-image"
payload = {
"html": "<div class='card'>Hello</div>",
"media_type": "screen",
"ms_delay": 5000,
"render_when_ready": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
html: '<div class=\'card\'>Hello</div>',
media_type: 'screen',
ms_delay: 5000,
render_when_ready: false
})
};
fetch('https://api.aisa.one/apis/v1/htmlcss-to-image/create-image', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.aisa.one/apis/v1/htmlcss-to-image/create-image",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'html' => '<div class=\'card\'>Hello</div>',
'media_type' => 'screen',
'ms_delay' => 5000,
'render_when_ready' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.aisa.one/apis/v1/htmlcss-to-image/create-image"
payload := strings.NewReader("{\n \"html\": \"<div class='card'>Hello</div>\",\n \"media_type\": \"screen\",\n \"ms_delay\": 5000,\n \"render_when_ready\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.aisa.one/apis/v1/htmlcss-to-image/create-image")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"html\": \"<div class='card'>Hello</div>\",\n \"media_type\": \"screen\",\n \"ms_delay\": 5000,\n \"render_when_ready\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aisa.one/apis/v1/htmlcss-to-image/create-image")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"html\": \"<div class='card'>Hello</div>\",\n \"media_type\": \"screen\",\n \"ms_delay\": 5000,\n \"render_when_ready\": false\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"url": "<string>"
}HTML/CSS 转图片
Create Image
Create Image
POST
https://api.aisa.one
/
apis
/
v1
/
htmlcss-to-image
/
create-image
Create Image
curl --request POST \
--url https://api.aisa.one/apis/v1/htmlcss-to-image/create-image \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data @- <<EOF
{
"html": "<div class='card'>Hello</div>",
"media_type": "screen",
"ms_delay": 5000,
"render_when_ready": false
}
EOFimport requests
url = "https://api.aisa.one/apis/v1/htmlcss-to-image/create-image"
payload = {
"html": "<div class='card'>Hello</div>",
"media_type": "screen",
"ms_delay": 5000,
"render_when_ready": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
html: '<div class=\'card\'>Hello</div>',
media_type: 'screen',
ms_delay: 5000,
render_when_ready: false
})
};
fetch('https://api.aisa.one/apis/v1/htmlcss-to-image/create-image', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.aisa.one/apis/v1/htmlcss-to-image/create-image",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'html' => '<div class=\'card\'>Hello</div>',
'media_type' => 'screen',
'ms_delay' => 5000,
'render_when_ready' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.aisa.one/apis/v1/htmlcss-to-image/create-image"
payload := strings.NewReader("{\n \"html\": \"<div class='card'>Hello</div>\",\n \"media_type\": \"screen\",\n \"ms_delay\": 5000,\n \"render_when_ready\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.aisa.one/apis/v1/htmlcss-to-image/create-image")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"html\": \"<div class='card'>Hello</div>\",\n \"media_type\": \"screen\",\n \"ms_delay\": 5000,\n \"render_when_ready\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aisa.one/apis/v1/htmlcss-to-image/create-image")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"html\": \"<div class='card'>Hello</div>\",\n \"media_type\": \"screen\",\n \"ms_delay\": 5000,\n \"render_when_ready\": false\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"url": "<string>"
}请求规范
- 方法与路径: POST /apis/v1/htmlcss-to-image/create-image
- 可用状态: enabled
- 请求 URL 模板:
https://api.aisa.one/apis/v1/htmlcss-to-image/create-image
{
"operationId": "htmlcss-to-image.create-image",
"method": "POST",
"path": "/apis/v1/htmlcss-to-image/create-image",
"servers": [
{
"url": "https://api.aisa.one"
}
],
"parameters": [],
"security": [
{
"bearerAuth": []
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"properties": {
"additional_header_origins": {
"description": "Up to 20 unique exact HTTP(S) origins that may also receive headers.",
"examples": [
[
"https://assets.example.com"
]
],
"items": {
"type": "string"
},
"maxItems": 20,
"type": "array"
},
"block_consent_banners": {
"default": false,
"description": "Attempt to block common consent banners.",
"type": "boolean"
},
"color_scheme": {
"description": "Preferred browser color scheme: light or dark.",
"enum": [
"light",
"dark"
],
"type": "string"
},
"css": {
"description": "CSS applied to supplied HTML or injected into a captured webpage.",
"examples": [
".card { padding: 24px; }"
],
"type": "string"
},
"dedupe_duration_s": {
"description": "Reuse a matching recent render for this many seconds. Allowed durations depend on the account plan; free accounts accept 0 or 2592000 (30 days).",
"minimum": 0,
"type": "integer"
},
"device_scale": {
"default": 2,
"description": "Device scale factor from 0.1 to 3.",
"maximum": 3,
"minimum": 0.1,
"type": "number"
},
"full_screen": {
"default": false,
"description": "Capture the full scrollable page instead of only the viewport.",
"type": "boolean"
},
"google_fonts": {
"description": "Google Font family names to load while rendering.",
"examples": [
[
"Inter",
"Roboto"
]
],
"items": {
"type": "string"
},
"type": "array"
},
"headers": {
"additionalProperties": {
"type": "string"
},
"description": "HTTP headers sent to the captured page, with at most 20 case-insensitive names.",
"examples": [
{
"X-Preview-Mode": "true"
}
],
"maxProperties": 20,
"type": "object"
},
"html": {
"description": "HTML to render. Set this or url, but not both.",
"examples": [
"<div class='card'>Hello</div>"
],
"minLength": 1,
"type": "string"
},
"include_headers_on_subrequests": {
"default": false,
"description": "Also include supplied headers on page subrequests.",
"type": "boolean"
},
"max_wait_ms": {
"description": "Maximum wait from 500 to 10000 milliseconds for page loading.",
"maximum": 10000,
"minimum": 500,
"type": "integer"
},
"media_type": {
"description": "CSS media type used while rendering: screen or print.",
"enum": [
"screen"
],
"type": "string"
},
"ms_delay": {
"description": "Extra render delay in milliseconds, from 0 to 10000. Zero omits the explicit delay.",
"maximum": 10000,
"minimum": 1,
"type": "integer"
},
"render_when_ready": {
"description": "Wait until the page signals that rendering is ready.",
"enum": [
false
],
"type": "boolean"
},
"selector": {
"description": "CSS selector for the element to capture.",
"examples": [
"#invoice"
],
"type": "string"
},
"timezone": {
"description": "IANA timezone exposed to the rendered page.",
"examples": [
"America/New_York"
],
"type": "string"
},
"transparent_background": {
"default": false,
"description": "Render a transparent background where supported.",
"type": "boolean"
},
"url": {
"description": "Absolute, internet-reachable HTTP(S) webpage URL to capture. Set this or html, but not both; use headers for authenticated pages.",
"examples": [
"https://example.com"
],
"type": "string"
},
"viewport_height": {
"description": "Viewport height in pixels. Requires viewport_width.",
"minimum": 1,
"type": "integer"
},
"viewport_width": {
"description": "Viewport width in pixels, from 1 to 6000. Requires viewport_height.",
"maximum": 6000,
"minimum": 1,
"type": "integer"
}
},
"required": [
"html",
"media_type",
"ms_delay",
"render_when_ready"
],
"type": "object"
}
}
},
"required": true
},
"x-aisa-status": "enabled",
"components": {
"securitySchemes": {
"bearerAuth": {
"scheme": "bearer",
"type": "http"
}
}
}
}
费用与请求规则
按实际用量收费。 默认请求预估费用:$0.0143 USD。 最终费用以实际用量为准。 账户适用价格可能不同;支持报价的接口可按实际请求获取报价。授权
请求体
application/json