Ana içeriğe geç

Update Endpoint Status

Endpoint

PATCH /apiops/projects/{projectName}/apiProxies/{apiProxyName}/endpoints/status/

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

{
"identifierName": "/api/users",
"identifierHttpMethod": "GET",
"active": false,
"deploy": false,
"deployTargetEnvironmentNameList": []
}

Request Body Fields

FieldTypeRequiredDefaultDescription
identifierNamestringYes-Endpoint path/name (used to identify the endpoint)
identifierHttpMethodstringYes-HTTP method for the endpoint (used to identify the endpoint). See EnumHttpRequestMethod
activebooleanYes-Whether endpoint is active/enabled (true = enabled, false = disabled)
deploybooleanNofalseIf true, deploy the API proxy after saving changes
deployTargetEnvironmentNameListarray[string]No-List of environment names to deploy to (required when deploy=true)

EnumHttpRequestMethod

  • GET, POST, PUT, DELETE, PATCH, OPTIONS, HEAD, TRACE, ALL

Response

Success Response (200 OK)

{
"success": true
}

When deploy=true is specified:

{
"success": true,
"deploymentResult": {
"success": true,
"deploymentResults": [
{
"environmentName": "production",
"success": true,
"message": "Deployment successful"
}
]
}
}

Response Fields

FieldTypeDescription
successbooleanIndicates if the request was successful
deploymentResultobjectDeployment result (only present when deploy=true)
deploymentResult.successbooleanWhether the overall deployment was successful
deploymentResult.deploymentResultsarrayPer-environment deployment results

Error Response (400 Bad Request)

{
"error": "bad_request",
"error_description": "Endpoint identifier (name and httpMethod) must be provided in request body!"
}

or

{
"error": "bad_request",
"error_description": "Endpoint with name (/api/users) and HTTP method (GET) is not found!"
}

Common Causes

  • Missing identifierName or identifierHttpMethod fields
  • Missing active field
  • Endpoint with specified name and httpMethod does not exist

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: Disable Endpoint

curl -X PATCH \
"https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/MyAPI/endpoints/status/" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"identifierName": "/api/users",
"identifierHttpMethod": "GET",
"active": false
}'

Example 2: Enable Endpoint

curl -X PATCH \
"https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/MyAPI/endpoints/status/" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"identifierName": "/api/users",
"identifierHttpMethod": "GET",
"active": true
}'

Example 3: Save and Deploy

curl -X PATCH \
"https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/MyAPI/endpoints/status/" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"identifierName": "/api/users",
"identifierHttpMethod": "GET",
"active": false,
"deploy": true,
"deployTargetEnvironmentNameList": ["production"]
}'

Permissions

User must have API_MANAGEMENT + MANAGE permission in the project.

Notes and Warnings

  • Endpoint Identifier: Endpoint is identified by identifierName and identifierHttpMethod combination (not by ID)
  • Disabled Endpoints: Disabled endpoints return 404 Not Found when accessed
  • Policies: Policies remain associated with the endpoint even when disabled
  • Deploy: When deploy=true, the API proxy is automatically deployed to the specified environments after saving