> This page is for Itential Platform On-Prem, version 2023.2.
> For other versions, use one of these documentation indexes:
> - 6 (default): https://docs-test.itntl.com/itential-platform/6/llms.txt
> - 2023.2: https://docs-test.itntl.com/itential-platform/2023-2/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs-test.itntl.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs-test.itntl.com/_mcp/server.

# Config dry run

POST http://localhost:3000/service_management/testInstances
Content-Type: application/json

Calculates the minimum device configuration commands required to save new service instances or update existing service instances.

Reference: https://docs-test.itntl.com/itential-platform/2023-2/api-reference/service-management/service-cog-test-instances

## Authentication

- `Authorization` header (basic auth, required) — Basic authentication of the form `Basic <base64(username:password)>`.

## Request

### Body (application/json)

This endpoint expects an object.

- `instance` (service_management_serviceManagerDoc_instance, optional)
- `options` (ServiceManagementTestInstancesPostRequestBodyContentApplicationJsonSchemaOptions, optional)

## Response

### 200

An object containing dry-run results for the service instances being provisioned suitable as input to the ViewTestService job task.

- `device` (ServiceManagementTestInstancesPostResponsesContentApplicationJsonSchemaDevice, required)
- `success` (boolean, required) — A false value indicates a runtime problem.

## Errors

### 500 Internal Server Error

Error response from API

- `any`

## Types

### service_management_serviceManagerDoc_instance

- `servicePath` (list of ServiceManagementServiceManagerDocInstanceServicePathItems, optional) — The servicePath key is a service model's XPATH. The value is an array of objects. Each array element represents an instance of a service model.

### ServiceManagementTestInstancesPostRequestBodyContentApplicationJsonSchemaOptions

### ServiceManagementTestInstancesPostResponsesContentApplicationJsonSchemaDevice

### ServiceManagementServiceManagerDocInstanceServicePathItems

An object representing an instance of a service model. Properties are specific to a service model.

### service_management_serviceManagerDoc_serviceInstanceOptions

Optional parameters for testInstances and saveInstances using the new style parameters which support all commit flags. The skip-validation property MUST be included to use this option set. Other properties are optional. With skip-validation, the options object will be parsed and sent to NSO without being validated by the adapter, and the order of the options does matter in several cases.

- `skip-validation` (any, optional) — Required to enable commit flag support.
- `dryrun` (ServiceManagementServiceManagerDocServiceInstanceOptionsDryrun, optional) — Use dryrun commit flag. If not dryrun is not set when running testInstances, it will be added with outformat defaulting to native.
- `commit-queue` (ServiceManagementServiceManagerDocServiceInstanceOptionsCommitQueue, optional)
- `no-deploy` (any, optional) — The no-deploy flag makes a commit without invoking the service create method.
- `no-revision-drop` (any, optional) — Uses no-revision-drop flag. Forces NSO to not silently drop data set operations.
- `no-networking` (any, optional) — The no-networking flag does not send data to the devices.
- `no-out-of-sync-check` (any, optional) — The no-out-of-sync-check flag continues with a transaction even when NSO detect an out of sync device. Can't be used with no-overwrite flag.
- `no-overwrite` (any, optional) — The no-overwrite flag checks that the data that should be modified has not changed on the device compared to NSO's view of the data. Can't be used with no-out-of-sync-check.
- `use-lsa` (any, optional) — The use-lsa flag forces handling of LSA nodes as such. Propogates the following flags, if used, to LSA nodes but not upper NSO node: dry-run, no-networking, no-out-of-sync-check, no-overwrite, no-revision-drop.
- `no-lsa` (any, optional) — The no-lsa flag will not handle LSA nodes as such.

### service_management_serviceManagerDoc_testInstanceOptions

Optional parameters for testInstances using the old style parameters with partial commit flag support.

- `force` (boolean, optional) — Use no-out-of-sync-check commit flag.
- `outformat` (enum, optional) — Use dryrun commit flag and set results outformat to cli, native, or xml. If not set, defaults to native.
  - Allowed values: `cli`, `native`, `xml`
- `reverse` (boolean, optional) — Use the reverse commit flag. Requires dryrun to be set.
- `raw` (boolean, optional) — Sets dryrun output to raw mode. Only works when dryrun outformat is set to native.

### device

A JSON containing device hostname(s) and their configuration commands required to save new service instances or update existing service instances. This is returned when only one service instance is passed to testInstances.

- `name` (string, optional)
- `data` (string, optional)

### ServiceManagementServiceManagerDocServiceInstanceOptionsDryrun

Use dryrun commit flag. If not dryrun is not set when running testInstances, it will be added with outformat defaulting to native.

- `outformat` (enum, optional)
  - Allowed values: `cli`, `native`, `xml`
- `reverse` (any, optional) — Used with native outformat, this flag displays device commands for getting back to current running state in the network if the commit succeeds.

### ServiceManagementServiceManagerDocServiceInstanceOptionsCommitQueue

- `tag` (string, optional) — User defined opaque tag which is present in all notifications and events sent referencing the specific queue item. This property must be placed first inside the commit-queue property if being used.
- `sync` (ServiceManagementServiceManagerDocServiceInstanceOptionsCommitQueueSync, optional) — Uses sync mode for commit queue. Cannot be used with async or bypass mode.
- `async` (any, optional) — Uses async mode for commit queue. Cannot be used with sync or bypass mode.
- `bypass` (any, optional) — Uses bypass mode for commit queue. Cannot be used with sync or async mode.
- `block-others` (any, optional) — The commit-queue-block-others flag will block subsequent queue items, which use any of the devices in this queue item, from being queued.
- `lock` (any, optional) — The commit-queue-lock flag will place a lock on the resulting queue item.
- `atomic` (boolean, optional) — The commit-queue-atomic sets atomic behavior of resulting queue item.
- `error-option` (enum, optional) — The commit-queue-error-option flag determines behavior on error.
  - Allowed values: `continue-on-error`, `rollback-on-error`, `stop-on-error`

### ServiceManagementServiceManagerDocServiceInstanceOptionsCommitQueueSync

Uses sync mode for commit queue. Cannot be used with async or bypass mode.

### ServiceManagementServiceManagerDocServiceInstanceOptionsCommitQueueSync0

- `timeout` (integer, optional) — Maximum number of seconds to wait for transaction to be committed.

### ServiceManagementServiceManagerDocServiceInstanceOptionsCommitQueueSync1

- `infinity` (any, optional) — Use this format for infinite wait time.

## Examples

**Request**

```json
{}
```

**Response**

```json
{
  "device": {
    "data": "string",
    "name": "string"
  },
  "success": true
}
```

**SDK Code**

```python
import requests

url = "http://localhost:3000/service_management/testInstances"

payload = {}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'http://localhost:3000/service_management/testInstances';
const options = {method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{}'};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "http://localhost:3000/service_management/testInstances"

	payload := strings.NewReader("{}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("http://localhost:3000/service_management/testInstances")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("http://localhost:3000/service_management/testInstances")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'http://localhost:3000/service_management/testInstances', [
  'body' => '{}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("http://localhost:3000/service_management/testInstances");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = [] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "http://localhost:3000/service_management/testInstances")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```