Views:
Post and upload a file with one or more Reputation entries.
  • IP, domain name, and file hash entries — Import file must be in a comma-separated value (CSV) format with each line representing a Reputation entry without any blank lines. Each line is made up of one or more fields separated by commas. The SMS can upload one file at a time, and each file can contain multiple entries.
  • URL entries — Import file must be delimited by a pipe (|) instead of a comma with each entry representing URLs only or URLs associated with one or more tags. Each line is made up of one or more fields separated by pipes. For more information about the URL import guidelines, see the URL Reputation Filtering Deployment and Best Practices Guide.
  • Comment lines are discarded during import.
  • Each request results in a distribution and a sync time to the managed devices.
  • For improved performance, limit the number of entries in a file to between 1,000 and 10,000.
  • CSV files are imported using HTTP POST requests.

Definition

repEntries/import

Parameters

Parameter Type Description
type string Optional. Address type of the Reputation entry. Only one type is allowed within a file.
  • ipv4 (default)
  • ipv6
  • dns
  • url
  • filehash-sha1
  • filehash-sha256

Examples

curl -v  -X POST -k  --header "X-SMS-API-KEY: <string>"
-F "requestFile=@./repEntries-ipv4.csv" "https://<sms_server>/repEntries/import?type=ipv4"
curl -v  -X POST -k  --header "X-SMS-API-KEY: <string>"  
-F "requestFile=@./repEntries-ipv6.csv" "https://<sms_server>/repEntries/import?type=ipv6"
curl -v  -X POST -k  --header "X-SMS-API-KEY: <string>"  
-F "requestFile=@./repEntries-dns.csv" "https://<sms_server>/repEntries/import?type=dns"
curl -v  -X POST -k  --header "X-SMS-API-KEY: <string>"  
-F "requestFile=@./repEntries-url.csv" "https://<sms_server>/repEntries/import?type=url"
curl -v  -X POST -k  --header "X-SMS-API-KEY: <string>"  
-F "requestFile=@./repEntries-sha1.csv" "https://<sms_server>/repEntries/import?type=filehash-sha1"
curl -v  -X POST -k  --header "X-SMS-API-KEY: <string>"  
-F "requestFile=@./repEntries-sha256.csv"   "https://<sms_server>/repEntries/import?type=filehash-sha256"
Tip
Tip
When you import large files through the SMS or a Web API, the SMS uses an import process to queue the files that will be imported. This process begins after the Web API has returned. An HTTP Status code of 200 indicates that a file was queued for import. View the SMS audit log for the results of the import request.
If a file contains duplicate values for the first (address) field, the row with the first of the duplicates found is the one that gets imported. A duplicate record found in a file will not keep the remaining records in the file from being processed.

Syntax rules for import files

Except for files with URL entries, an import file must be in a comma-separated value (CSV) format with each line representing a reputation entry without any blank lines. Each line is made up of one or more fields separated by commas. The import discards any comment lines.
For URL entries, the import file must be delimited by pipe (|) instead of commas, and entries can be URLs only or URLs associated with one or more tags. Each line is made up of one or more fields separated by pipes. For more information about the URL import guidelines, refer to the URL Reputation Filtering Deployment and Best Practices Guide.
Use the fields described in the following table for the entries in your file.
Field Required Description
Address Yes
The first field on each line must be the IPv4 address, IPv6 address, domain name, URL, or file hash for that entry. The remaining fields on a line are optional. If present, remaining fields are processed as tag category/tag value pairs.
  • Only one type of address (IPv4, IPv6, domain name, URL, file hash SHA-1, or file hash SHA-256) can be contained in a file.
  • File hash CSV files should have either SHA-1 or SHA-256 records, but never both in the same file. The entire file will be expected to have either SHA-1 or SHA-256 file hashes.
  • SHA-1 files can have entries prefixed with the string sha1:. SHA-256 files can have entries prefixed with the string sha256:. Prefixing will still not enable a file to mix file hash types. To import both file types, import them in different files. SHA-1 hashes are expected to be 40 characters long in the appropriate range. SHA-256 hashes are expected to be 64 characters long in the appropriate range.
  • A domain name entry matches any look-ups that contain the specified string. For example, foo.com matches foo.com, www.foo.com, and images.foo.com. To specify an exact domain name entry match, enclose the domain name in square brackets. For example, [foo.com].
  • CIDR values are normalized. Any bits outside the portion of the address specified by the prefix length are changed to zero. For example, 192.168.66.127/24 is stored as 192.168.66.0/24.
Tag category/tag value pair No If the reputation entry within the file does not have tags, the imported entry merges with the values of the existing entry. If the reputation entry within the file does have tags, the imported entry merges and overwrites the values of the existing entry.
  • Any tag categories in the file must exist on the SMS prior to import.
  • Tag category/value pairs do not have to be listed in the same order on each line. The entries in the file do not have to list all the tag categories or specify the ones shared with other entries in the file.
  • Empty pairs of fields are ignored. If a tag category field is empty, an error occurs, and the entry is not imported. If a tag value field is empty, the corresponding tag category is discarded, and the next field of the entry is processed; the net result is equivalent to the tag category not appearing on that line at all.
  • Except for yes/no tag categories, character case is significant in all tag category names and tag values.
  • For yes/no tag categories, the text yes, regardless of case, denotes a yes value. Any other text is considered a no value.
  • For list categories, the list values must be separated by ~~~ (three tildes).
  • A field can be enclosed in double-quotes; this is mandatory when a value contains a comma that should not be treated as a field separator.
  • To represent a double-quote character within a quoted value, use two double-quotes. For example, "This comment ""contains"" quotes."

Import file example

For this example, the following tag categories are defined:
  • Country (List)
  • Approved (Yes/No)
  • Comment (Text)
For the Country tag category, the following tag values are defined:
  • China
  • Mexico
  • United States
The following example shows a file with IPv4 Reputation entries.
1.2.3.0/24,Country,United States,Approved,yes
2.3.0.0/16,Country,Mexico,Approved,no
3.4.5.0/24,Approved,yes,Country,China
1.2.3.0/24,Country,United States,Approved,yes,Comment,"This
            comment, contains a comma"
1.2.3.0/24,Country,United States,Approved,yes,Comment,"This
            comment ""contains"" quotes"
2.3.0.0/16
3.4.5.0/24,,,,
The following example shows a file with URL Reputation entries. It contains a user-defined tag category, Source, which must be created before attempting to import the file.
https://www.cnn.com|Source|URL
https://www.google.com|Source|URL
https://www.facebook.com|Source|URL
https://www.trendmicro.com|Source|URL
https://www.ebay.com|Source|URL
https://www.amazon.com|Source|URL
The following example shows a file with SHA-1 file hash entries that has no defined tags. Note that SHA-1 file hashes should be exactly 40 characters in length in the appropriate range. (A file with SHA-256 file hash entries would have hashes 64 characters long in the appropriate character range.)
0047ec317c28baa9b6a4b5ee3e8c78abfe2d0c61
0dfc9caaef84a33795541655ae0a0bb76c27f9b3
0fe995653b91dc4760d4b12f1464414b5dbe1747
11bb0c64cccba49ed249b526d9c3563087248625
2b91418b6f9e75231db1f4a8a0046dbf6ec9d9ab
2fed31e9687a49127676ea2f60a1bda38538cca8
4474703263bc73015ba83d39dbd3211baee37b4c
Note
Note
When you request back-to-back imports with files that have 10 or less Reputation entries, the SMS groups those entries to use the add method instead to reduce the number of distributions.