Skip to main content

I want to create a scheduler via the following API request: 

Creates a new Scheduled Task: PUT {SCH_URL}/scheduler/rest/v2/jobs/{pageId}

I have 2 questions: 

1) Do I use {pageId} = SchedulerJobListPage or SchedulerJobManagePage, and why?

Secondly, I’m passing a request body as per the body suggested on the RESTful API Scheduler page but I’m receiving the error: 

“ERROR : READ_ONLY_ENFORCER_000 - Page ‘com.streamsets.apps.scheduler.rest.SchedulerJobManagePage’ readOnly values have been modified. 

2) Is this error due to the readOnlySignature i have generated or with one of the attributes in the request body? 

 

@dannydineen96 it should be SchedulerJobManagePage. Yes, the error is likely due to this reason. 

Please see more details @ 

 

Also, I highly recommended using the Python SDK vs the REST API for programmatically interacting with StreamSets. https://docs.streamsets.com/platform-sdk/latest/run/scheduled_tasks.html 


Hi ​@Sanjeev thanks for the reply! 

 

I've tried with both pageIds but unfortunately the error is the same. I am also limited to interacting with the API rather than using the SDK.

 

I've isolated the error to the request body as I am able to interact with the API to update and delete schedulers, just not create them.

 

I'm following the request body as detailed on the UI scheduler API page. It's possible it's due to the readOnlySignature I've created - the format seems to be "<pageId><SHA-256>:<SHA-256>". Is there any documentation on how I can create this?


@dannydineen96 your readOnlySignature looks fine assuming pageId is substituted with ‘SchedulerJobCreatePage’. The only documentation available for the REST APIs is the one available via Swaager UI.  Here’s the example payload that works for me. I retrieved it via the browser’s developer tool interface by creating a scheduler task from the UI. If I use the same payload and hit the API using a REST client, it works for me.  Again, I’ll highly encourage you to use the Python SDK vs the REST API’s

 

{

"data":{

"optimisticLockVersion":0,

"readOnlySignature":"SchedulerJobCreatePage:83eae7542a26ff3b7520c9031daed90c466a4df48b694355c91fcc3e14d6af59:b2ebba8e90ad24c85f8838bbc4d7f8edc3954983f3fd758ee6a8e386c149e02d",

"id":"fc1d1a23-16a5-493c-80b2-e2c9e06b8d5c",

"name":{

"messages"::

],

"type":"RSTRING",

"value":"FS_To_ADLS",

"scrubbed":false

},

"description":{

"messages"::

],

"type":"RSTRING",

"value":"Demo Scheduler",

"scrubbed":false

},

"owner":{

"messages"::

],

"type":"RSTRING",

"value":"1e42a76a-f21d-11eb-ae2e-e7c1354324c0@241d5ea9-f21d-11eb-a19e-07108e36db4e",

"scrubbed":false

},

"externalEntityId":{

"messages"::

],

"type":"RSTRING",

"value":"464804d7-987c-4176-b66c-1834bf3f95c9:241d5ea9-f21d-11eb-a19e-07108e36db4e",

"scrubbed":false

},

"organizationId":{

"messages"::

],

"type":"RSTRING",

"value":"241d5ea9-f21d-11eb-a19e-07108e36db4e",

"scrubbed":false

},

"type":{

"messages"::

],

"type":"RENUM",

"value":"PIPELINE_JOB",

"scrubbed":false,

"enumClass":"com.streamsets.apps.scheduler.rbean.SchedulerJobType"

},

"executionInfo":{

"@class":"com.streamsets.apps.scheduler.rbean.RPipelineJob",

"messages":"

],

"optimisticLockVersion":0,

"readOnlySignature":null,

"pipelineJobId":{

"messages"::

],

"type":"RSTRING",

"value":"464804d7-987c-4176-b66c-1834bf3f95c9:241d5ea9-f21d-11eb-a19e-07108e36db4e",

"scrubbed":false

},

"pipelineJobName":{

"messages"::

],

"type":"RSTRING",

"value":"FS_To_ADLS",

"scrubbed":false

},

"action":{

"messages"::

],

"type":"RENUM",

"value":"START",

"scrubbed":false,

"enumClass":"com.streamsets.apps.scheduler.rbean.RPipelineJob$Action"

},

"id":null

},

"executionInfoMetadata":{

"name":"executionInfo",

"typeDef":{

"type":"BEAN",

"beanClass":"com.streamsets.apps.scheduler.rbean.RPipelineJob",

"groups":o

],

"properties":<

{

"name":"pipelineJobId",

"typeDef":{

"type":"RSTRING"

},

"displayPosition":10,

"group":"",

"collapsible":true,

"permissions":null,

"className":"col s6",

"label":"Job Id",

"description":"",

"readOnly":true,

"dependencies":{

},

"required":false,

"uiMode":"link",

"defaultValue":{

"messages"::

],

"type":"RSTRING",

"value":"",

"scrubbed":false

},

"canBeEmpty":true,

"masked":false,

"verify":false,

"hidden":false,

"maxLen":0,

"selector":null,

"selectorDriven":null,

"range":null,

"uiConfig":"/sch/jobs/monitor/{link}"

},

{

"name":"pipelineJobName",

"typeDef":{

"type":"RSTRING"

},

"displayPosition":20,

"group":"",

"collapsible":true,

"permissions":null,

"className":"col s6",

"label":"Job Name",

"description":"",

"readOnly":true,

"dependencies":{

},

"required":false,

"uiMode":"default",

"defaultValue":{

"messages"::

],

"type":"RSTRING",

"value":"",

"scrubbed":false

},

"canBeEmpty":true,

"masked":false,

"verify":false,

"hidden":false,

"maxLen":0,

"selector":null,

"selectorDriven":null,

"range":null,

"uiConfig":""

},

{

"name":"action",

"typeDef":{

"type":"RENUM",

"enumClass":"com.streamsets.apps.scheduler.rbean.RPipelineJob$Action"

},

"displayPosition":30,

"group":"",

"collapsible":false,

"permissions":null,

"className":"col s6",

"label":"Action",

"description":"",

"readOnly":false,

"dependencies":{

},

"required":false,

"uiMode":"default",

"defaultValue":{

"messages"::

],

"type":"RENUM",

"value":"START",

"scrubbed":false,

"enumClass":"com.streamsets.apps.scheduler.rbean.RPipelineJob$Action"

},

"canBeEmpty":true,

"masked":false,

"verify":false,

"hidden":false,

"maxLen":0,

"selector":{

"style":"DROPDOWN",

"allowCustomValue":false,

"multiValues":false,

"propertyNames":null,

"elements":l

{

"value":"START",

"label":"START",

"userChangeable":true,

"properties":{

}

},

{

"value":"STOP",

"label":"STOP",

"userChangeable":true,

"properties":{

}

},

{

"value":"UPGRADE",

"label":"UPGRADE",

"userChangeable":true,

"properties":{

}

}

],

"type":"LIST_SELECTOR"

},

"selectorDriven":null,

"range":null,

"uiConfig":""

}

]

},

"displayPosition":60,

"group":"",

"collapsible":true,

"permissions":null,

"className":"col s6",

"label":"Pipeline Job",

"description":"",

"readOnly":false,

"dependencies":{

},

"required":false,

"uiMode":null

},

"crontabMask":{

"messages"::

],

"type":"RSTRING",

"value":"0 0 1/1 * ? *",

"scrubbed":false

},

"timeZone":{

"messages"::

],

"type":"RSTRING",

"value":"UTC",

"scrubbed":false

},

"status":{

"messages"::

],

"type":"RENUM",

"value":"RUNNING",

"scrubbed":false,

"enumClass":"com.streamsets.apps.scheduler.rbean.RSchedulerJob$Status"

},

"startTime":{

"messages"::

],

"type":"RDATETIME",

"value":1736453293931,

"scrubbed":false

},

"endTime":{

"messages"::

],

"type":"RDATETIME",

"value":null,

"scrubbed":false

},

"instanceMovePauseTime":{

"messages"::

],

"type":"RDATETIME",

"value":null,

"scrubbed":false

},

"missedTriggerHandling":{

"messages"::

],

"type":"RENUM",

"value":"RUN_ONCE",

"scrubbed":false,

"enumClass":"com.streamsets.apps.scheduler.rbean.RSchedulerJob$MissedTriggerHandling"

},

"runs":>

],

"audits":p

],

"nextExecutionTime":{

"messages"::

],

"type":"RDATETIME",

"value":null,

"scrubbed":false

}

}

}

 


Reply