Ana içeriğe geç

Update API Proxy

Endpoint​

Update from URL​

PUT /apiops/projects/{projectName}/apiProxies/url/

Update from File​

PUT /apiops/projects/{projectName}/apiProxies/file/

Authentication​

Requires a Personal API Access Token.

Authorization: Bearer YOUR_TOKEN

Request​

Headers​

HeaderValueRequired
AuthorizationBearer {token}Yes
Content-Typeapplication/json (for URL) or multipart/form-data (for file)Yes

Path Parameters​

ParameterTypeRequiredDescription
projectNamestringYesProject name

Request Body​

The request body structure is identical to Create API Proxy from URL or Create API Proxy from File, with the following differences:

Key Differences for Update​

  1. reParse: Set reParse: true to update an existing API proxy
  2. API Proxy Must Exist: The API proxy with the specified name must already exist
  3. Type Consistency: The apiProxyCreationType must match the original type
  4. Description: If apiProxyDescription is empty, the existing description is preserved
  5. Body Read Behavior: If requestBodyReadBehavior or responseBodyReadBehavior is not provided, existing values are preserved

Full JSON Body Example (Update from URL)​

{
"apiProxyName": "petstore-api",
"apiProxyDescription": "Updated Petstore API Proxy",
"apiProxyCreationType": "OPEN_API",
"specUrl": "https://petstore.swagger.io/v2/swagger.json",
"clientRoute": {
"relativePathList": ["/api/v1"],
"hostList": ["api.example.com"]
},
"routingInfo": {
"routingAddressList": [
{
"address": "https://backend.example.com",
"weight": 100
}
],
"loadBalanceAlgorithm": "ROUND_ROBIN",
"connectTimeout": 30,
"readTimeout": 60
},
"deploy": true,
"deployTargetEnvironmentNameList": ["production"],
"reParse": true,
"soapToRest": false,
"enableWSA": false,
"enableWSRM": false,
"backendApiVersion": "v2",
"requestBodyReadBehavior": "READ_IF_POLICY_EXISTS",
"responseBodyReadBehavior": "ALWAYS_READ",
"maintenanceModeSetting": {
"enabled": false,
"httpStatusCode": 503,
"contentType": "application/json",
"message": "Service is under maintenance"
}
}

Response​

Success Response (200 OK)​

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

Response Fields​

FieldTypeDescription
successbooleanIndicates if the request was successful
deploymentResultobjectDeployment result (if deploy=true)
deploymentResult.successbooleanOverall deployment success
deploymentResult.deploymentResultsarrayIndividual environment deployment results

Error Response (400 Bad Request)​

{
"status": "FAILURE",
"resultMessage": "ApiProxy (name: petstore-api) can not be reparsed because it is not exist. First create it!"
}

Common Causes​

  • API Proxy name does not exist (must create first)
  • API Proxy creation type mismatch (cannot change type)
  • Invalid specification URL or file
  • SOAP to REST transformation not allowed (if original was SOAP without transformation)
  • Missing required fields

Error Response (401 Unauthorized)​

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

cURL Example​

Example 1: Update API Proxy from URL​

curl -X PUT \
"https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/url/" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"apiProxyName": "petstore-api",
"apiProxyDescription": "Updated Petstore API",
"apiProxyCreationType": "OPEN_API",
"specUrl": "https://petstore.swagger.io/v2/swagger.json",
"clientRoute": {
"relativePathList": ["/api/v1"]
},
"reParse": true,
"deploy": false
}'

Example 2: Update API Proxy from File​

curl -X PUT \
"https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/file/" \
-H "Authorization: Bearer YOUR_TOKEN" \
-F 'metadata={
"apiProxyName": "petstore-api",
"apiProxyDescription": "Updated Petstore API",
"apiProxyCreationType": "OPEN_API",
"reParse": true,
"deploy": false
}' \
-F "specFile=@updated-openapi.json"

Example 3: Update and Deploy​

curl -X PUT \
"https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/url/" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"apiProxyName": "petstore-api",
"apiProxyDescription": "Updated and deployed",
"apiProxyCreationType": "OPEN_API",
"specUrl": "https://petstore.swagger.io/v2/swagger.json",
"clientRoute": {
"relativePathList": ["/api/v1"]
},
"reParse": true,
"deploy": true,
"deployTargetEnvironmentNameList": ["production"]
}'

Notes and Warnings​

  • API Proxy Must Exist: The API proxy with the specified name must already exist. Use Create endpoints to create new API proxies.
  • Type Consistency: The apiProxyCreationType must match the original type. You cannot change from SOAP to REST or vice versa.
  • SOAP to REST: If the original API proxy was SOAP without protocol transformation, you cannot enable soapToRest during update. This must be set during initial creation.
  • Description Preservation: If apiProxyDescription is empty or not provided, the existing description is preserved.
  • Client Route: If clientRoute is not provided, the existing client route is preserved.
  • Deployment: If deploy: true, ensure environments exist and user has deployment permissions.
  • Reparse: The reParse field must be set to true for update operations (PUT endpoints).
  • USD budget price check (400): when the saved routing or aiAppBudget differs from the stored proxy and a USD budget covering the proxy (its own aiAppBudget, the routing's anonymousBudget, the project's tenant budget or the global default / anonymous-default budgets) would meter a model with no input price in the model catalog, the request is rejected with 400 and error key aiQuota.usdBudgetModelPriceMissing. Nothing is saved. An unchanged re-save is never re-checked.