ADC

Import and export files

You can import HTML or XML error objects, XML schemas, DTDs, and WSDLs to the Web App Firewall by using the GUI or the command line. You can edit any of these files in a web-based text area after importing them, to make small changes directly on the NetScaler instead of having to make them on your computer and then reimport them. Finally, you can export any of these files to your computer, or delete any of these files, by using the GUI.

Note:

You cannot delete or export an imported file by using the command line.

To import a file by using the command line interface

At the command prompt, type the following commands:

  • import appfw htmlerrorpage <src> <name>
  • <save> ns config

Example

The following example imports an HTML error object from a file named error.html and assigns it the name HTMLError.

import htmlerrorpage error.html HTMLError
save ns config
<!--NeedCopy-->

To import a file by using the GUI

Before you attempt to import an XML schema, DTD, or WSDL file, or an HTML or XML error object from a network location, verify that the NetScaler can connect to the Internet or LAN computer where the file is located. Otherwise, you cannot import the file or object.

  1. Navigate to Security > NetScaler Web App Firewall > Imports.

  2. Navigate to Application Firewall > Imports.

  3. In the Application Firewall Imports pane, select the tab for the type of file you want to import, and then click Add.

    The tabs are HTML Error Page, XML Error Page, XML Schema or WSDL. The upload process is identical on all four tabs from the user point of view.

  4. Fill in the dialog fields.

    • Name—A name for the imported object.

    • Import From—Choose the location of the HTML file, XML file, XML schema or WSDL that you want to import in the drop-down list:

      • URL: A web URL on a website accessible to the appliance.
      • File: A file on a local or networked hard disk or other storage device.
      • Text: Type or paste the text of the custom response directly into a text field in the GUI.

      The third text box changes to the appropriate value. The three possible values are provided below.

    • URL—Type the URL into the text box.

    • File—Type the path and filename to the HTML file directly, or click Browse and browse to the HTML file.

    • Text—The third field is removed, leaving a blank space.

  5. Click Continue. The File Contents dialog is displayed. If you chose URL or File, the File Contents text box contains the HTML file that you specified. If you chose Text, the File Contents text box is empty.

  6. If you chose Text, type or copy and paste the custom response HTML that you want to import.

  7. Click Done.

  8. To delete an object, select the object, and then click Delete.

To export a file by using the GUI

Before you attempt to export an XML schema, DTD, or WSDL file, or an HTML or XML error object, verify that the Web App Firewall appliance can access the computer where the file is to be saved. Otherwise, you cannot export the file.

  1. Navigate to Security > Web App Firewall > Imports.

  2. In the Web App Firewall Imports pane, select the tab for the type of file you want to export.

    The export process is identical on all four tabs from the user point of view.

  3. Select the file that you want to export.

  4. Expand the Action drop-down list, and select Export.

  5. In the dialog box, choose Save File and click OK.

  6. In the Browse dialog box, navigate to the local file system and directory where you want to save the exported file, and click Save.

To edit an HTML or XML Error Object in the GUI

You edit the text of HTML and XML error objects in the GUI without exporting and then reimporting them.

  1. Navigate to Security > NetScaler Web App Firewall > Imports, and then select the tab for the type of file that you want to modify.

  2. Navigate to Application Firewall > Imports, and then select the tab for the type of file that you want to modify.

  3. Select the file that you want to modify, and then click Edit.

    The text of the HTML or XML error object is displayed in a browser text area. You can modify the text by using the standard browser-based editing tools and methods for your browser.

    Note: The edit window is designed to allow you to make minor changes to your HTML or XML error object. To make extensive changes, you may prefer to export the error object to your local computer and use standard HTML or XML web page editing tools.

  4. Click OK, and then click Close.

Manage API specification files using CLI

You can validate incoming API traffic against the imported API specification by assigning it to a profile and setting a relaxation rule to either block or allow the traffic. You can also use the imported API specification in creating policy expressions. Importing an API specification consists of two steps:

  1. Import the API specification - Import an API specification to NetScaler through a URL or from the system.
  2. Add the API specification to NetScaler - When you add an API specification to NetScaler, the file is validated, converted into an internal format, and an API specification entity is created. The API specification entity created will be used in policy expressions and Web App Firewall profiles.

The following parameters are used in the CLI commands:

  • Name - Name of the API specification file that is uploaded.
  • Source - URL (protocol, host, path, and name) for the location to store the imported specification file.
  • Spec Name - The name of the entity that is created from the uploaded API specification.
  • Type - Input format of the API specification. Default Value: OAS

To import an API specification file, type:

import api specFile <name> <src>

Example:
import apispec testapispec.json http://www.example.com/testapispec.json

To add an API specification file, type:

add api spec <Name> -File <string> -Type <string>

Example:
add api spec testapispec -File testapispec.json -Type OAS

To update an API specification file, import a new specification file that needs to be updated.

At the command prompt, type:

update api spec <specName> -File <string> -Type <string>

Example:
update api spec testapispec -File testapispec.json -Type OAS

Note:

If the type attribute is not specified, OAS is the default type.

To view all the endpoints, type:

show api spec <specName>

Example:

show api spec testapispec

To delete the API specification, type:

rm api spec <specName>

Example:

rm api spec testapispec

Note:

Before removing the API specification, make sure it is not being used by any profile or policy.

Manage API specification files using the GUI

  1. Navigate to Security > NetScaler Web App Firewall > Imports.
  2. On the Imports page, select the API Spec Import Page tab, and then click Add.
  3. On the API Spec Import Object page, select any one of the following options for the Import From parameter:
    1. URL: A web URL on a website accessible to the appliance.
    2. File: A file on a local or networked hard disk or other storage device.
  4. Click Continue.
  5. On the API Spec Import Object page, enter the following details:
    1. API Spec Name – The name of the entity that is created from the uploaded API specification. Note: Both the API file name and the API Spec Name entered should be the same.
    2. API Spec Type – Select the type of specification.

      Types: REST (OpenAPI/Swagger), and gRPC(PROTO).

      Default Type: REST (OpenAPI/Swagger)

    3. Click Done.

The newly added entity is listed in the Imports page under the API Spec Import Page tab.

Import and export files