Polling
POST https://api.newportai.com/api/getAsyncResult
Polling the asynchronous result by this API.
- Use Polling API to get result with POST method.
Request Header Parameters
- Content-TypestringRequiredEnumapplication/json
- AuthorizationstringRequiredBearer authentication format, for example: Bearer
Request Body Parameters
- taskIDstringtask id return by task API.
Response
- codestringint Operation code, 0 indicates success, non-0 indicates failure
- messagestringOperation prompt message
- dataobjectRequest content
- taskobjectTask-related information
- taskIdstringtask id
- statusintTask status code, integer value, enumeration. 1 task submission; 2 The task is in progress; 3 The task is successful. 4 Task Failure
- reasonstringProvides the reason for a task's failure.
- taskTypestringtask type
- imageslistimages result
- imageUrlstringimage url
- imageTypestringimage type (jpg,png..)
- videoslistvideos result
- videoUrlstringvideo url
- videoTypestringvideo type (mp4..)
- audioslistaudios result
- audioUrlstringaudio url
- audioTypestringaudio type(wav..)
- cloneIdstringclone id, only from voice_clone. Once generated, you can always use it in Do TTS Clone.
Example
Request:
zsh
curl -X POST 'https://api.newportai.com/api/getAsyncResult' \
-H "Authorization: Bearer {{key}}" \
-H 'Content-Type: application/json' \
-d '{
"taskId": "b08337dc08d7428daa64b3d5e61b8350"
}'
Response:
json
{
"code": 0,
"message": "success",
"data": {
"task": {
"taskId": "b08337dc08d7428daa64b3d5e61b8350",
"status": 3,
"reason": "",
"taskType": "inpainting"
},
"images": [{
"imageUrl": "https://dreamface-resource-new.s3.amazonaws.com/server/aigc/main/e8fb9818-869c-4f49-93dd-adb1648d0352.jpg",
"imageType": "jpg"
}],
"videos": [{
"videoUrl": "https://s3.amazonaws.com/pt-resource-new/algorithm/2024-09-10/11ddd0315d4bb373.mp4",
"videoType": "mp4"
}],
"audios": [{
"audioUrl": "https://s3.amazonaws.com/pt-tts-new/oneshot_tts_result/20241115/_/4213350.wav",
"audioType": ".wav"
}],
"cloneId": "40dc8e22ab179680ec5480f9fb32d1ec"
}
}