Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

Navigation
Guide That Contains This Content
[+] Expand All
[-] Collapse All

    Create an Advanced Auto Submit Filter

    Creating an advanced auto submit filter involves the following APIs:

    Encoding PERL File of an Auto Submit Filter

    Use this API to encode Perl file containing the filter logic of an auto submit filter in Junos Space Service Now.

    URI

    https://[host]/api/juniper/servicenow/autosubmit-filter-management/encodePerlFile -F "fileName=@filename.pl" (HTTP method = POST)

    URI Parameters

    Element

    Type

    Required

    Description

    filename

    String

    Yes

    Name of the Perl script file (*.pl)to be encoded

    Consumes

    None

    Request Elements

    None

    Produces

    multipart/form-data

    Sample Output

    XkgJHNoZWxsID0gI ... AkKfQoKCg==

    Creating an Advanced Auto Submit Filter

    Use the createAdvancedFilter API to create an advanced auto submit filter. You must input the encoded perl script obtained by using the encodePerlFile API.

    For information about encoding a Perl file, see Encoding PERL File of an Auto Submit Filter.

    URI

    https://[host]/api/juniper/servicenow/autosubmit-filter-management/createAdvancedFilter (HTTP method = POST)

    URI Parameters

    None

    Consumes

    • application/vnd.juniper.servicenow.autosubmit-filter-management.filter +xml;version=1;charset=UTF-8
    • application/vnd.juniper.servicenow.autosubmit-filter-management.filter +json;version=1;charset=UTF-8

    Request Elements

    Element

    Type

    Description

    name

    String

    Name of the advanced auto submit filter

    action

    String

    Action to be taken on incidents that match the filter condition and terms

    Possible values:

    • SubmitCase
    • DoNotSubmitCase
    • AssociateToAnExistingCase

    advancedFilterAttribute

    advancedFilterAttribute

    Defines the advanced filter terms and conditions

    perlFileContent

    String

    Perl script, in encoded form, providing the logic for filtering incidents

    You can obtain the encoded Perl script by using the encodePerlScript API

    perlFileName

    String

    Name of the Perl file

    Produces

    • application/vnd.juniper.servicenow.autosubmit-filter-management.filter+xml;version=1
    • application/vnd.juniper.servicenow.autosubmit-filter-management.filter+json;version=1

    Response Elements

    Element

    Type

    Description

    uri

    String

    URI of the advanced filter

    id

    Integer

    ID of the advanced filter

    name

    String

    Name of the advanced filter

    type

    String

    Type of advanced filter

    Possible value—Advanced

    action

    String

    Action to be taken on incidents that match the filter condition and terms

    Possible values:

    • SubmitCase
    • DoNotSubmitCase
    • AssociateToAnExistingCase

    createdBy

    String

    User who created the filter

    priority

    Integer

    Order in which the filter is applied to incidents

    status

    String

    Status of the filter

    Possible values:

    • Enabled—Filter can be applied to an incident
    • Disabled—Filter cannot be applied to an incident

    advancedFilterAttribute

    advancedFilterAttribute

    Defines terms and conditions of the advanced filter

    inputParams

    String

    Attributes used in the filter for filtering an incident

    perlFileContent

    String

    Encoded Perl script providing the logic for filtering incidents

    You can decode the Perl script by using the Decode Perl script API

    perlFileName

    String

    Name of the Perl file

    method

    String

    Methods applicable to the advanced filter

    Sample Input

    Sample XML Input

    <filter>
    <name>adv_filter_100_REST</name>
    <action>DoNotSubmitCase</action>
    <advancedFilterAttribute>
    <perlFileContent>IyEvdXNyL2Jp ... SI7Cn0KCg==</perlFileContent>
    <perlFileName>test.pl</perlFileName>
    </advancedFilterAttribute>
    </filter>
    

    Sample JSON Input

    {
       "filter": {
          "name": "adv_filter_100_REST",
          "action": "DoNotSubmitCase",
          "advancedFilterAttribute": {
             "perlFileContent": "IyEvdXNyL2Jp ... SI7Cn0KCg===",
             "perlFileName": "test.pl"
          }
       }
    }
    

    Sample Output

    Sample XML Output

    <?xml version="1.0" encoding="UTF-8"?>
    <filter uri="/api/juniper/servicenow/autosubmit-filter-management/createAdvancedFilter">
       <id>6815746</id>
       <name>adv_filter_100_REST</name>
       <type>Advanced</type>
       <action>DoNotSubmitCase</action>
       <createdBy>super</createdBy>
       <priority>3</priority>
       <status>Enabled</status>
       <advancedFilterAttribute>
          <inputParams>eventType:deviceHostName:problemSynopsis:problemDescription:osPlatform: entity:junosVersion:eventTime</inputParams>
          <perlFileContent>IyEvdXNyL2Jp ... SI7Cn0KCg==</perlFileContent>
          <perlFileName>test.pl</perlFileName>
       </advancedFilterAttribute>
       <method href="/api/juniper/servicenow/autosubmit-filter-management/autosubmitFilters/6815746/modify" />
       <method href="/api/juniper/servicenow/autosubmit-filter-management/autosubmitFilters/6815746/enable" />
       <method href="/api/juniper/servicenow/autosubmit-filter-management/autosubmitFilters/6815746/disable" />
    </filter>
    

    Sample JSON Output

    {
      "filter": {
        "@uri": "/api/juniper/servicenow/autosubmit-filter-management/createAdvancedFilter",
        "id": 705648,
        "domainId": 2,
        "name": "adv_filter_100_REST",
        "type": "Advanced",
        "action": "DoNotSubmitCase",
        "createdBy": "super",
        "priority": 5,
        "status": "Enabled",
        "advancedFilterAttribute": {
          "inputParams": "eventType:deviceHostName:problemSynopsis:problemDescription:osPlatform:entity :junosVersion:eventTime:deviceId",
          "perlFileContent": "IyEvdXNyL2Jp ... SI7Cn0KCg==",
          "perlFileName": "test.pl"
        },
        "method": [
          {
            "@href": "/api/juniper/servicenow/autosubmit-filter-management/autosubmitFilters/705648/modify"
          },
          {
            "@href": "/api/juniper/servicenow/autosubmit-filter-management/autosubmitFilters/705648/enable"
          },
          {
            "@href": "/api/juniper/servicenow/autosubmit-filter-management/autosubmitFilters/705648/disable"
          }
        ]
      }
    }
    

    Decoding Perl File

    Use this API to decode Perl file of an auto submit filter in Junos Space Service Now.

    URI

    https://[host]/api/juniper/servicenow/autosubmit-filter-management/decodePerlFile (HTTP method = POST)

    URI Parameters

    None

    Consumes

    multipart/form-data

    Produces

    multipart/form-data

    Sample Input

    IyEvdXNyL2Jp ... SI7Cn0KCg==

    Sample Output

    #!/usr/bin/perl
    # Copyright 2009-2011 Juniper Networks, Inc. All rights reserved.
    use CGI;
    use CGI::Carp qw ( fatalsToBrowser warningsToBrowser );
    use warnings;
    use File::Copy;
    use lib ("/usr/nma/lib");
    use NmaUtil;
    use NmaUpgradeUtil;
    use NmaDb;
    
    $| = 1;  ## turn autoflush on
    $ENV{"PATH"}="/bin:/sbin:/usr/bin:/usr/sbin";
    $<=$>;
    

    Modified: 2017-07-19