Create job

This endpoint is used to create a job.

Leave Feedback

URL

POST https://{api-url}/api/v2/tenants/{tenantId}/jobs

Sample URLs

https://{api-url}/api/v2/tenants/client_93/jobs

Status code

200 OK

Schedule patterns

Schedule the job with a specific pattern of Daily, Weekly, Monthly, Run once and Never.

Daily pattern

Schedule a job to run every day or on every weekday:

"pattern": {
		"type": "daily",
		"frequency": "everyday"
}

Weekly pattern

Schedule a job to run on every weekday:

"pattern": {
	"type": "weekly",
	"weekDays": "Sunday, Tuesday, Thursday, Saturday"
}

Monthly pattern

Schedule job to run on a specific day of every month:

"pattern": {
		"type": "monthly",
		"dayOfMonth": "1, 2, 3, 4, 5"
}

Schedule job to run on a specific weekday:

"pattern": {
		"type": "monthly",
		"weekIndex": "Second",
		"dayOfWeek": "Sunday"
}

Run o

Schedule a job to run for a single time after completion of the initial occurrence:

"pattern": {
		"type": "run once"
}

Never pattern

Schedule the job to run to only for a single time and not to reoccur again:

"pattern": {
		"type": "never"
}

Create job with job type - AD checklist

Parameters

FieldSub-FieldsData TypeValuesDescription
scriptjobTypeStringNAJob type. To view job types that OpsRamp supports, see Get Job Types API.
entitiesNAStringNA(Optional) Resource id and resource type on which the job is assigned.
nameNAStringNAThe job name.
jobQueuedNABooleantrue, false(Optional) To run a job constantly after execution of other jobs.
schedule1. startDateStringyyyy-MM-ddTHH:mm:ssZStart date for execution of job.
2. pattern
  1. typeStringdaily, weekly, monthly, never, run onceRecurrence pattern type.
  2. frequencyStringeveryday, every weekday, recurrenceDays on which the schedule is applied. Frequency is dependent on recurrence pattern type. Example: Provide type as weekly, then frequency is the day on which the job is run.
  3. repeatTypeStringdays Run the job constantly on specific days.
  4. weekDaysStringSunday, Monday, Tuesday, Wednesday, Thursday, Friday, SaturdayDays on which the job is run.
  5. dayOfMonthInteger1, 2, 3, 4, ..., 31Day on which the job is scheduled to run every month. Days range between 1 to 31. Example: Provide dayOfMonth as 4, then the job is run on the 4th day of every month.
  6. weekIndexStringFirst, Second, Third, Fourth, LastWeek on which the job is run. Example: First Monday.
  7. dayOfIndexStringSunday, Monday, Tuesday, Wednesday, Thursday, Friday, SaturdayDay on which the job is scheduled to run. Example: Provide weekIndex as First and dayOfMonth as Sunday, this indicates that job is run on every month First Sunday.

NA indicates that the value is not applicable.

Sample URLs

This is a sample request and response for an AD checklist job type.

https://{api-url}/api/v2/tenants/client_13/jobs

Sample request

{
	"name": "Ad Check List",
	"jobQueued": "true",
	"entities": [{
			"resource": {
				"id": "709824de-8315-4cf9-ad1c-b15aaf7bf2a5",
				"type": "DEVICE"
			}
		},
		{
			"resource": {
				"id": "4e96d5bc-763c-4c00-beab-928d653a0422",
				"type": "DEVICE"
			}
		}
	],
	"script": {
		"jobType": "adCheckList"
	},
	"schedule": {
		"startDate": "2016-04-14T10:10:10+0000",
		"pattern": {
			"type": "daily",
			"frequency": "recurrence",
			"repeatType": "Days",
			"repeatFrequency": "2"
		}
	}
}

Sample response

{
	"name": "Ad Check List",
	"entities": [{
			"resource": {
				"id": "709824de-8315-4cf9-ad1c-b15aaf7bf2a5",
				"generalInfo": {
					"ipAddresses": "10.233.19.130",
					"hostName": "10.233.19.130"
				},
				"clientUniqueId": "client_13",
				"type": "DEVICE"
			}
		},
		{
			"resource": {
				"id": "4e96d5bc-763c-4c00-beab-928d653a0422",
				"generalInfo": {
					"ipAddresses": "172.30.1.60",
					"hostName": "172.30.1.60"
				},
				"clientUniqueId": "client_13",
				"type": "DEVICE"
			}
		}
	],
	"schedule": {
		"startDate": "2016-04-14T10:10:00+0000",
		"pattern": {
			"type": "daily",
			"frequency": "recurrence",
			"repeatFrequency": 2,
			"repeatType": "days"
		}
	},
	"jobQueued": true,
	"script": {
		"jobType": "adCheckList"
	},
	"id": "4902d87c-b5df-4797-9f45-e807cd871ac9"
}

Create job with job type - network configuration backup

Parameters

FieldSub-FieldsData TypeValuesDescription
script1. jobTypeStringJob type to assign to resource.
2. configParamsParameters to configure for the job type Network Backup Configuration
  1. versionsSavedStringALL_VERSIONS, VERSION_WITH_CHANGESTake Backup of versions saved.
  2. backUpTriggerBooleantrue, falsePerform a backup on the receipt of a configuration change SNMP Trap.
  3. startupConfigAlertBooleantrue, falseGenerate alerts on changes to startup configuration.
  4. runConfigAlertBooleantrue, falseGenerate alerts on changes to runtime configuration.
  5. startUpConfigFilesBackUpBooleantrue, falseStartup configuration file to be backed up.
  6. runTimeConfigFilesBackUpBooleantrue, falseRuntime configuration file to be backed up.
3. entitiesStringNAResources on which the job is run.
4. nameStringNAThe job name.
jobQueuedNABooleantrue, false(Optional) Job queued indicates execution of job in an orderly manner called the queue.
schedule1. startDateStringyyyy-MM-ddTHH:mm:ssZStart date for execution of job.
2. pattern
  1. typeStringdaily, weekly, monthly, never, run onceRecurrence pattern type.
  2. frequencyStringeveryday, every weekday, recurrenceDays on which the schedule is applied. Frequency is dependent on recurrence pattern type. Example: Provide type as weekly, then frequency is the day on which the job is run.
  3. repeatTypeStringdays Run the job constantly on specific days.
  4. weekDaysStringSunday, Monday, Tuesday, Wednesday, Thursday, Friday, SaturdayDays on which the job is run.
  5. dayOfMonthInteger1, 2, 3, 4, ..., 31Day on which the job is scheduled to run every month. Days range between 1 to 31. Example: Provide dayOfMonth as 4, then the job is run on the 4th day of every month.
  6. weekIndexStringFirst, Second, Third, Fourth, LastWeek on which the job is run. Example: First Monday.
  7. dayOfIndexStringSunday, Monday, Tuesday, Wednesday, Thursday, Friday, SaturdayDay on which the job is scheduled to run. Example: Provide weekIndex as First and dayOfMonth as Sunday, this indicates that job is run on every month First Sunday.

NA indicates that the value is not applicable.

Sample URLs

This is a sample request and response for a network configuration backup job type.

https://{api-url}/api/v2/tenants/client_93/jobs

Sample request

{
	"name": "Network Config Backup",
	"jobQueued": "true",
	"entities": [{
			"resource": {
				"id": "709824de-8315-4cf9-ad1c-b15aaf7bf2a5",
				"type": "DEVICE"
			}
		},
		{
			"resource": {
				"id": "4e96d5bc-763c-4c00-beab-928d653a0422",
				"type": "DEVICE"
			}
		}
	],
	"script": {
		"jobType": "networkconfigbackup",
		"configParams": {
			"versionsSaved": "ALL_VERSIONS",
			"backUpTrigger": "true",
			"startupConfigAlert": "true",
			"runtimeConfigAlert": "true",
			"startUpConfigFilesBackUp": "true",
			"runTimeConfigFilesBackUp": "true"
		}
	},
	"schedule": {
		"startDate": "2016-04-14T10:10:10+0000",
		"pattern": {
			"type": "daily",
			"frequency": "recurrence",
			"repeatType": "Days",
			"repeatFrequency": "2"
		}
	}
}

Sample response

{
	"name": "Network Config Backup",
	"entities": [{
			"resource": {
				"id": "709824de-8315-4cf9-ad1c-b15aaf7bf2a5",
				"generalInfo": {
					"ipAddresses": "10.233.19.130",
					"hostName": "10.233.19.130"
				},
				"clientUniqueId": "client_13",
				"type": "DEVICE"
			}
		},
		{
			"resource": {
				"id": "4e96d5bc-763c-4c00-beab-928d653a0422",
				"generalInfo": {
					"ipAddresses": "172.30.1.60",
					"hostName": "172.30.1.60"
				},
				"clientUniqueId": "client_13",
				"type": "DEVICE"
			}
		}
	],
	"schedule": {
		"startDate": "2016-04-14T10:10:00+0000",
		"pattern": {
			"type": "daily",
			"frequency": "recurrence",
			"repeatFrequency": 2,
			"repeatType": "days"
		}
	},
	"jobQueued": true,
	"script": {
		"jobType": "networkconfigbackup",
		"configParams": {
			"versionsSaved": "ALL_VERSIONS",
			"backUpTrigger": true,
			"startupConfigAlert": true,
			"runtimeConfigAlert": true,
			"startUpConfigFilesBackUp": true,
			"runTimeConfigFilesBackUp": true
		}
	},
	"id": "cc242a8d-b0b4-430e-a89f-7081bc5e79b0"
}

Create job with job type - app install

Parameters

FieldSub-FieldsData TypeValuesDescription
1. script1. jobTypeStringNAThe job type.
2. approvalType
  1. approvalTypeInteger0 for Manual approval,
1 for Auto approval
Approval type required to install the app. Example: Provide 0 as approvalType which indicates app is manually installed.
  2. approvalReasonStringNAReason for approval of installing app.
  3. alertRequiredBooleantrue, falseAlert should be generated while installing app.
2. entitiesNAStringNA(Optional) Resources on which the job is run.
3. nameNAStringNA(Optional) The job name.
4. jobQueuedNABooleantrue, false(Optional) Job queued indicates the execution order of a job. Example: A job is placed in a queue, the job then run in a specific order provided in the queue.
5. schedule1. startDateStringyyyy-MM-ddTHH:mm:ssZ(Optional) Start date for execution of job.
2. pattern
  1. typeStringdaily, weekly, monthly, never, run onceRecurrence pattern type.
  2. frequencyStringeveryday, every weekday, recurrenceDays on which the schedule is applied. Frequency is dependent on recurrence pattern type. Example: Provide type as weekly, then frequency is the day on which the job is run.
  3. repeatTypeStringdays Run the job constantly on specific days.
  4. weekDaysStringSunday, Monday, Tuesday, Wednesday, Thursday, Friday, SaturdayDays on which the job is run.
  5. dayOfMonthInteger1, 2, 3, 4, ..., 31Day on which the job is scheduled to run every month. Days range between 1 to 31. Example: Provide dayOfMonth as 4, then the job is run on the 4th day of every month.
  6. weekIndexStringFirst, Second, Third, Fourth, LastWeek on which the job is run. Example: First Monday.
  7. dayOfIndexStringSunday, Monday, Tuesday, Wednesday, Thursday, Friday, SaturdayDay on which the job is scheduled to run. Example: Provide weekIndex as First and dayOfMonth as Sunday, this indicates that job is run on every month First Sunday.

NA indicates that the value is not applicable.

Sample URLs

This is a sample request and response for an app install job type.

https://{api-url}/api/v2/tenants/client_93/jobs

Sample request

{
	"name": "test",
	"jobQueued": "true",
	"entities": [{
			"resource": {
				"id": "709824de-8315-4cf9-ad1c-b15aaf7bf2a5",
				"type": "DEVICE"
			}
		},
		{
			"resource": {
				"id": "4e96d5bc-763c-4c00-beab-928d653a0422",
				"type": "DEVICE"
			}
		}
	],
	"script": {
		"jobType": "appinstall",
		"approvalType": {
			"approvalType": "1",
			"approvalReason": "for testing",
			"alertRequired": "true"
		}
	},
	"schedule": {
		"startDate": "2016-04-14T10:10:10+0000",
		"pattern": {
			"type": "daily",
			"frequency": "recurrence",
			"repeatType": "Days",
			"repeatFrequency": "2"
		}
	}
}

Sample response

{
	"name": "test",
	"entities": [{
			"resource": {
				"id": "709824de-8315-4cf9-ad1c-b15aaf7bf2a5",
				"generalInfo": {
					"ipAddresses": "10.233.19.130",
					"hostName": "10.233.19.130"
				},
				"clientUniqueId": "client_13",
				"type": "DEVICE"
			}
		},
		{
			"resource": {
				"id": "4e96d5bc-763c-4c00-beab-928d653a0422",
				"generalInfo": {
					"ipAddresses": "172.30.1.60",
					"hostName": "172.30.1.60"
				},
				"clientUniqueId": "client_13",
				"type": "DEVICE"
			}
		}
	],
	"schedule": {
		"startDate": "2016-04-14T10:10:00+0000",
		"pattern": {
			"type": "daily",
			"frequency": "recurrence",
			"repeatFrequency": 2,
			"repeatType": "days"
		}
	},
	"jobQueued": true,
	"script": {
		"jobType": "appinstall",
		"approvalType": {
			"approvalType": 1,
			"approvalReason": "for testing",
			"alertRequired": true
		}
	},
	"id": "8a87f644-0bdc-4d5a-9e41-0ca333b71acd"
}

Create job with job type - custom script

Parameters

FieldSub-FieldsData TypeValuesDescription
1. script1. jobTypeStringNAThe job type.
2. customScriptIntegerNACustom script ID.
  1. id
2. entitiesNAStringNA(Optional) Date on which the job execution is initiated.
3. nameNAStringNA(Optional)The job name.
4. jobQueuedNABooleantrue, false(Optional) Job queued indicates the execution order of a job.
5. schedule1. startDateStringyyyy-MM-ddTHH:mm:ssZ(Optional) Start date for execution of job.
2. pattern
  1. typeStringdaily, weekly, monthly, never, run onceRecurrence pattern type.
  2. frequencyStringeveryday, every weekday, recurrenceDays on which the schedule is applied. Frequency is dependent on recurrence pattern type. Example: Provide type as weekly, then frequency is the day on which the job is run.
  3. repeatTypeStringdays Run the job constantly on specific days.
  4. weekDaysStringSunday, Monday, Tuesday, Wednesday, Thursday, Friday, SaturdayDays on which the job is run.
  5. dayOfMonthInteger1, 2, 3, 4, ..., 31Day on which the job is scheduled to run every month. Days range between 1 to 31. Example: Provide dayOfMonth as 4, then the job is run on the 4th day of every month.
  6. weekIndexStringFirst, Second, Third, Fourth, LastWeek on which the job is run. Example: First Monday.
  7. dayOfIndexStringSunday, Monday, Tuesday, Wednesday, Thursday, Friday, SaturdayDay on which the job is scheduled to run. Example: Provide weekIndex as First and dayOfMonth as Sunday, this indicates that job is run on every month First Sunday.
6. userTypeNAInteger1- system user,
2- Other user
(Optional) The user type.
7. credentialSetuniqueIdStringNA(Optional) Device or client credential set ID.
  • Use Get Minimal Details of Device Credential Sets API to fetch the list of credentials sets assigned to a device.
  • Use Get Minimal Details of Client Credential Sets API to fetch the list of credentials assigned to a client.
8. parameters1. paramIdIntegerNA(Optional) The parameter Id.
2. value or itopMacroIntegerNAValue.
  1. id

NA indicates that the value is not applicable.

Sample URLs

This is a sample request and response for a custom script job type.

https://{api-url}/api/v2/tenants/client_93/jobs
https://{api-url}/api/v2/tenants/msp_12/jobs

Sample request

{
	"jobQueued": "true",
	"script": {
		"jobType": "custom",
		"userType": "2",
		"customScript": {
			"id": "7"
		},
		"parameters": [{
			"paramId": "2",
			"value": "150"
		}]
	},
	"entities": [{
			"resource": {
				"id": "709824de-8315-4cf9-ad1c-b15aaf7bf2a5",
				"type": "DEVICE"
			}
		},
		{
			"resource": {
				"id": "4e96d5bc-763c-4c00-beab-928d653a0422",
				"type": "DEVICE"
			}
		}
	],
	"schedule": {
		"startDate": "2016-04-14T10:10:10+0000",
		"pattern": {
			"type": "daily",
			"frequency": "recurrence",
			"repeatType": "Days",
			"repeatFrequency": "2"
		}
	}
}

Sample response

{
	"name": "Job - test script",
	"entities": [{
			"resource": {
				"id": "709824de-8315-4cf9-ad1c-b15aaf7bf2a5",
				"generalInfo": {
					"ipAddresses": "10.233.19.130",
					"hostName": "10.233.19.130"
				},
				"clientUniqueId": "client_13",
				"type": "DEVICE"
			}
		},
		{
			"resource": {
				"id": "4e96d5bc-763c-4c00-beab-928d653a0422",
				"generalInfo": {
					"ipAddresses": "172.30.1.60",
					"hostName": "172.30.1.60"
				},
				"clientUniqueId": "client_13",
				"type": "DEVICE"
			}
		}
	],
	"schedule": {
		"startDate": "2016-04-14T10:10:00+0000",
		"pattern": {
			"type": "daily",
			"frequency": "recurrence",
			"repeatFrequency": 2,
			"repeatType": "days"
		}
	},
	"jobQueued": true,
	"script": {
		"customScript": {
			"id": 7,
			"name": "test script",
			"description": "test script",
			"platforms": [
				"WINDOWS"
			]
		},
		"parameters": [{
			"paramId": 2,
			"name": "String",
			"value": "150"
		}],
		"userType": 2
	},
	"id": "ce1088d5-81cc-4262-b515-a75230f0d8e4"
}