This URL imports the IPS and reconnaissance policies.
Resource URL
POST /domain/<domain_id>/ipsreconpolicy/import
Content-type value
multipart/form-data; boundary=<x>
Request Parameters
URL Parameters:
| Field Name | Description | Data Type | Mandatory |
|---|---|---|---|
| domainId | Domain id | Number | Yes |
Payload Request Parameters:
| Field Name | Description | Data Type | Mandatory |
|---|---|---|---|
| MultiPart | Holds the body part objects | Object | Yes |
Details of BodyPart[0]:
| Field Name | Description | Data Type | Mandatory |
|---|---|---|---|
| BodyPart[0] | Holds the import file element object | Application/json object | Yes |
Details of ImportFileElement:
| Field Name | Description | Data Type | Mandatory |
|---|---|---|---|
| fileName | Name of the file | String | Yes |
| fileType | File type should be "XML" | String | Yes |
| selectedPolicyNameList | List of the names of the policy to be imported | StringList | No |
Details of BodyPart[1]:
| Field Name | Description | Data Type | Mandatory |
|---|---|---|---|
| BodyPart[1] | Holds the file as input stream | Application/octet-stream | Yes |
Details of .xml file:
| Field Name | Description | Data Type | Mandatory |
|---|---|---|---|
| File | 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 |
|---|---|---|
| status | Set to 1 if the operation was successful | Number |
Example
Request
POST https://<NSM_IP>/sdkapi/domain/0/ipsreconpolicy/import
Payload
----Boundary_1_12424925_1353496814940
Content-Type: application/json
{
"fileType": "xml",
"selectedPolicyNameList": ["NSAT_AIWA_Blocking"],
"fileName": "IPS_ReconnaissancePolicy_latest_NSAT"
}
----Boundary_1_12424925_1353496814940
Content-Type: application/octet-stream
<userinput><?xml version='1.0' encoding='ISO-8859-1'?></userinput>
<userinput><PolicyExport version="5.0"></userinput>
<userinput><Recon hash="ce408928d2292651da7acd44f32c4b7"></userinput>
<userinput><ReconPolicy name="NSAT 7.1 Reconnaissance Policy" visibleToChild="yes"></userinput>
//…..
…..
…..//
<userinput><attack id="0xe000da00" isActive="INHERIT"/></userinput>
<userinput></customizedAttacks></userinput>
<userinput></policy></userinput>
<userinput></IDSPolicy></userinput>
<userinput></PolicyExport></userinput>
----Boundary_1_12424925_1353496814940--
Response
{
"status": 1
}
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 | 5302 | Policy version not supported |
| 4 | 500 | 5303 | Unable to read file |
| 5 | 500 | 5304 | Unable to transfer file |
| 6 | 400 | 5305 | The policy given to import is not present in the file |
| 7 | 400 | 5306 | The policy given to import is not importable |
| 8 | 500 | 5307 | Policy import failed.. Please look into the logs.. |
| 9 | 500 | 2202 | Input stream read error |