Import API Proxy (With Override)
Endpoint
PUT /apiops/projects/{projectName}/apiProxies/{apiProxyName}/import/
Authentication
Requires a Personal API Access Token.
Header
Authorization: Bearer YOUR_TOKEN
Request
Headers
| Header | Value | Required |
|---|---|---|
| Authorization | Bearer {token} | Yes |
| Content-Type | multipart/form-data | Yes |
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| projectName | string | Yes | Project name where the API Proxy will be imported |
| apiProxyName | string | Yes | API Proxy name (will override existing API Proxy with this name) |
Form Data
| Parameter | Type | Required | Description |
|---|---|---|---|
| metadata | string (JSON) | Yes | Metadata for API Proxy creation/update. See Metadata Object |
| apiProxyExportFile | file | Yes | ZIP file containing the API Proxy export. Must have .zip extension |
Metadata Object
The metadata parameter is a JSON string containing optional configuration for the import process.
Full JSON Metadata Example - Basic Import
{
"deploy": false,
"deployTargetEnvironmentNameList": null,
"routing": null,
"maintenanceMode": null
}
Full JSON Metadata Example - Import with Deployment
{
"deploy": true,
"deployTargetEnvironmentNameList": ["production", "staging"],
"routing": null,
"maintenanceMode": null
}
Full JSON Metadata Example - Import with Routing
{
"deploy": false,
"deployTargetEnvironmentNameList": null,
"routing": {
"algorithm": "ROUND_ROBIN",
"addressList": [
{
"address": "https://backend1.example.com",
"weight": 1,
"soapType": null
},
{
"address": "https://backend2.example.com",
"weight": 1,
"soapType": null
}
]
},
"maintenanceMode": false
}
Metadata Object Fields
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| deploy | boolean | No | false | Deploy API Proxy after import |
| deployTargetEnvironmentNameList | array[string] | No | null | List of environment names to deploy to (if deploy=true) |
| routing | object | No | null | Routing configuration. See Routing Object |
| maintenanceMode | boolean | No | null | Enable/disable maintenance mode |
Routing Object
| Field | Type | Required | Description |
|---|---|---|---|
| algorithm | string | No | Routing algorithm. See EnumRoutingAlgorithm |
| addressList | array[object] | No | List of routing addresses. See Routing Address Object |
EnumRoutingAlgorithm (routing.algorithm)
ROUND_ROBIN- Round-robin load balancingWEIGHTED_ROUND_ROBIN- Weighted round-robin load balancingLEAST_CONNECTIONS- Least connections load balancingRANDOM- Random selectionIP_HASH- IP hash-based routingURL_HASH- URL hash-based routing
Routing Address Object
| Field | Type | Required | Description |
|---|---|---|---|
| address | string | Yes | Backend address URL |
| weight | integer | No | Weight for weighted algorithms (default: 1) |
| soapType | string | No | SOAP version for SOAP APIs. See EnumSoapApiPortType |
EnumSoapApiPortType (soapType)
SOAP11- SOAP 1.1SOAP12- SOAP 1.2
Notes
- File must be a valid ZIP archive
- File must end with
.zipextension (case-insensitive) - ZIP file must contain a valid API Proxy export JSON file
- If
deploy=true, requiresAPI_MANAGEMENT+DEPLOY_UNDEPLOYpermission - Routing configuration is optional and can be set later
- Maintenance mode can be enabled/disabled during import
Response
Success Response (200 OK)
{
"status": "SUCCESS",
"deploymentResult": {
"success": true,
"message": "Deployment completed successfully",
"environmentResults": [
{
"environmentName": "production",
"success": true,
"message": "Deployed successfully"
}
]
}
}
Response Fields
| Field | Type | Description |
|---|---|---|
| status | string | Response status: SUCCESS or FAILURE |
| deploymentResult | object | Deployment result (if deploy=true). See Deployment Result Object |
Deployment Result Object
| Field | Type | Description |
|---|---|---|
| success | boolean | Overall deployment success status |
| message | string | Deployment message |
| environmentResults | array[object] | Results per environment |
Environment Result Object
| Field | Type | Description |
|---|---|---|
| environmentName | string | Environment name |
| success | boolean | Deployment success status for this environment |
| message | string | Deployment message for this environment |
Success Response (200 OK) - Without Deployment
{
"status": "SUCCESS"
}
Error Response (400 Bad Request)
{
"error": "bad_request",
"error_description": "projectName value can not be empty!"
}
or
{
"error": "bad_request",
"error_description": "apiProxyName value can not be empty!"
}
or
{
"error": "bad_request",
"error_description": "apiProxyExportFile parameter can not be empty!"
}
or
{
"error": "bad_request",
"error_description": "apiProxyExportFile parameter must be in zip file format and must end with zip extension!"
}
Common Causes
- Empty
projectNameorapiProxyName - Empty or missing file
- File is not a ZIP archive
- File does not have
.zipextension - Invalid API Proxy export format
- Invalid metadata JSON format
- Deployment failed (if deploy=true)
Error Response (401 Unauthorized)
{
"error": "unauthorized_client",
"error_description": "Invalid token"
}
Error Response (404 Not Found)
{
"error": "not_found",
"error_description": "Project(MyProject) was not found or user does not have privilege to access it!"
}
cURL Example
Example 1: Basic Import (No Override)
curl -X PUT \
"https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/MyAPI/import/" \
-H "Authorization: Bearer YOUR_TOKEN" \
-F "metadata={\"deploy\":false}" \
-F "apiProxyExportFile=@apiProxyExportFile.zip"
Example 2: Import with Deployment
curl -X PUT \
"https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/MyAPI/import/" \
-H "Authorization: Bearer YOUR_TOKEN" \
-F "metadata={\"deploy\":true,\"deployTargetEnvironmentNameList\":[\"production\",\"staging\"]}" \
-F "apiProxyExportFile=@apiProxyExportFile.zip"