# Instance

## Content



Report services provide GET, POST, UPDATE, and DELETE methods to work with report instances. Report instances help you to create a new report instance, get information of the report instance and render the report instance. Your client application sends an HTTP request to the service application for using the report instances API to get the information for a particular report instance.

### [POST\] Create a new instance

To create a new report instance from the specified report, you need to use **POST** method. Report folder path and report name are specified in the request URL, as follows:

`POST: http://<host>[:port]/api/report/{folder path}/{report name}/$instances`<br />`Request URL: https://developer.mescius.com/componentone/demos/aspnet/5/c1webapi/latest/api/report/ReportsRoot/FlexCommonTasks/FlexCommonTasks.flxr/Simple%20List$instances`

**Parameters**

| **Parameter** | **Description** |
| --- | --- |
| Folder Path | Specify the full path of the executing report.<br />For example: FlexCommonTasks.flxr/Simple List |
| Report Name | Specify the report name that is defined in the FlexReport file, or under the SSRS folder. |
| Report Parameters | Check the response of action parameters. For example: pCategory=1&...<br /><br />If the parameter is multi-value, set the parameters multiple times. For example: pCategory=1&pCustomers=3&... |
| Report Page Settings | Set the page settings. Example: `paperSize=custom&height=10in&width=20.5cm` |

**Response Messages**

| **HTTP Status Code** | **Reason** |
| --- | --- |
| 201 | JSON string contains IReportInstanceInfo type object, for the new created instance. |
| 404 | The report path does not exist. |

### [GET\] Get report information

To get information of a report instance with the specified instance id, you need to use **GET** method. Report full path and Instance id are specified in the request URL, as follows:

`GET: http://<host>[:port]/api/report/{folder path}/{report name}/$instances/{instance id}`

**Parameters**

| **Parameter** | **Description** |
| --- | --- |
| Report Full Path | Specify the full path of the executing report.<br />For example: FlexCommonTasks.flxr/Simple List |
| Instance Id | Specify the instance id of the executing report. |

**Response Messages**

| **HTTP Status Code** | **Reason** |
| --- | --- |
| 200 | JSON string contains IReportInstanceInfo type object. |
| 404 | The report path or instance id does not exist. |

### [POST\] Render a report

To render a report instance with the specified instance id, you need to use **POST** method. Report full path and instance id are specified in the request URL, as follows:

`POST: http://<host>[:port]/api/report/{folder path}/{report name}/$instances/{instance id}/render`

**Parameters**

| **Parameter** | **Description** |
| --- | --- |
| Report Full Path | Specify the full path of the executing report.<br />For example: FlexCommonTasks.flxr/MultiValue DataBound Parameters |
| Instance Id | Specify the instance id of the executing report. |
| Report Parameters | Check the response of action parameters. For example: parameters.pCategory=1<br />If the parameter is multi-value, set the parameters multiple times. For example: pCategory=1&pCustomers=3&... |
| Report Page Settings | Set the page settings. For example: pageSettings.paperSize=custom&pageSettings.height=10in&pageSettings.width=20.5cm |
| Action String | Specify the action string. Action string is only valid for SSRS reports. We recommend you to use AdventureWorks (SSRS)/Product Line Sales report. For example: actionString=Sort;33iT0;Ascending |

**Response Messages**

| **HTTP Status Code** | **Reason** |
| --- | --- |
| 200 | (Render completed) JSON string contains IReportStatus type object. |
| 202 | (On Rendering) The render action is accepted. |
| 404 | The report path or instance id does not exist. |

### [GET\] Get status of a report

To get the status of the report instance with the specified instance id, you need to use **GET** method. Report full path and instance id are specified in the request URL, as follows:

`GET: http://<host>[:port]/api/report/{folder path}/{report name}$instances/{instance id}/status`

**Parameters**

| **Parameter** | **Description** |
| --- | --- |
| Report Full Path | Specify the full path of the executing report.<br />For example: FlexCommonTasks.flxr/Simple List |
| Instance Id | Specify the instance id of the executing report. |

**Response Messages**

| **HTTP Status Code** | **Reason** |
| --- | --- |
| 200 | JSON string contains IReportStatus type object. |
| 404 | The report path or instance id does not exist. |

### [DELETE\] Delete an instance

To delete the instance, you need to use **DELETE** method. Report full path and instance id are specified in the request URL, as follows:

`DELETE: http://<host>[:port]/api/report/{folder path}/{report name}/$instances/{instance id}`

**Parameters**

| **Parameter** | **Description** |
| --- | --- |
| Report Full Path | Specify the full path of the executing report.<br />For example: FlexCommonTasks.flxr/Simple List |
| Instance Id | Specify the instance id of the executing report. |

**Response Messages**

| **HTTP Status Code** | **Reason** |
| --- | --- |
| 204 | Successfully deleted the instance. |
| 404 | The report path or instance id does not exist. |

For more information about Report Instances. see [WebApiExplorer Demo](https://developer.mescius.com/componentone/demos/aspnet/5/webapiexplorer).