# Call Flow Analysis REST API

The Call Flow Analysis REST API allows you to:

1. GET the existing _call flow analysis_ configuration for an application.
2. PUT or create/update a new or existing _call flow analysis_ configuration.
3. DELETE an existing _call flow analysis_ configuration for an application.

## GET Call Flow Analysis Configuration

Use this method to review an existing configuration for call flow analysis associated with an application or organization.

**Permissions required:** View IQ elements

```
GET /api/experimental/callFlowAnalysis/configuration/{ownerType: application|organization}/{ownerId}
```

{ownerType} can be application or organization

{ownerId} is the application id or organization id, based on the value of ownerType

**Example:**

```
curl --location 'http://localhost:8072/api/experimental/callFlowAnalysis/configuration/application/82eac008806848fcb3ba0684b99dda69' \
--header 'Authorization: Basic YWRtaW46YWRtaW4xMjM=' \
--header 'Cookie: CLM-CSRF-TOKEN=580c2f8c-2eb6-48bb-a591-8fba52db7ef8'
```

**Response:**

A successful response (response code 200) returns:

```
{
    "id": "ac63b2c153644fbd94142ff199739e39",
    "enabled": true,
    "namespaces": [
        "foo"
    ],
    "threadCount": 2,
    "ownerId": "82eac008806848fcb3ba0684b99dda69"
}
```

An unsuccessful response (response code 404) returns:

```
Call Flow Analysis Config not found for ownerId 0f1dc4fd8d6046ee859a650d4d608f6b
```

## Create or Update Call Flow Analysis Configuration

Use this method to create or update call flow analysis configuration related to an application or organization.

**Permissions required:** Edit IQ elements

```
[PUT]  /api/experimental/callFlowAnalysis/configuration/{ownerType: application|organization}/{ownerId}
```

{ownerType} can be application or organization

{ownerId} is the application id or organization id, based on the value of ownerType

**Request body:**

```
{
"id": "config identifier to update, or null for create a new one",
"enabled": true,
"namespaces": ["array of namespaces"],
"threadCount": 1,
"ownerId": "owner identifier"
}
```

**Example for request body:**

```
{
  "id": null,
  "enabled": true,
  "namespaces": ["foo"],
  "threadCount": 1,
  "ownerId": "82eac008806848fcb3ba0684b99dda69"
}
```

**Example request:**

```
curl --location --request PUT 'http://localhost:8072/api/experimental/callFlowAnalysis/configuration/application/82eac008806848fcb3ba0684b99dda69' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic YWRtaW46YWRtaW4xMjM=' \
--header 'Cookie: CLM-CSRF-TOKEN=580c2f8c-2eb6-48bb-a591-8fba52db7ef8' \
--data '{
  "id": null,
  "enabled": true,
  "namespaces": ["foo"],
  "threadCount": 1,
  "ownerId": "82eac008806848fcb3ba0684b99dda69"
}'
```

**Response:**

A successful response (response code 200) returns:

```
{
    "id": "ac63b2c153644fbd94142ff199739e39",
    "enabled": true,
    "namespaces": [
        "foo"
    ],
    "threadCount": 1,
    "ownerId": "82eac008806848fcb3ba0684b99dda69"
}
```

An unsuccessful response (response code 400) could return:

```
ownerId does not match
```

or

```
ownerId cannot be null
```

## Delete Call Flow Analysis Configuration

Use this method to delete an existing call flow analysis configuration related to an application or organization.

**Permissions required:** Edit IQ elements

```
[DELETE]  /api/experimental/callFlowAnalysis/configuration/{ownerType: application|organization}/{ownerId}
```

{ownerType} can be application or organization

{ownerId} is the application id or organization id, based on the value of ownerType

**Example:**

```
curl --location --request DELETE 'http://localhost:8072/api/experimental/callFlowAnalysis/configuration/application/82eac008806848fcb3ba0684b99dda69' \
--header 'Authorization: Basic YWRtaW46YWRtaW4xMjM=' \
--header 'Cookie: CLM-CSRF-TOKEN=580c2f8c-2eb6-48bb-a591-8fba52db7ef8'
```

**Response:**

A successful response is indicated by response code 204.

A response code 404 indicates that the requested call flow configuration could not be found.
