Ana içeriğe atla

Endpoint

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

Authentication

Requires a Personal API Access Token.
Authorization: Bearer YOUR_TOKEN

Request

Headers

HeaderValueRequired
AuthorizationBearer Yes
Content-Typeapplication/jsonYes

Path Parameters

ParameterTypeRequiredDescription
projectNamestringYesProject name
apiProxyNamestringYesAPI Proxy name

Request Body

Full JSON Body Example

{
  "connectionSettingsEnabled": true,
  "connectTimeout": 30,
  "readTimeout": 60,
  "connectionRequestTimeout": 30,
  "validateAfterInactivity": 2000,
  "idleConnectionTimeout": 30,
  "redirectsEnabled": true,
  "maxRedirects": 50,
  "relativeRedirectsAllowed": true,
  "disableContentCompression": false,
  "enableStreaming": false,
  "retryCount": 3,
  "failoverRetryCount": 2,
  "ignoreRoutingError": false,
  "connectionPoolManagementType": "GENERAL",
  "customConnectionPoolSize": 8,
  "retryDelayType": "EXPONENTIAL_BACKOFF",
  "retryInitialDelayMs": 100,
  "retryMaxDelayMs": 5000,
  "retryBackoffMultiplier": 2.0,
  "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
retryCountintegerNo-Number of retries on failure
failoverRetryCountintegerNo-Number of failover retries
ignoreRoutingErrorbooleanNo-Ignore routing errors
connectionPoolManagementTypestringNo-Connection pool management type
customConnectionPoolSizeintegerNo*-Custom connection pool size (required if connectionPoolManagementType=CUSTOM)
retryDelayTypestringNoNO_DELAYRetry delay strategy. See EnumRetryDelayType
retryFixedDelayMsintegerNo-Fixed delay between retries in milliseconds (when retryDelayType=FIXED)
retryInitialDelayMsintegerNo-Initial delay for exponential backoff in milliseconds
retryMaxDelayMsintegerNo-Maximum delay for exponential backoff in milliseconds
retryBackoffMultipliernumberNo-Backoff multiplier for exponential delay (e.g., 2.0 doubles delay each retry)
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

EnumRetryDelayType

  • NO_DELAY - No delay between retries (immediate retry)
  • FIXED - Fixed delay between retries (uses retryFixedDelayMs)
  • EXPONENTIAL_BACKOFF - Exponential backoff delay (uses retryInitialDelayMs, retryMaxDelayMs, retryBackoffMultiplier)

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,
    "retryCount": 3,
    "failoverRetryCount": 2
  }'

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 Retry Delay with Exponential Backoff

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 '{
    "retryCount": 3,
    "retryDelayType": "EXPONENTIAL_BACKOFF",
    "retryInitialDelayMs": 100,
    "retryMaxDelayMs": 5000,
    "retryBackoffMultiplier": 2.0
  }'

Example 5: 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
  • Retries: retryCount retries on same backend, failoverRetryCount tries failover backends
  • Retry Delay: Use EXPONENTIAL_BACKOFF for production (prevents thundering herd). FIXED delay is simpler but less effective under load.
  • 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.