This URL imports the firewall policies.
Resource URL
POST /domain/<domain_id>/ firewallpolicy/import
Content-type value
multipart/form-data; boundary=<x>
Request Parameters
URL Parameters:
Field Name | Description | Data Type | Mandatory |
|---|---|---|---|
| Domain id | Number | Yes |
Payload Request Parameters:
Field Name | Description | Data Type | Mandatory |
|---|---|---|---|
| Holds the body part objects | Object | Yes |
Details of BodyPart[0]:
Field Name | Description | Data Type | Mandatory |
|---|---|---|---|
| Holds the import file element object | Application/json object | Yes |
Details of ImportFileElement:
Field Name | Description | Data Type | Mandatory |
|---|---|---|---|
| Name of the file | String | Yes |
| File type should be "XML" | String | Yes |
| Whether the duplicate policies should be skipped(default is true) | Boolean | No |
Details of BodyPart[1]:
Field Name | Description | Data Type | Mandatory |
|---|---|---|---|
| Holds the file as input stream | Application/octet-stream | Yes |
Details of .xml file:
Field Name | Description | Data Type | Mandatory |
|---|---|---|---|
| Policy(file input stream) | ByteArrayInput stream | Yes |
Response Parameters
Following fields are returned if the request parameters are correct, otherwise error details are returned.
Field Name | Description | Data Type |
|---|---|---|
| Set to 1 if the operation was successful | Number |
message | Message returned from the backend | String |
Example
Request
POST https://<NSM_IP>/sdkapi/domain/0/firewallpolicy/import
Payload
----Boundary_1_12424925_1353496814940
Content-Type: application/json
{
"fileType": "xml",
"skipDuplicate": false,
"fileName": "FirewallPolicies0"
}
----Boundary_1_12424925_1353496814940
Content-Type: application/octet-stream
<FWConfig>
<NetworkObjects/>
<FWPolicies>
<FWPolicy owner_ad="My Company" policyName="FirewallPolicy4" policyType="1" visibleToChild="false" policyDescription="Firewall Policy for Port">
<FWPolicyRules owner_ad="My Company" uuid="108" Rulename="" direction="3" action="0" enablelog="N" description="" ordernum="0" type="1" state="1" mandate_auth="N">
<SourceObjectMember>
<NetworkObjectMember noid="-1" noname="" notype="1" noconfig="1"/>
</SourceObjectMember>
<DestinationObjectMember>
<NetworkObjectMember noid="-1" noname="" notype="1" noconfig="1"/>
</DestinationObjectMember>
<ServiceObjectMember>
<NetworkObjectMember noid="-1" noname="" notype="8" noconfig="1"/>
</ServiceObjectMember>
//……//
DestinationObjectMember>
<NetworkObjectMember noid="-1" noname="" notype="1" noconfig="1"/>
</DestinationObjectMember>
<ServiceObjectMember>
<NetworkObjectMember noid="-1" noname="" notype="8" noconfig="1"/>
</ServiceObjectMember>
<TimeObjectMember>
<NetworkObjectMember noid="-1" noname="" notype="9" noconfig="1"/>
</TimeObjectMember>
<UserObjectMember>
<NetworkObjectMember noid="-1" noname="" notype="32" noconfig="1"/>
</UserObjectMember>
</FWPolicyRules>
</FWPolicy>
</FWPolicies>
</FWConfig>
----Boundary_1_12424925_1353496814940--
Response
{
"status": 1,
"message": "Added new Firewall Policy in the current Admin Domain : FirewallPolicy4
Added new Firewall Policy in the current Admin Domain : FirewallPolicy3
Added new Firewall Policy in the current Admin Domain : FirewallPolicy2
Added new Firewall Policy in the current Admin Domain : FirewallPolicy1"
}
Error Information
Following error codes are returned by this URL:
No | HTTP Error Code | SDK API errorId | SDK API errorMessage |
|---|---|---|---|
1 | 404 | 1105 | Invalid domain |
2 | 400 | 5301 | Invalid file type given for import |
3 | 500 | 5307 | Policy import failed.. Please look into the logs.. |
4 | 500 | 2202 | Input stream read error |