Ana içeriğe geç

Update Proxy Server Settings

Endpoint

PATCH /apiops/projects/{projectName}/apiProxies/{apiProxyName}/settings/proxy-server/

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

{
"proxyEnabled": true,
"proxyFromHeaderEnabled": false,
"proxyHost": "proxy.example.com",
"proxyPort": 8080,
"proxyAuthorizationNeeded": true,
"proxyUsername": "proxy-user",
"proxyPassword": "proxy-pass",
"deploy": false,
"deployTargetEnvironmentNameList": []
}

Request Body Fields

FieldTypeRequiredDefaultDescription
proxyEnabledbooleanNo-Enable/disable proxy server
proxyFromHeaderEnabledbooleanNo-Get proxy settings from request headers
proxyHoststringNo*-Proxy server hostname (required if proxyEnabled=true and proxyFromHeaderEnabled=false)
proxyPortintegerNo*-Proxy server port (required if proxyEnabled=true and proxyFromHeaderEnabled=false)
proxyAuthorizationNeededbooleanNo-Require proxy authentication
proxyUsernamestringNo*-Proxy username (required if proxyAuthorizationNeeded=true)
proxyPasswordstringNo*-Proxy password (required if proxyAuthorizationNeeded=true)
deploybooleanNofalseIf true, deploy the API proxy after saving changes
deployTargetEnvironmentNameListarray[string]No-List of environment names to deploy to (required when deploy=true)

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

Proxy from Header

When proxyFromHeaderEnabled=true, proxy settings are read from request headers:

  • X-Proxy-Host - Proxy hostname
  • X-Proxy-Port - Proxy port
  • X-Proxy-Authorization - Proxy authorization (Basic auth token)

Response

Success Response (200 OK)

{
"success": true
}

Response Fields

FieldTypeDescription
successbooleanIndicates if the request was successful

When deploy=true is specified:

{
"success": true,
"deploymentResult": {
"success": true,
"deploymentResults": [
{
"environmentName": "production",
"success": true,
"message": "Deployment successful"
}
]
}
}
FieldTypeDescription
deploymentResultobjectOnly present when deploy=true
deploymentResult.successbooleanOverall deployment success status
deploymentResult.deploymentResultsarrayPer-environment deployment results

Error Response (400 Bad Request)

{
"error": "bad_request",
"error_description": "Proxy host and port are required when proxy is enabled"
}

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 Proxy Server

curl -X PATCH \
"https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/MyAPI/settings/proxy-server/" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"proxyEnabled": true,
"proxyFromHeaderEnabled": false,
"proxyHost": "proxy.example.com",
"proxyPort": 8080,
"proxyAuthorizationNeeded": true,
"proxyUsername": "proxy-user",
"proxyPassword": "proxy-pass"
}'

Example 2: Configure Proxy from Headers

curl -X PATCH \
"https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/MyAPI/settings/proxy-server/" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"proxyEnabled": true,
"proxyFromHeaderEnabled": true,
"proxyAuthorizationNeeded": true
}'

Example 3: Save and Deploy

curl -X PATCH \
"https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/MyAPI/settings/proxy-server/" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"proxyEnabled": true,
"proxyHost": "proxy.example.com",
"proxyPort": 8080,
"deploy": true,
"deployTargetEnvironmentNameList": ["production"]
}'

Notes and Warnings

  • Proxy Host/Port: Required when proxyEnabled=true and proxyFromHeaderEnabled=false
  • Proxy from Header: When enabled, proxy settings are read from request headers per request
  • Authorization: When proxyAuthorizationNeeded=true, provide proxyUsername and proxyPassword (or use header)
  • Password Security: Proxy password is encrypted when stored
  • Deploy: When deploy=true, the API proxy is automatically deployed to the specified environments after saving

Permissions

User must have API_MANAGEMENT + MANAGE permission in the project.