Consultar resultado da tarefa
curl --request GET \
--url https://api.highwayapi.ai/v3/async/task-result \
--header 'Authorization: <authorization>' \
--header 'Content-Type: <content-type>'import requests
url = "https://api.highwayapi.ai/v3/async/task-result"
headers = {
"Content-Type": "<content-type>",
"Authorization": "<authorization>"
}
response = requests.get(url, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {'Content-Type': '<content-type>', Authorization: '<authorization>'}
};
fetch('https://api.highwayapi.ai/v3/async/task-result', 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.highwayapi.ai/v3/async/task-result",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: <content-type>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.highwayapi.ai/v3/async/task-result"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Content-Type", "<content-type>")
req.Header.Add("Authorization", "<authorization>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.highwayapi.ai/v3/async/task-result")
.header("Content-Type", "<content-type>")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.highwayapi.ai/v3/async/task-result")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Content-Type"] = '<content-type>'
request["Authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"extra": {
"seed": "<string>",
"debug_info": {
"request_info": "<string>",
"submit_time_ms": "<string>",
"execute_time_ms": "<string>",
"complete_time_ms": "<string>"
}
},
"task": {
"task_id": "<string>",
"status": "<string>",
"reason": "<string>",
"task_type": "<string>",
"eta": 123,
"progress_percent": 123
},
"images": [
{
"image_url": "<string>",
"image_url_ttl": 123,
"image_type": "<string>"
}
],
"videos": [
{
"video_url": "<string>",
"video_url_ttl": "<string>",
"video_type": "<string>"
}
],
"audios": [
{
"audio_url": "<string>",
"audio_url_ttl": "<string>",
"audio_type": "<string>",
"audio_metadata": {
"text": "<string>",
"start_time": 123,
"end_time": 123
}
}
]
}Noções básicas da API
Consultar resultado da tarefa
GET
/
v3
/
async
/
task-result
Consultar resultado da tarefa
curl --request GET \
--url https://api.highwayapi.ai/v3/async/task-result \
--header 'Authorization: <authorization>' \
--header 'Content-Type: <content-type>'import requests
url = "https://api.highwayapi.ai/v3/async/task-result"
headers = {
"Content-Type": "<content-type>",
"Authorization": "<authorization>"
}
response = requests.get(url, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {'Content-Type': '<content-type>', Authorization: '<authorization>'}
};
fetch('https://api.highwayapi.ai/v3/async/task-result', 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.highwayapi.ai/v3/async/task-result",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: <content-type>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.highwayapi.ai/v3/async/task-result"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Content-Type", "<content-type>")
req.Header.Add("Authorization", "<authorization>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.highwayapi.ai/v3/async/task-result")
.header("Content-Type", "<content-type>")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.highwayapi.ai/v3/async/task-result")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Content-Type"] = '<content-type>'
request["Authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"extra": {
"seed": "<string>",
"debug_info": {
"request_info": "<string>",
"submit_time_ms": "<string>",
"execute_time_ms": "<string>",
"complete_time_ms": "<string>"
}
},
"task": {
"task_id": "<string>",
"status": "<string>",
"reason": "<string>",
"task_type": "<string>",
"eta": 123,
"progress_percent": 123
},
"images": [
{
"image_url": "<string>",
"image_url_ttl": 123,
"image_type": "<string>"
}
],
"videos": [
{
"video_url": "<string>",
"video_url_ttl": "<string>",
"video_type": "<string>"
}
],
"audios": [
{
"audio_url": "<string>",
"audio_url_ttl": "<string>",
"audio_type": "<string>",
"audio_metadata": {
"text": "<string>",
"start_time": 123,
"end_time": 123
}
}
]
}A「API de consulta de resultado da tarefa」é usada para obter os resultados de imagem, áudio ou vídeo retornados por tarefas assíncronas.
Cabeçalhos da solicitação
string
obrigatório
Valores enumerados:
application/jsonstring
obrigatório
Formato de autenticação Bearer: Bearer {{API Key}}.
Parâmetros de consulta
string
obrigatório
O valor de task_id retornado na resposta 200 da API assíncrona.
Parâmetros de informações da resposta
object
Mostrar propriedades
Mostrar propriedades
string
object
Informações de depuração
Mostrar propriedades
Mostrar propriedades
object
obrigatório
Informações detalhadas da tarefa.
Ocultar propriedades
Ocultar propriedades
string
obrigatório
ID da tarefa.
string
obrigatório
Status atual da tarefa. Valores enumerados:
TASK_STATUS_QUEUED: tarefa na fila, aguardando processamento;TASK_STATUS_SUCCEED: tarefa concluída com sucesso;TASK_STATUS_FAILED: falha na tarefa;TASK_STATUS_PROCESSING: tarefa em processamento;
string
Motivo da falha da tarefa; este campo é válido quando a tarefa falha.
string
obrigatório
Tipo da tarefa.
number
Tempo estimado para conclusão da tarefa, em segundos. Este campo é válido apenas para algumas APIs.
number
Percentual de progresso de conclusão da tarefa. No momento, este recurso se aplica apenas a:
1. API de geração de vídeo;
2. API de texto para imagem e API de imagem para imagem.
1. API de geração de vídeo;
2. API de texto para imagem e API de imagem para imagem.
object[]
object[]
object[]
Retorna os resultados de áudios de saída para tarefas do tipo áudio.
Mostrar propriedades
Mostrar propriedades
string
URL do áudio.
string
Tempo de expiração da URL do áudio (em segundos). O valor padrão é 3600 segundos.
string
Tipo de áudio. Valores enumerados:
wav⌘I