Ana içeriğe atla

Endpoint

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

Authentication

Requires a Personal API Access Token.
Authorization: Bearer YOUR_TOKEN

Request

Headers

HeaderValueRequired
AuthorizationBearer Yes
Content-Typeapplication/jsonYes

Path Parameters

ParameterTypeRequiredDescription
projectNamestringYesProject name
connectionNamestringYesConnection 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: The connectionName path parameter identifies the existing connection to update. To rename a connection, provide the new name in the name field of the request body while keeping the old name in the path parameter. If name is omitted from the body, the existing name (from the path parameter) is preserved.
Common Fields
FieldTypeRequiredDefaultDescription
typestringYes-Connection type discriminator field. Must match the existing connection type. Used to identify the connection type in API requests/responses.
namestringNo(path parameter value)New connection name. If omitted or empty, the existing name from the path parameter is used. If provided with a different value, the connection is renamed (must not conflict with existing connections)
descriptionstringNo-Connection description
deployToWorkerbooleanNotrueWhether to deploy to worker
enabledbooleanNotrueWhether 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

FieldTypeDescription
successbooleanIndicates if the request was successful
deploymentResultobjectDeployment result (if deployToWorker=true)
deploymentResult.successbooleanDeployment 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"
  }'

Permissions

  • User must have CONNECTIONS + MANAGE permission in the project

Notes and Warnings

  • Name Change: To rename a connection, provide the new name in the name field of the request body. The path parameter always identifies the existing connection. If the new name conflicts with another connection, the update will fail
  • 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