Ana içeriğe geç

Create API Proxy from File

Endpoint

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

Alternative Endpoint (PUT for update)

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

Authentication

Requires a Personal API Access Token.

Authorization: Bearer YOUR_TOKEN

Request

Headers

HeaderValueRequired
AuthorizationBearer {token}Yes
Content-Typemultipart/form-dataYes

Path Parameters

ParameterTypeRequiredDescription
projectNamestringYesProject name

Form Data

FieldTypeRequiredDescription
metadatastring (JSON)YesJSON string containing API proxy metadata
specFilefileYesSpecification file (OpenAPI/Swagger/WSDL) or ZIP file for WSDLs with many XSDs

Request Body (metadata JSON)

Full JSON Body Example

{
"apiProxyName": "petstore-api",
"apiProxyDescription": "Petstore API Proxy",
"apiProxyCreationType": "OPEN_API",
"clientRoute": {
"relativePathList": ["/api/v1"],
"hostList": ["api.example.com"],
"methodList": ["GET", "POST", "PUT", "DELETE"],
"headerList": [],
"bufferRequest": true,
"bufferResponse": true
},
"routingInfo": {
"routingAddressList": [
{
"address": "https://backend.example.com",
"weight": 100,
"soapType": "SOAP11"
}
],
"loadBalanceAlgorithm": "ROUND_ROBIN",
"connectTimeout": 30,
"readTimeout": 60,
"retryCount": 3,
"failoverRetryCount": 2,
"ignoreRoutingError": false
},
"deploy": false,
"deployTargetEnvironmentNameList": ["production"],
"reParse": false,
"soapToRest": false,
"enableWSA": false,
"enableWSRM": false,
"backendApiVersion": "v1",
"maintenanceModeSetting": {
"enabled": false,
"httpStatusCode": 503,
"contentType": "application/json",
"message": "Service is under maintenance"
}
}

Request Body Fields

FieldTypeRequiredDefaultDescription
apiProxyNamestringYes-API Proxy name (must be unique within project)
apiProxyDescriptionstringNo-API Proxy description
apiProxyCreationTypestringYes-API creation type
clientRouteobjectYes*-Client route configuration (required if reParse=false)
routingInfoobjectNo-Routing configuration
deploybooleanNofalseWhether to deploy after creation
deployTargetEnvironmentNameListarrayNo[]List of environment names to deploy to
reParsebooleanNofalseWhether to reparse existing API proxy (PUT only)
soapToRestbooleanNofalseEnable SOAP to REST transformation
enableWSAbooleanNofalseEnable WS-Addressing (SOAP only)
enableWSRMbooleanNofalseEnable WS-ReliableMessaging (SOAP only)
backendApiVersionstringNo-Backend API version
maintenanceModeSettingobjectNo-Maintenance mode settings

EnumApiProxySpecType

  • OPEN_API - OpenAPI 3.0 specification
  • SWAGGER - Swagger 2.0 specification
  • WSDL - WSDL specification (SOAP)
  • REVERSE_PROXY - Reverse proxy (no spec file)

Note: For REVERSE_PROXY, specFile is not required.

clientRoute

FieldTypeRequiredDefaultDescription
relativePathListarrayYes*[]List of relative paths (e.g., ["/api/v1"]). Required if reParse=false
hostListarrayNo[]List of virtual hosts (e.g., ["api.example.com"])
methodListarrayNo[]List of HTTP methods (e.g., ["GET", "POST"])
headerListarrayNo[]List of headers for routing
bufferRequestbooleanNotrueBuffer request body
bufferResponsebooleanNotrueBuffer response body

EnumHttpRequestMethod

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

routingInfo

FieldTypeRequiredDefaultDescription
routingAddressListarrayNo[]List of backend addresses
loadBalanceAlgorithmstringNoROUND_ROBINLoad balancing algorithm
connectTimeoutintegerNo30Connection timeout in seconds
readTimeoutintegerNo60Read timeout in seconds
retryCountintegerNo0Number of retries
failoverRetryCountintegerNo0Number of failover retries
ignoreRoutingErrorbooleanNofalseIgnore routing errors

EnumRoutingAlgorithm

  • ROUND_ROBIN - Round-robin load balancing
  • LRU - Least recently used
  • WEIGHTED - Weighted load balancing (requires weight in routingAddressList)
  • RANDOM - Random selection
  • PICK_FIRST - Pick first available

routingAddressList Item

FieldTypeRequiredDefaultDescription
addressstringYes-Backend address URL
weightintegerNo*1Load balancing weight (required if loadBalanceAlgorithm=WEIGHTED)
soapTypestringNo*SOAP11SOAP version (required if API type is SOAP)

EnumSoapApiPortType

  • SOAP11 - SOAP 1.1
  • SOAP12 - SOAP 1.2

maintenanceModeSetting

FieldTypeRequiredDefaultDescription
enabledbooleanNofalseEnable maintenance mode
httpStatusCodeintegerNo503HTTP status code for maintenance
contentTypestringNoapplication/jsonContent type for maintenance response
messagestringNo-Maintenance message

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)

{
"error": "bad_request",
"error_description": "ApiProxy (name: petstore-api) is already exist!"
}

Common Causes

  • API Proxy name already exists
  • Invalid specification file format
  • Invalid API creation type
  • Missing required fields (clientRoute, specFile)
  • Invalid file format

Error Response (401 Unauthorized)

{
"error": "unauthorized_client",
"error_description": "Invalid token"
}

Error Response (404 Not Found)

{
"error": "not_found",
"error_description": "Project (MyProject) is not found or user does not have privilege to access it!"
}

cURL Example

Example 1: Create REST API Proxy from OpenAPI File

curl -X POST \
"https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/file/" \
-H "Authorization: Bearer YOUR_TOKEN" \
-F 'metadata={
"apiProxyName": "petstore-api",
"apiProxyDescription": "Petstore API Proxy",
"apiProxyCreationType": "OPEN_API",
"clientRoute": {
"relativePathList": ["/api/v1"]
},
"deploy": false,
"reParse": false,
"soapToRest": false
}' \
-F "specFile=@openapi.json"

Example 2: Create SOAP API Proxy from WSDL File

curl -X POST \
"https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/file/" \
-H "Authorization: Bearer YOUR_TOKEN" \
-F 'metadata={
"apiProxyName": "soap-service",
"apiProxyDescription": "SOAP Web Service",
"apiProxyCreationType": "WSDL",
"clientRoute": {
"relativePathList": ["/soap"]
},
"enableWSA": true,
"enableWSRM": false,
"deploy": false,
"reParse": false
}' \
-F "specFile=@service.wsdl"

Example 3: Create API Proxy with WSDL ZIP File

For WSDLs with many XSDs, use a ZIP file:

curl -X POST \
"https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/file/" \
-H "Authorization: Bearer YOUR_TOKEN" \
-F 'metadata={
"apiProxyName": "complex-soap-service",
"apiProxyDescription": "Complex SOAP Service",
"apiProxyCreationType": "WSDL",
"clientRoute": {
"relativePathList": ["/soap"]
},
"deploy": false,
"reParse": false
}' \
-F "specFile=@wsdl-with-xsds.zip"

Example 4: Update API Proxy (Reparse) using PUT

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"

Permissions

User must have API_MANAGEMENT + MANAGE permission in the project. For deployment operations (when deploy: true is set), user must also have API_MANAGEMENT + DEPLOY_UNDEPLOY permission.

Notes and Warnings

  • File Format: Supported formats: OpenAPI 3.0 (JSON/YAML), Swagger 2.0 (JSON/YAML), WSDL (XML)
  • ZIP Files: For WSDLs with many XSDs, use a ZIP file containing all related files
  • Unique Names: API Proxy names must be unique within a project
  • Reparse: Use PUT endpoint with reParse: true to update an existing API proxy from a new specification file
  • Type Consistency: When reparsing, the API creation type must match the original type
  • SOAP Features: enableWSA and enableWSRM are only applicable for SOAP APIs
  • Reverse Proxy: For reverse proxy, specFile is not required
  • Deployment: If deploy: true, ensure environments exist and user has deployment permissions
  • License Limits: Creating API proxies may be subject to license limits
  • File Size: Large specification files may take longer to process