REST Resources
-
/ -
/exec-deploy -
/exec-scripts -
/job-instances /{job-id} /script-mgmt-job-results -
/match-scripts-by-context -
/scripts -
/scripts /exec-deploy -
/scripts /exec-disable -
/scripts /exec-enable -
/scripts /exec-remove -
/scripts /exec-scripts -
/scripts /exec-verify -
/scripts /{script-id} -
/scripts /{script-id} /contents -
/scripts /{script-id} /parameters -
/scripts /{script-id} /results -
/scripts /{script-id} /view-associated-devices
/api/space/script-management/scripts
The following operations are supported on this resource:
GET /scripts | Version 3 |
Get all scripts.
Sample Usage
GET /scripts
-
Accept Headers:
application/vnd.net.juniper.space.script-management.scripts+xml;version=3
application/vnd.net.juniper.space.script-management.scripts+json;version=3
<scripts total="Integer" uri="/api/space/script-management/scripts">
<script href="/api/space/script-management/scripts/{id}" uri="/api/space/script-management/scripts/{id}">
<id>Integer</id>
<scriptName>String</scriptName>
<category>String</category>
<domain-name>String</domain-name>
<domain-id>Integer</domain-id>
</script>
</scripts>
{
"scripts" : {
"@total" : "Integer" ,
"@uri" : "/api/space/script-management/scripts" ,
"script" : {
"@href" : "/api/space/script-management/scripts/{id}" ,
"@uri" : "/api/space/script-management/scripts/{id}" ,
"id" : "Integer" ,
"scriptName" : "String" ,
"category" : "String" ,
"domain-name" : "String" ,
"domain-id" : "Integer"
}
}
}
Access Control
The following capabilities are required to access this API: ViewScriptsCap
POST /scripts | Version 1 |
This API is used to add or import script contents to the platform. The script type is always determined from the contents of the script and the field script type is never evaluated (even if there is a value present in the input).
Sample Usage
POST /scripts
-
Content-Type Headers:
application/vnd.net.juniper.space.script-management.script+xml;version=1;charset=UTF-8
application/vnd.net.juniper.space.script-management.script+json;version=1;charset=UTF-8 -
Accept Headers:
application/vnd.net.juniper.space.script-management.script+xml;version=1
application/vnd.net.juniper.space.script-management.script+json;version=1
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<script>
<scriptName>cpu-usage-60.slax</scriptName>
<scriptContents><![CDATA[
Version 1.0;
ns junos = "http://xml.juniper.net/junos/*\/junos";
ns xnm = "http://xml.juniper.net/xnm/1.1/xnm";
ns jcs = "http://xml.juniper.net/junos/commit-scripts/1.0";
ns ext = "http://xmlsoft.org/XSLT/namespace";
import "../import/junos.xsl";
\/*
* This commit script checks that any interfaces with "CORE" or "core"
* in the description is configured with an MTU of 4484.
* The search criteria and MTU should be changed to fit the environment
* and requirements.
*\/
match configuration { for-each (interfaces/interface) { var $int = name; var $unit =
unit/name; var $desc = unit/description; var $mtu = mtu; if (contains($desc, "CORE")
|| contains($desc, "core")) { if (not ($mtu == 4484)) { <xnm:warning> {
<message> { expr "MTU on backbone interface"; expr $int; expr "."; expr $unit;
expr " is not set to 4484"; expr " ("; expr $mtu; expr ")"; } } } } }
]]></scriptContents>
</script>
Note : The actual script provided is inside a CDATA tag.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<script>
<id>1114117</id>
<scriptName>slax-event1.slax</scriptName>
<type>TYPE_EVENT</type>
<category>sample</category>
<lastestRevision>1.1</lastestRevision>
<scriptSize>7520</scriptSize>
<completionStatus>IMPORT_SUCCESS</completionStatus>
<collection href="/api/space/script-management/scripts/11173888/results"/>
<contents href="/api/space/script-management/scripts/11173888/contents"/>
<parameters href="/api/space/script-management/scripts/11173888/parameters"/>
<view-associated-devices href="/api/space/script-management/scripts/11173888/view-associated-devices"/>
</script>
{
"script": {
"scriptName":"slax-event1.slax",
"scriptContents":"Version 1.0;\
ns junos = \"http:\/\/xml.juniper.net\/junos\/*\/junos\";\
ns xnm = \"http:\/\/xml.juniper.net\/xnm\/1.1\/xnm\";\
ns jcs = \"http:\/\/xml.juniper.net\/junos\/commit-scripts\/1.0\";\
ns ext = \"http:\/\/xmlsoft.org\/XSLT\/namespace\";import \"..\/import\/junos.xsl\";\
/** This commit script checks that any interfaces with \"CORE\" or \"core\"\
* in the description is configured with an MTU of 4484.\
* The search criteria and MTU should be changed to fit the environment\
* and requirements.\
*\/\
match configuration { for-each (interfaces\/interface) { var $int = name; var $unit\
= unit\/name; var $desc = unit\/description; var $mtu = mtu; if (contains($desc,\
\"CORE\") || contains($desc, \"core\")) { if (not ($mtu == 4484)) {\
<xnm:warning> { <message> { expr \"MTU on backbone interface\"; expr\
$int; expr \".\"; expr $unit; expr \" is not set to 4484\"; expr \" (\"; expr\
$mtu;expr \")\"; } } } } } } "
}
}
Note : The actual script provided starts from
"Version 1.0;ns junos = ........... expr $mtu; expr \")\"; } } } } }}"
Note that all special characters, new lines, tabs, and so on must be
escaped in the contents of the script. This change is needed to correctly
unmarshal script content by the JAX-B unmarshaler.
{
"script": {
"id": "1114117" ,
"scriptName": "slax-event1.slax" ,
"type": "TYPE_EVENT" ,
"category": "sample" ,
"lastestRevision": "1.1" ,
"scriptSize": "7520" ,
"completionStatus": "IMPORT_SUCCESS" ,
"collection" : {
"href" : "/api/space/script-management/scripts/11173888/results"
},
"contents" : {
"href" : "/api/space/script-management/scripts/11173888/contents"
},
"parameters" : {
"href" : "/api/space/script-management/scripts/11173888/parameters"
},
"view-associated-devices" : {
"href" : "/api/space/script-management/scripts/11173888/view-associated-devices"
}
}
}
Access Control
The following capabilities are required to access this API: ImportScriptsCap
Data Notification
This API supports data notification.