# Virtual Model Alternation Result Query API Reference

### Virtual Model Alternation Query

<mark style="color:green;">`GET/POST`</mark> `/ai/virtual/model/generation/query`

{% tabs %}
{% tab title="Description" %}
You can use the task ID obtained from the Virtual Model Alternation submit API to query the generation results.
{% endtab %}
{% endtabs %}

### Request Parameters

| Parameter | Type   | Required | Description                                                        |
| --------- | ------ | -------- | ------------------------------------------------------------------ |
| `taskId`  | String | Yes      | The unique task ID. You can query the result according to task id. |

### Sample Request

{% tabs %}
{% tab title="Java SDK" %}

```javascript
IopClient client = new IopClientImp(url, appkey, appSecret);
IopRequest request = new IopRequest();
// Adding this trial tag in header means using the trial resource to test, 
// request.addHeaderParameter("x-iop-trial","true")
request.setApiName("/ai/virtual/model/generation/query");
request.addApiParameter("taskId", "4dcfa662-d5b3-48d5-842e-a87f70ac1522");
IopResponse response = client.execute(request);
System.out.println(response.getBody());
Thread.sleep(10);
```

{% endtab %}

{% tab title="Non-SDK and other languages" %}
We provide http based sample codes in the git code repository.

<https://github.com/Aidge-AI>
{% endtab %}
{% endtabs %}

### Response Parameters

| Parameter      | Type      | Description                                                                                                           |
| -------------- | --------- | --------------------------------------------------------------------------------------------------------------------- |
| `requestId`    | String    | A unique request ID used for troubleshooting.                                                                         |
| `success`      | Boolean   | The status of the returned request, indicating whether the request was successful.                                    |
| `resCode`      | Number    | The returned result code, where 200 indicates success. For detailed error codes, please refer to the error code list. |
| `resMessage`   | String    | The returned request information.                                                                                     |
| `data`         | Object    | The returned JSON result data.                                                                                        |
| `taskId`       | String    | A unique task ID. It is used for subsequent result query requests.                                                    |
| `taskMessage`  | String    | The returned task information.                                                                                        |
| `taskStatus`   | String    | Return the status of task execution.                                                                                  |
| `taskResult`   | Object\[] | Return the task results.                                                                                              |
| `imageUrlList` | String    | Return the list of URLs for the result images.                                                                        |
| `width`        | Number    | Width of the generated image.                                                                                         |
| `height`       | Number    | Height of the generated image.                                                                                        |

### Sample Request

{% tabs %}
{% tab title="JSON" %}

```javascript
{
  "data": {
    "taskResult": [
      {
        "width": 768,
        "url": "http://ai-business-algo-pai.oss-ap-southeast-1.aliyuncs.com/pengxin.zpx%2Fsd%2F5c8ed60687414a86ba82d4b1495ca3b7_20240626143842.png?OSSAccessKeyId=LTAI5tAGoBnm5eYsnZ5E1zMr&Expires=2719383922&Signature=5vdK7gHdSS0QmBjdvqaQH0HzbzA%3D",
        "height": 768
      },
      {
        "width": 768,
        "url": "http://ai-business-algo-pai.oss-ap-southeast-1.aliyuncs.com/pengxin.zpx%2Fsd%2F03d89662aa86472c894d4c60ef34357c_20240626143854.png?OSSAccessKeyId=LTAI5tAGoBnm5eYsnZ5E1zMr&Expires=2719383934&Signature=TMQuRFodJlwnvKyn4lohdoY0LTs%3D",
        "height": 768
      }
    ],
    "taskStatus": "finished",
    "taskId": "4dcfa662-d5b3-48d5-842e-a87f70ac1522"
  },
  "requestId": "2141111917193839534565721e1857",
  "success": true,
  "resCode": 200,
  "resMessage": "success",
  "code": "0",
  "request_id": "212a664f17193839534587406",
  "_trace_id_": "2141111917193839534565721e1857"
}
```

{% endtab %}
{% endtabs %}

### Errors

| Error Code | Error Message                                      | Description                                                                                                                                                                      |
| ---------- | -------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 500        | system error                                       | System error.                                                                                                                                                                    |
| 501        | rate limit exceed                                  | The current interface has reached the current limit. Please contact us via navigation bar or email us (<aidge_support@service.alibaba.com>) to increase the current limit value. |
| 700        | invalid input                                      | The format of the input parameters does not meet the requirements, and resMessage will return detailed fields that do not meet the requirements.                                 |
| 801        | model failed                                       | Internal call exception, please contact us via navigation bar or email us (<aidge_support@service.alibaba.com>) for troubleshooting.                                             |
| 1000       | content has sensitive data, please try other input | Content has sensitive data and cannot be handled now. Please try other input.                                                                                                    |
| 1001       | content control failed, please retry               | Content risk failed, please try other input. If an error persists,please contact us via navigation bar or email us (<aidge_support@service.alibaba.com>) for troubleshooting.    |
| 1002       | content risk filter failed, please contact us      | Content risk failed,please contact us via navigation bar or email us (<aidge_support@service.alibaba.com>).                                                                      |
