Get task result by taskId
curl --request GET \
--url https://ai.pmock.com/api/task/result/{taskId}import requests
url = "https://ai.pmock.com/api/task/result/{taskId}"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://ai.pmock.com/api/task/result/{taskId}', 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://ai.pmock.com/api/task/result/{taskId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$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://ai.pmock.com/api/task/result/{taskId}"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://ai.pmock.com/api/task/result/{taskId}")
.asString();require 'uri'
require 'net/http'
url = URI("https://ai.pmock.com/api/task/result/{taskId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"code": 200,
"message": "<string>",
"data": {
"empty": true
},
"traceId": "<string>"
}Task
Get task result by taskId
get the task execution result through the task ID
GET
/
task
/
result
/
{taskId}
Get task result by taskId
curl --request GET \
--url https://ai.pmock.com/api/task/result/{taskId}import requests
url = "https://ai.pmock.com/api/task/result/{taskId}"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://ai.pmock.com/api/task/result/{taskId}', 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://ai.pmock.com/api/task/result/{taskId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$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://ai.pmock.com/api/task/result/{taskId}"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://ai.pmock.com/api/task/result/{taskId}")
.asString();require 'uri'
require 'net/http'
url = URI("https://ai.pmock.com/api/task/result/{taskId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"code": 200,
"message": "<string>",
"data": {
"empty": true
},
"traceId": "<string>"
}Response result
The status has the following values: 1.waiting: Tasks waiting to be executed 2.success: The task has been successfully executed 3.executing: Task in progress 4.fail: Task execution failed 5.invoking: Task in progress Note that gpt-image supports base64 for generating images. If you choose base64, it will return resources.base64- success
- fail
{
"code": 200,
"data": {
"status": "success",
"taskId": "xxx",
"resources": [
{
"url": "xxx"
}
],
},
"message": "success",
"traceId": "xxx"
}
{
"code": 200,
"data": {
"status": "fail",
"taskId": "xxx",
"errorMessage": "timeout",
"errorCode": 10035
},
"message": "success",
"traceId": "xxx"
}
