Create scheduledtask via POST to API



  • Hello,

    Can anyone provide the data required in the post to create a CRON-style scheduled task?

    From https://news.fogproject.org/simplified-api-documentation, it looks like the URL is “/fog/<object>/create” but I don’t know what information to pass with it.

    e.g. I know I need these:
    “minute”: “30”,
    “hour”: “5”,
    “dayOfMonth”: “",
    “month”: "
    ”,
    “dayOfWeek”: “*”,

    What else?

    Thank you!

    Jesse


  • Senior Developer

    @nehsa said in Create scheduledtask via POST to API:

    “minute”: “30”,
    “hour”: “5”,
    “dayOfMonth”: “",
    “month”: "”,
    “dayOfWeek”: “*”,

    This all depends on the type of task this is to do:

    The json elements that you can set:

    {
        "name": 'Some Name',  // Optional
        "description": 'Some Description', // Optional
        "type": "C", // C = Cron, S = Single
        "taskType": 1, // ID of the task type, 1 = deploy, 2 = capture, 3 = debug do not use this one, 4 = memtest, 5 = test disk, 6 = disk surface test, 7 = recover, 8 = multicast, 10 = inventory, 11 = password reset, 12 = all snapins, 13 = single snapin, 14 = wake up, 15 = debug deploy, 16 = debug capture, 17 = deploy no snapins, 18 = fast wipe, 19 = normal wipe, 20 = full wipe
        "minute": 30,
        "hour": 5,
        "dayOfMonth": '*',
        "month": '*',
        "dayOfWeek": '*',
        "isGroupTask": 0, // 0 = host only, 1 = group task
        "hostID": 1, // If is grouptask is 1 this will be the group id, otherwise the relevant hostID
        "shutdown": 0, // 0 = restart, 1 = shutdown
        "other1": "",
        "other2": "-1", // Snapins either the id of the individual snapin, or -1 for all.
        "other3": "fog", // The username who created the task
        "other4": true, // Wake On Lan?
        "other5": "",
        "scheduleTime": "", // Only used for delayed time in which case you will need a valid unix timestamp in the future.
        "isActive": 1, // 0 or false would mean the task is not active currently.
        "imageID": 1 // The image ID in the case it's an imaging task. Can be any imageID you want.
    }
    

  • Moderator


Log in to reply
 

305
Online

7.4k
Users

14.5k
Topics

136.6k
Posts