Ana içeriğe geç

Update Connection Settings

Endpoint

PATCH /apiops/projects/{projectName}/apiProxies/{apiProxyName}/settings/connection/

Authentication

Requires a Personal API Access Token.

Authorization: Bearer YOUR_TOKEN

Request

Headers

HeaderValueRequired
AuthorizationBearer {token}Yes
Content-Typeapplication/jsonYes

Path Parameters

ParameterTypeRequiredDescription
projectNamestringYesProject name
apiProxyNamestringYesAPI Proxy name

Request Body

Full JSON Body Example

{
"connectTimeout": 30,
"readTimeout": 60,
"connectionRequestTimeout": 30,
"validateAfterInactivity": 2000,
"idleConnectionTimeout": 30,
"redirectsEnabled": true,
"maxRedirects": 50,
"relativeRedirectsAllowed": true,
"disableContentCompression": false,
"enableStreaming": false,
"ignoreRoutingError": false,
"connectionPoolManagementType": "GENERAL",
"customConnectionPoolSize": 8,
"hopByHopHeaders": ["X-Custom-Internal"],
"sendUserAgentToBackend": true,
"userAgentValue": "Apinizer-Gateway/1.0",
"doNotRouteZeroValueContentLength": false,
"enableDownload": false,
"useByteArrayForCompressedResponse": false
}

Request Body Fields

FieldTypeRequiredDefaultDescription
connectionSettingsEnabledbooleanNo-Enable/disable custom connection settings
connectTimeoutintegerNo-Connection timeout in seconds
readTimeoutintegerNo-Read timeout in seconds
connectionRequestTimeoutintegerNo-Connection request timeout in seconds
validateAfterInactivityintegerNo2000Validate connections after inactivity (milliseconds). Tune per backend load balancer keep-alive timeout.
idleConnectionTimeoutintegerNo30Evict idle connections after this period (seconds). Tune per backend load balancer keep-alive timeout.
redirectsEnabledbooleanNo-Enable/disable HTTP redirects
maxRedirectsintegerNo-Maximum number of redirects
relativeRedirectsAllowedbooleanNo-Allow relative redirects
disableContentCompressionbooleanNo-Disable content compression
enableStreamingbooleanNo-Enable streaming mode
ignoreRoutingErrorbooleanNo-Ignore routing errors
connectionPoolManagementTypestringNo-Connection pool management type. See EnumConnectionPoolManagementType
customConnectionPoolSizeintegerNo*-Custom connection pool size (required if connectionPoolManagementType=CUSTOM)
hopByHopHeadersarray[string]No-List of hop-by-hop headers to remove before forwarding to backend
sendUserAgentToBackendbooleanNo-Send User-Agent header to backend
userAgentValuestringNo-Custom User-Agent header value (used when sendUserAgentToBackend=true)
doNotRouteZeroValueContentLengthbooleanNo-Do not route requests with Content-Length: 0
enableDownloadbooleanNo-Enable file download support for large response bodies
useByteArrayForCompressedResponsebooleanNo-Use byte array for compressed response handling

EnumConnectionPoolManagementType

  • GENERAL - General connection pool (shared pool)
  • CUSTOM - Custom connection pool (requires customConnectionPoolSize)
  • NONE - No connection pool

Note: All fields are optional. Only provided fields are updated.

Response

Success Response (200 OK)

{
"success": true
}

Response Fields

FieldTypeDescription
successbooleanIndicates if the request was successful

Error Response (400 Bad Request)

{
"error": "bad_request",
"error_description": "Custom connection pool size is required when connectionPoolManagementType is CUSTOM"
}

Error Response (401 Unauthorized)

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

Error Response (404 Not Found)

{
"error": "not_found",
"error_description": "ApiProxy (name: MyAPI) was not found!"
}

cURL Example

Example 1: Configure Connection Timeouts

curl -X PATCH \
"https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/MyAPI/settings/connection/" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"connectionSettingsEnabled": true,
"connectTimeout": 30,
"readTimeout": 60,
"connectionRequestTimeout": 30
}'

Example 2: Configure Custom Connection Pool

curl -X PATCH \
"https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/MyAPI/settings/connection/" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"connectionSettingsEnabled": true,
"connectionPoolManagementType": "CUSTOM",
"customConnectionPoolSize": 20,
"connectTimeout": 60,
"readTimeout": 120
}'

Example 3: Configure Connection Pool Stale/Idle Handling

curl -X PATCH \
"https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/MyAPI/settings/connection/" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"connectionSettingsEnabled": true,
"validateAfterInactivity": 2000,
"idleConnectionTimeout": 30
}'

Example 4: Configure Header and Response Settings

curl -X PATCH \
"https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/MyAPI/settings/connection/" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"hopByHopHeaders": ["X-Internal-Trace", "X-Debug-Info"],
"sendUserAgentToBackend": true,
"userAgentValue": "Apinizer-Gateway/1.0",
"enableDownload": true
}'

Notes and Warnings

  • Timeouts: Connection and read timeouts are in seconds; validateAfterInactivity is in milliseconds
  • Connection Pool: validateAfterInactivity and idleConnectionTimeout help prevent stale connection issues; tune per backend load balancer keep-alive timeout
  • Connection Pool: CUSTOM requires customConnectionPoolSize to be set
  • Redirects: When redirectsEnabled=true, HTTP redirects are followed (max maxRedirects)
  • Streaming: When enableStreaming=true, response is streamed instead of buffered
  • Content Compression: When disableContentCompression=true, content compression is disabled
  • Hop-by-Hop Headers: Headers listed in hopByHopHeaders are removed before the request is forwarded to the backend
  • User-Agent: When sendUserAgentToBackend=true, the specified userAgentValue is sent as the User-Agent header to the backend
  • Download Mode: When enableDownload=true, the gateway handles large response bodies as file downloads

Permissions

User must have API_MANAGEMENT + MANAGE permission in the project.