Update Connection

Overview

Updates an existing connection in a project. All connection fields can be updated, including changing the connection name (if the new name doesn’t conflict with existing connections).

Endpoint

PUT /apiops/projects/{projectName}/connections/{connectionName}/

Authentication

Requires a Personal API Access Token.

Authorization: Bearer YOUR_TOKEN

Request

Headers

Header Value Required
Authorization Bearer {token} Yes
Content-Type application/json Yes

Path Parameters

Parameter Type Required Description
projectName string Yes Project name
connectionName string Yes Connection name (must exist)

Request Body

Full JSON Body Example (Email Connection)

{
  "type": "email",
  "name": "my-email-connection",
  "description": "Updated email connection description",
  "deployToWorker": true,
  "enabled": true,
  "host": "smtp.gmail.com",
  "port": 587,
  "enableStartTls": true,
  "auth": true,
  "username": "updated-user@example.com",
  "password": "new-app-password",
  "defaultEncoding": "UTF-8",
  "from": "noreply@example.com",
  "additionalProperties": []
}

Request Body Fields

The request body structure is identical to Create Connection. See that documentation for complete field descriptions.

Important: Connection name in path parameter must match the existing connection name.

Common Fields
Field Type Required Default Description
type string Yes - Connection type discriminator field. Must match the existing connection type. Used to identify the connection type in API requests/responses.
name string Yes - Connection name (must match path parameter, or new name if renaming)
description string No - Connection description
deployToWorker boolean No true Whether to deploy to worker
enabled boolean No true Whether connection is enabled

Note: Connection-specific fields vary by connection type. See individual connection type documentation for details.

Response

Success Response (200 OK)

{
  "success": true,
  "deploymentResult": {
    "success": true
  }
}

Response Fields

Field Type Description
success boolean Indicates if the request was successful
deploymentResult object Deployment result (if deployToWorker=true)
deploymentResult.success boolean Deployment success

Error Response (400 Bad Request)

{
  "error": "bad_request",
  "error_description": "Connection (name: my-email-connection) was not found!"
}

Common Causes

  • Connection name does not exist
  • Connection name in path does not match name in body (unless renaming)
  • New connection name conflicts with existing connection
  • Invalid connection type (cannot change connection type)
  • Missing required fields for connection type
  • Invalid field values

Error Response (401 Unauthorized)

{
  "error": "unauthorized_client",
  "error_description": "Invalid token"
}

Error Response (404 Not Found)

{
  "error": "not_found",
  "error_description": "Project 'MyProject' not found"
}

cURL Example

Example 1: Update Connection Configuration

curl -X PUT \
  "https://demo.apinizer.com/apiops/projects/MyProject/connections/my-email-connection/" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "email",
    "name": "my-email-connection",
    "description": "Updated email connection",
    "deployToWorker": true,
    "enabled": true,
    "host": "smtp.gmail.com",
    "port": 587,
    "enableStartTls": true,
    "auth": true,
    "username": "updated-user@example.com",
    "password": "new-app-password",
    "defaultEncoding": "UTF-8",
    "from": "noreply@example.com"
  }'

Example 2: Rename Connection

Rename a connection by providing a new name in the body (path parameter keeps old name).

curl -X PUT \
  "https://demo.apinizer.com/apiops/projects/MyProject/connections/old-connection-name/" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "email",
    "name": "new-connection-name",
    "description": "Renamed connection",
    "deployToWorker": true,
    "enabled": true,
    "host": "smtp.gmail.com",
    "port": 587,
    "auth": true,
    "username": "user@example.com",
    "password": "password"
  }'

Note: The new name must not conflict with existing connections.

Example 3: Update and Disable

Update connection configuration and disable it.

curl -X PUT \
  "https://demo.apinizer.com/apiops/projects/MyProject/connections/my-db-connection/" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "database",
    "name": "my-db-connection",
    "description": "Updated database connection - disabled",
    "deployToWorker": true,
    "enabled": false,
    "host": "localhost",
    "port": 5432,
    "databaseName": "mydb",
    "username": "dbuser",
    "password": "dbpassword"
  }'

Notes and Warnings

  • Name Matching: Connection name in path parameter must match the existing connection name (or new name if renaming)
  • Type Cannot Change: Connection type (type) cannot be changed. Use Delete and Create to change type.
  • Name Conflicts: If renaming, ensure the new name doesn’t conflict with existing connections
  • Secret Fields: Secret fields can be updated. Ensure you have the correct values.
  • Deployment: If deployToWorker: true, connection is automatically redeployed to workers
  • References: References to certificates or keystores can be updated by providing new names