# Retrieve status of a specific connection

`GET /api/2/connections/{connectionId}/status`

Returns the status of the connection identified by the `connectionId` path parameter.

Authentication (security requirement alternatives):

```json
[
  {
    "DevOpsBasic": []
  },
  {
    "DevOpsBearer": []
  }
]
```

- DevOpsBasic: http (basic). Eclipse Ditto devops user (devops) + password (foobar)
- DevOpsBearer: http (bearer). A JSON Web Token issued by a supported OAuth 2.0 Identity Provider for the Eclipse Ditto devops user.

Parameters:

- `connectionId` (path, string, required) - The ID of the connection
  Type: string

Responses:

- 200: The request successfully returned the connection status.

Content type: application/json

Type: ConnectionStatus

Status of a connection and its resources

Schema: [ConnectionStatus](https://sourcey-ditto.pages.dev/http-api-doc/models/connectionstatus.md)

- `connectionId` (required)
  Type: string
  
  The connection ID

- `connectionStatus` (required)
  Type: ConnectivityStatus
  
  The desired/target status of the connection
  
  allOf:
    Reference: [ConnectivityStatus](https://sourcey-ditto.pages.dev/http-api-doc/models/connectivitystatus.md); Type: ConnectivityStatus
    
    The status of a connection or resource
    
    enum: ["open","closed","failed","misconfigured","unknown"]

- `liveStatus` (required)
  Type: ConnectivityStatus
  
  The current/actual status of the connection
  
  allOf:
    Reference: [ConnectivityStatus](https://sourcey-ditto.pages.dev/http-api-doc/models/connectivitystatus.md); Type: ConnectivityStatus
    
    The status of a connection or resource
    
    enum: ["open","closed","failed","misconfigured","unknown"]

- `connectedSince` (required)
  Type: string
  
  The timestamp since when the connection is connected
  
  Example:
  
  ```json
  "2019-01-21T08:57:24.710Z"
  ```

- `clientStatus` (optional)
  Type: Array<ResourceStatus>
  
  The client states of the of the connection
  
  Items:
    Reference: [ResourceStatus](https://sourcey-ditto.pages.dev/http-api-doc/models/resourcestatus.md); Type: ResourceStatus
    
    The status of a single resource (e.g. a client or a source/target resource)

- `sourceStatus` (optional)
  Type: Array<ResourceStatus>
  
  The states of the sources the of the connection
  
  Items:
    Reference: [ResourceStatus](https://sourcey-ditto.pages.dev/http-api-doc/models/resourcestatus.md); Type: ResourceStatus
    
    The status of a single resource (e.g. a client or a source/target resource)

- `targetStatus` (optional)
  Type: Array<ResourceStatus>
  
  The states of the targets the of the connection
  
  Items:
    Reference: [ResourceStatus](https://sourcey-ditto.pages.dev/http-api-doc/models/resourcestatus.md); Type: ResourceStatus
    
    The status of a single resource (e.g. a client or a source/target resource)

- `sshTunnelStatus` (optional)
  Type: Array<ResourceStatus>
  
  The states of the ssh tunnel the of the connection
  
  Items:
    Reference: [ResourceStatus](https://sourcey-ditto.pages.dev/http-api-doc/models/resourcestatus.md); Type: ResourceStatus
    
    The status of a single resource (e.g. a client or a source/target resource)

- 400: The request could not be completed. The `connectionId` must be an URI.

Content type: application/json

Type: AdvancedError

Schema: [AdvancedError](https://sourcey-ditto.pages.dev/http-api-doc/models/advancederror.md)

- `status` (required)
  Type: integer
  
  The HTTP status of the error

- `error` (required)
  Type: string
  
  The error code of the occurred exception

- `message` (required)
  Type: string
  
  The message of the error - what went wrong

- `description` (optional)
  Type: string
  
  A description how to fix the error or more details

- `href` (optional)
  Type: string
  
  A link to further information about the error and how to fix it

- 401: The request could not be completed due to missing authentication.

Content type: application/json

Type: AdvancedError

Schema: [AdvancedError](https://sourcey-ditto.pages.dev/http-api-doc/models/advancederror.md)

- `status` (required)
  Type: integer
  
  The HTTP status of the error

- `error` (required)
  Type: string
  
  The error code of the occurred exception

- `message` (required)
  Type: string
  
  The message of the error - what went wrong

- `description` (optional)
  Type: string
  
  A description how to fix the error or more details

- `href` (optional)
  Type: string
  
  A link to further information about the error and how to fix it

- 403: The request could not be completed due to invalid authentication.

Content type: application/json

Type: AdvancedError

Schema: [AdvancedError](https://sourcey-ditto.pages.dev/http-api-doc/models/advancederror.md)

- `status` (required)
  Type: integer
  
  The HTTP status of the error

- `error` (required)
  Type: string
  
  The error code of the occurred exception

- `message` (required)
  Type: string
  
  The message of the error - what went wrong

- `description` (optional)
  Type: string
  
  A description how to fix the error or more details

- `href` (optional)
  Type: string
  
  A link to further information about the error and how to fix it

- 404: The request could not be completed. The connection with ID `connectionId` was not found.

Content type: application/json

Type: AdvancedError

Schema: [AdvancedError](https://sourcey-ditto.pages.dev/http-api-doc/models/advancederror.md)

- `status` (required)
  Type: integer
  
  The HTTP status of the error

- `error` (required)
  Type: string
  
  The error code of the occurred exception

- `message` (required)
  Type: string
  
  The message of the error - what went wrong

- `description` (optional)
  Type: string
  
  A description how to fix the error or more details

- `href` (optional)
  Type: string
  
  A link to further information about the error and how to fix it

## Examples

### cURL

```bash
curl -X GET 'https://ditto.eclipseprojects.io/api/2/connections/string/status' \
  -H 'Authorization: Basic WU9VUl9VU0VSTkFNRTpZT1VSX1BBU1NXT1JE'
```

### JavaScript

```javascript
const response = await fetch('https://ditto.eclipseprojects.io/api/2/connections/string/status', {
  method: 'GET',
  headers: {
    'Authorization': 'Basic WU9VUl9VU0VSTkFNRTpZT1VSX1BBU1NXT1JE',
  },
});

const data = await response.text();
```

### Python

```python
import requests

response = requests.get(
    'https://ditto.eclipseprojects.io/api/2/connections/string/status',
    headers={
        'Authorization': 'Basic WU9VUl9VU0VSTkFNRTpZT1VSX1BBU1NXT1JE',
    },
)
print(response.text)
```
