task management overview
Video, digital human, music, partial pictures and reprocessing capabilities are run in asynchronous tasks. After task, MoonNexAI returns task ID; you can either ask for information or receive a completion notification via WebHOK.
TasksAsynchronous tasks View the generic task structure, state, polling recommendations and results URL. . GETQuery tasks copy the General Query request, understand the result URL and failed field. WebhookWebhooks and callbacksReceive completion notifications and handle success and failure payloads.Errors error code addresses the failure of authentication, parameters, amount, frequency and task.
Common process
- Submit task.
- Saves returned
task_idorid. - Actively query task status, or wait for Webhook.
- task reads the URL after success.
- task was read when
fail_reason,error.codeanderror.messagefailed.
Common Query Entry
| Capacity | Query Path |
|---|---|
| Universal task | GET /v1/tasks/{task_id} |
| Music task | GET /v1/tasks/{task_id} |
| digital human Audio | GET /v1/tasks/{task_id} |
| digital human Video | GET /v1/tasks/{task_id} |
| Video task | GET /v1/videos/{task_id} |
| Midjourney task | GET /mj/task/{id}/fetch |
Status statement
| Status | Annotations | Recommendations |
|---|---|---|
pending | Systems are in preparation. | Further queries will be made later. |
submitted | Submitted, pending processing. | Further queries will be made later. |
running | Processing. | Keep waiting. |
succeeded | Achieved. | Reads the URL of the result. |
failed | task failed. | See the reason for the failure and decide whether to try again. |
cancelled | task cancelled. | Stops the query. |
Some tasks return uppercase states such as SUBMITTED, QUEUED, IN_PROGRESS, SUCCESS and FAILURE. Your application can normalize these to waiting, processing, succeeded and failed.
Webhook Recommendations
- Your webhook endpoint should return
2xxwithin 10 seconds. - Press
task_idfor processing, etc. - Do not place API Key, user token or other sensitive information in callback URL.
- Even if Webhook is enabled, the active search capability is maintained.