Ana içeriğe geç

Update Maintenance Mode

Endpoint​

PATCH /apiops/projects/{projectName}/apiProxies/{apiProxyName}/settings/maintenance-mode/

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​

{
"enabled": true,
"httpStatusCode": 503,
"contentType": "application/json; charset=utf-8",
"message": "{\"status\": 503, \"message\": \"Service is currently under maintenance. Please try again later.\"}",
"deploy": false,
"deployTargetEnvironmentNameList": []
}

Request Body Fields​

FieldTypeRequiredDefaultDescription
enabledbooleanNofalseEnable or disable maintenance mode
httpStatusCodeintegerNo403HTTP status code returned to clients during maintenance
contentTypestringNoapplication/json; charset=utf-8Content-Type header of the maintenance response
messagestringNo(default message)Response body message returned to clients during maintenance
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. Omitted fields retain their current values.

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.successbooleanIndicates if the overall deployment was successful
deploymentResult.deploymentResultsarrayList of deployment results per environment

Error Response (401 Unauthorized)​

{
"status": "FAILURE",
"resultMessage": "Token is not valid!"
}

Error Response (400 Bad Request)​

{
"status": "FAILURE",
"resultMessage": "ApiProxy (name: MyAPI) was not found!"
}

cURL Example​

Example 1: Enable Maintenance Mode​

curl -X PATCH \
"https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/MyAPI/settings/maintenance-mode/" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"enabled": true,
"httpStatusCode": 503,
"contentType": "application/json; charset=utf-8",
"message": "{\"status\": 503, \"message\": \"Service is under maintenance\"}"
}'

Example 2: Disable Maintenance Mode​

curl -X PATCH \
"https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/MyAPI/settings/maintenance-mode/" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"enabled": false
}'

Example 3: Update Only the Status Code​

curl -X PATCH \
"https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/MyAPI/settings/maintenance-mode/" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"httpStatusCode": 503
}'

Example 4: Save and Deploy​

curl -X PATCH \
"https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/MyAPI/settings/maintenance-mode/" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"enabled": true,
"httpStatusCode": 503,
"deploy": true,
"deployTargetEnvironmentNameList": ["production"]
}'

Permissions​

User must have API_MANAGEMENT + MANAGE permission in the project.

Notes and Warnings​

  • Partial Update: Only provided fields are updated. You can send just the fields you want to change
  • Immediate Effect: Changes take effect after the API proxy is redeployed
  • Custom Message: The message field accepts any string content. For JSON responses, ensure proper escaping
  • Content Type: The contentType field controls the Content-Type header of the maintenance mode response
  • Default Status Code: If not specified, the default HTTP status code is 403 Forbidden
  • Deploy: When deploy=true, the API proxy is automatically deployed to the specified environments after saving
  • Global Settings Group override: if the API proxy is attached to a Global Settings Group that defines its own maintenance mode, that group's values take precedence — a value sent through this endpoint is overwritten by the group's values the next time the group or the attachment is saved. Detach the proxy from the group, or edit the maintenance mode on the group itself, to change the effective values. This also applies when the proxy is created with a project's default Global Settings Group already assigned: the values sent at creation time are immediately overwritten by the default group's values.