CoreService

<back to all web services

GetJob

Job - CRUD

Get job

Requires Authentication
Required role:TenantReader
The following routes are available for this service:
GET/api/jobs/{Id}Returns the job
GET/jobs/{Id}Returns the job
import Foundation
import ServiceStack

/**
* Get job
*/
// @Api(Description="Get job")
// @ApiResponse(Description="The request endend successful", IsDefaultResponse=true, ResponseType=typeof(JobDto), StatusCode=200)
public class GetJob : IGetSingleRequest, IHasTenantName, IGet, Codable
{
    // @ApiMember(DataType="string", Format="guid", IsRequired=true, ParameterType="path")
    // @Validate(Validator="NotEmpty")
    public var id:String

    // @ApiMember(DataType="string", IsRequired=true, ParameterType="header")
    // @Validate(Validator="NotEmpty")
    public var tenantName:String

    /**
    * If true, also soft deleted items will be returned
    */
    // @ApiMember(Description="If true, also soft deleted items will be returned", ParameterType="query")
    public var includeDeleted:Bool?

    /**
    * Returns all referenced object
    */
    // @ApiMember(Description="Returns all referenced object", ParameterType="query")
    public var includeReferencedObjects:Bool?

    required public init(){}
}

public class JobDto : IHasIdName, IHasTenantId, IAuditable, IHasObjectType, Codable
{
    /**
    * The id of the job
    */
    public var id:String
    /**
    * The id of the tenant
    */
    public var tenantId:String
    /**
    * The name of the job
    */
    public var name:String
    public var objectType:ObjectTypes
    /**
    * An additional message
    */
    public var message:String
    /**
    * Api link pointing to this object
    */
    public var selfLink:String
    /**
    * The id of the configitem the job belongs to
    */
    public var configItemId:String?
    /**
    * The type of the configitem the job belongs to
    */
    public var configItemType:ObjectTypes?
    /**
    * The job type
    */
    public var jobType:JobTypes
    /**
    * The current state of the job
    */
    public var state:JobStates
    /**
    * The timestamp, when the job got started
    */
    public var startTime:Date
    /**
    * The timestamp, when the job has finished
    */
    public var endTime:Date?
    /**
    * The duration (in seconds) of the job
    */
    public var duration:Int
    /**
    * The id of the related workflow
    */
    public var workflowId:String
    /**
    * The id of the related scheduled task
    */
    public var schedulerId:String
    /**
    * The jobs progress in percent (0...100)
    */
    public var progress:Double
    /**
    * Contains various infos about the job
    */
    public var config:[String:String] = [:]
    /**
    * The time the job was created
    */
    public var created:Date
    /**
    * The user the job was created with
    */
    public var createUser:String
    /**
    * The user id the job was created with
    */
    public var createUserId:String
    /**
    * The user email the job was created with
    */
    public var createUserEmail:String
    /**
    * The time the job was last modified
    */
    public var modified:Date
    /**
    * The user the job was modified with
    */
    public var modifyUser:String
    /**
    * The user id the job was modified with
    */
    public var modifyUserId:String
    /**
    * True if the job is deleted
    */
    public var isDeleted:Bool
    /**
    * The time the job was deleted
    */
    public var deleted:Date?
    /**
    * The user the job was deleted with
    */
    public var deleteUser:String
    /**
    * The user id the job was deleted with
    */
    public var deleteUserId:String
    /**
    * Will be evaluated by event endpoints
    */
    public var sendNotifications:Bool
    /**
    * True if it is in any of the 'running' states
    */
    public var isRunning:Bool
    /**
    * Jobs with failed JobEvents are marked with NeedsAttention
    */
    public var needsAttention:Bool

    required public init(){}
}

public enum ObjectTypes : String, Codable
{
    case None
    case ConfigItem
    case Tenant
    case Collection
    case Resource
    case ComputeNode
    case VirtualMachine
    case PhysicalMachine
    case Disk
    case Subnet
    case IPAddress
    case Job
    case JobEvent
    case FreezePeriod
    case ResourceGroup
    case Deployment
    case ResourceGroupTemplate
    case DeploymentTemplate
    case ResourceProvider
    case GenericResource
    case Role
    case Permission
    case User
    case PatchingWindow
    case Update
    case ReportDefinition
    case TimeSeries
    case DataPoint
    case Action
    case ActionAssignment
    case UserNote
}

public enum JobTypes : String, Codable
{
    case Create
    case Update
    case Delete
    case Start
    case Stop
    case Restart
    case Backup
    case Restore
    case Patch
    case Action
}

public enum JobStates : String, Codable
{
    case Pending
    case Starting
    case Running
    case Suspended
    case Stopping
    case Completed
    case Failed
}


Swift GetJob DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .json suffix or ?format=json

To embed the response in a jsonp callback, append ?callback=myCallback

HTTP + JSON

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

GET /api/jobs/{Id} HTTP/1.1 
Host: core.starburst.svc 
Accept: application/json
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"id":"00000000-0000-0000-0000-000000000000","tenantId":"00000000-0000-0000-0000-000000000000","name":"String","objectType":"Job","message":"String","selfLink":"String","configItemId":"00000000-0000-0000-0000-000000000000","configItemType":"None","jobType":"Create","state":"Pending","startTime":"0001-01-01T00:00:00.0000000Z","endTime":"0001-01-01T00:00:00.0000000Z","duration":0,"workflowId":"String","schedulerId":"String","progress":0,"config":{"String":{}},"created":"0001-01-01T00:00:00.0000000Z","createUser":"String","createUserId":"String","createUserEmail":"String","modified":"0001-01-01T00:00:00.0000000Z","modifyUser":"String","modifyUserId":"String","isDeleted":false,"deleted":"0001-01-01T00:00:00.0000000Z","deleteUser":"String","deleteUserId":"String","sendNotifications":false,"isRunning":false,"needsAttention":false}