Jobs API

Contents

/jobs

Description

Creates  a job.

URL structure

https?//smart.cloud.com/v0/jobs

URL example

https://smart.cloud.com/v0/jobs?access_token=0381wgyH5IDo5YcQp25CxBkJd

Method

POST

Parameters

JSON payload

Sample payload:

{"jobName":null,"role":"Admin","runNow":true,"timeZone":null,"description":"TestJob1454661194070","destInstallDir":null,"version":"1","targets":[111],"serverGroups":[],"cronExpr":null,"jobId":null,"scriptId":"89199","scheduleType":12,"scriptType":null,"name":"TestJob1454661194070","repeatInterval":0,"startTime":0,"endTime":0,"user":"10009","repeatCount":0}

Response

JSON payload

Sample response:

{
   "companyId":10200,
   "role":"Admin",
   "user":"10009",
   "extraAttrs":{

   },
   "name":"TestJob1454661194070",
   "description":"TestJob1454661194070",
   "scriptId":89199,
   "version":"1",
   "scriptArgs":[

   ],
   "targets":[
      111
   ],
   "scheduleType":12,
   "startTime":1454661282673,
   "endTime":86560703999673,
   "repeatCount":0,
   "repeatInterval":0,
   "offset":0,
   "jobId":54521,
   "taskParameters":[

   ],
   "serverGroups":[

   ],
   "serverGroupExpr":"",
   "excludeTargets":[

   ],
   "jobParams":{
      "script":"Test Script1454661177974"
   },
   "credentialId":0,
   "parentJobId":0,
   "runNow":true,
   "trigger":{
      "name":"103249",
      "jobName":"54521",
      "organizationId":10200,
      "roleName":"Admin",
      "userName":"10009",
      "startTime":1454661282673,
      "endTime":86560703999673,
      "repeatCount":0,
      "repeatInterval":0,
      "timesTriggered":1,
      "prevFireTime":1454661282673,
      "volatile":false
   },
   "jobDetail":{
      "name":"TestJob1454661194070",
      "jobClass":"com.centro.sched.BasicJob",
      "jobDataMap":{
         "data":{
            "script":"Test Script1454661177974"
         }
      },
      "projectGroup":"47957",
      "targetGroup":"162589",
      "schedule":"103249",
      "jobId":54521,
      "parentJobId":0,
      "role":"Admin",
      "user":"10009",
      "organizationid":10200,
      "durable":false,
      "stateful":false,
      "volatile":false
   }
}

Back to top

/jobs/{id} (POST)

Description

Updates a job.

URL structure

https?//smart.cloud.com/v0/jobs/id

URL example

https://smart.cloud.com/v0/jobs/54523?access_token=0381wgyH5IDo5YcQp25CxBkJd

Method

POST

Parameters

JSON payload

Sample payload: {"jobName":null,"role":"Admin","runNow":true,"timeZone":null,"description":"UpdateJob1454661467391","destInstallDir":null,"version":"1","targets":[111],"serverGroups":[],"cronExpr":null,"jobId":null,"scriptId":"89203","scheduleType":12,"scriptType":null,"name":"UpdateJob1454661467391","repeatInterval":0,"startTime":0,"endTime":0,"user":"10009","repeatCount":0}

Response

JSON payload

Sample response:

{
   "companyId":10200,
   "role":"Admin",
   "user":"10009",
   "extraAttrs":{

   },
   "name":"UpdateJob1454661467391",
   "description":"UpdateJob1454661467391",
   "scriptId":89203,
   "version":"1",
   "scriptArgs":[

   ],
   "targets":[
      111
   ],
   "scheduleType":12,
   "startTime":1454661524856,
   "endTime":86560703999856,
   "repeatCount":0,
   "repeatInterval":0,
   "offset":0,
   "jobId":54523,
   "taskParameters":[

   ],
   "serverGroups":[

   ],
   "serverGroupExpr":"",
   "excludeTargets":[

   ],
   "jobParams":{

   },
   "credentialId":0,
   "parentJobId":0,
   "runNow":true
}

Back to top

/jobs/{id} (GET)

Description

Get job details based on the specified job ID.

URL structure

https?//smart.cloud.com/v0/jobs/<id>?access_token=<valid access token>

URL example

https?//smart.cloud.com/v0/jobs/1814?access_token=wQYgficC7jY0wypJKHbsiEYB5

Method

GET

Response

JSON payload

Sample response:

{
   "jobName":"TestJob1429506352321",
   "role":"Admin",
   "jobRunDetails":[

   ],
   "inputParams":[
      {
         "values:":[
            ""
         ],
         "taskid":22527
      }
   ],
   "className":"com.centro.sched.BasicJob",
   "scheduleBeans":[
      {
         "dirty":false,
         "prevFireTime":1429506368528,
         "calendarType":"no calendar",
         "offset":0,
         "runNow":false,
         "nextFireTime":0,
         "timesTriggered":0,
         "jobId":23907,
         "companyId":0,
         "scheduleType":12,
         "name":"trigger_TestJob1429506352321",
         "repeatInterval":0,
         "startTime":1429506368528,
         "endTime":86560732799528,
         "extraAttrs":{

         },
         "scheduleId":104211,
         "repeatCount":0,
         "status":"complete"
      }
   ],
   "tagList":[

   ],
   "jobDataMap":{
      "data":{
         "script_type":"bat",
         "version":"1"
      }
   },
   "serverGroups":[

   ],
   "jobId":23907,
   "companyId":0,
   "processId":0,
   "parentJobId":0,
   "actionGroupId":23307,
   "targetGroupId":57101,
   "targetDetailBeans":[
      {
         "hostName":"test-zss1-db",
         "agentId":2515,
         "role":"Admin",
         "nodeMask":"",
         "osCat":"#1 SMP Fri May 20 03:51:51 BST 2011",
         "ipAddress":"50.57.187.29",
         "nodeMac":"eth0",
         "osName":"Linux",
         "osVer":"2.6.32-71.el6.x86_64",
         "nodeHw":"x86_64",
         "companyId":40034,
         "nodeDesc":"huy_tag2sdafsd",
         "user":"10087",
         "extraAttrs":{

         },
         "nodeIf":"40:40:90:c1:db:bc"
      }
   ],
   "jobDescription":"TestJob1429506352321",
   "user":"10087",
   "extraAttrs":{

   },
   "status":"scheduled"
}

Back to top

/jobs?type=<script>&id=<id of script>

Description

Gets a list of jobs for a given script.

URL structure

https://smart.cloud.com/v0/jobs?type=<script>&id=<script_id>& access_token=<valid access token>

URL example

https://smart.cloud.com/v0/jobs?type=script&id=89151&access_token=VUHlewcsthNeVca7Fb5zR5oKC

Method

GET

Parameters

Name Required or optional Valid Values
type Required script; patch; update
scriptID Optional Use when type parameter is script.

Response

JSON payload

Sample response:

[
   {
      "actionGroupId":0,
      "targetGroupId":0,
      "jobId":1814,
      "status":"complete",
      "targetDetailBeans":[

      ],
      "serverGroups":[

      ],
      "jobName":"Sample Job",
      "jobDescription":"This job is auto-created",
      "parentJobId":0,
      "role":"Admin",
      "tagList":[

      ],
      "companyId":40042,
      "scheduleBeans":[
         {
            "scheduleId":15226,
            "jobId":0,
            "status":"complete",
            "nextFireTime":0,
            "repeatCount":0,
            "endTime":86560703999350,
            "startTime":1339353250011,
            "scheduleType":12,
            "prevFireTime":1339353250011,
            "repeatInterval":0,
            "timesTriggered":1,
            "dirty":false,
            "role":"Admin",
            "companyId":40042,
            "user":"10093"
         }
      ],
      "user":"10093"
   }
]

Back to top

/jobs/{jobid}/runinfo

Description

Gets run information for a job. 

URL structure

https?//smart.cloud.com/v0/jobs/<jobid>/runinfo?access_token=<valid access token>

Method

GET

Parameters

Name Required or Optional Description
runid optional Can specify run ID.

Response

JSON payload

Sample response:

 [
   {
      "jobId":1814,
      "taskPropertyBeans":[

      ],
      "status":"complete",
      "role":"Admin",
      "companyId":40042,
      "projectId":69,
      "runId":65,
      "user":"10093",
      "runTimestamp":1339099219184
   }
] 

Back to top

/jobs/{jobid}/runoutput?runid=<valid runid> 

Description

Gets job output from target nodes.

URL structure

https?//smart.cloud.com/v0/jobs/<jobid>/runoutput?runid=<validrunid>&access_token=<valid access token>

Method

GET

Parameters

runid (required)

Response

JSON payload 

Back to top

/jobs or /jobs/{id} (POST)

Description

Creates or updates a Patch/Update job.

URL structure

https?//smart.cloud.com/v0/jobs

Method

POST

Parameters

JSON payload

Sample payload:

curl -H "Content-Type:application/json" -d

{"name":"Apply winpatch","type":":"applypatch","endTime":0,"startTime":1341512411044,"scheduleType":12,"taskParameters":[],"repeatInterval":0,"companyId":0,"targets":[351],"scriptArgs":["Windows Malicious Software Removal Tool x64 - February 2012 (KB890830)"]}   -k  'https?//smart.cloud.com/v0/jobs?access_token=<valid access token>'

Response

JSON payload

Sample response:

{
   "jobId":2074,
   "scriptType":"applypatch",
   "excludeTargets":[

   ],
   "repeatCount":0,
   "serverGroups":[

   ],
   "endTime":86560703999945,
   "startTime":1341512411044,
   "scheduleType":12,
   "taskParameters":[

   ],
   "repeatInterval":0,
   "name":"Apply winpatch",
   "role":"Admin",
   "companyId":40042,
   "scriptId":0,
   "user":"10093",
   "targets":[
      351
   ],
   "scriptArgs":[
      "Windows Malicious Software Removal Tool x64 - February 2012 (KB890830)"
   ]
}

Back to top

0 Comments