Start Time Filter
The start time filter is, currently, used in the Get-NinjaOneBackupJobs commandlet (which maps to the /v2/backup/jobs
endpoint if not using the module) and is used to filter the jobs returned based on the time the job started. It supports two modes of operations and five status values.
Between start times mode
This retrieves jobs that started between the two datetime values specified. The values are inclusive.
Get-NinjaOneBackupJobs -startTimeBetween @((Get-Date).AddDays(-1), (Get-Date))
This will retrieve all jobs that started between 24 hours ago and now. The startTimeBetween
parameter takes an array of two DateTime
objects. Under the hood, this is converted to a string in the format yyyy-MM-ddTHH:mm:ss.fffZ
and passed to the API as the following query string parameter:
https://eu.ninjaone.com/v2/backup/jobs?stf=startTime between (2021-08-01T00%3a00%3a00.000Z%2c2021-08-02T00%3a00%3a00.000Z)
The API expects the time to be in UTC. The module will convert the time to UTC before passing it to the API. So you don't need to worry about time zones unless using the raw stf
parameter.
After start time mode
This retrieves jobs that started after the datetime value specified.
Get-NinjaOneBackupJobs -startTimeAfter (Get-Date).AddDays(-1)
This will retrieve all jobs that started after 24 hours ago. The startTimeAfter
parameter takes a DateTime
object. Under the hood, this is converted to a string in the format yyyy-MM-ddTHH:mm:ss.fffZ
and passed to the API as the following query string parameter:
https://eu.ninjaone.com/v2/backup/jobs?stf=startTime after 2021-08-01T00%3a00%3a00.000Z
The API expects the time to be in UTC. The module will convert the time to UTC before passing it to the API. So you don't need to worry about time zones unless using the raw stf
parameter.
Start time values
The start time filter accepts datetime values in ISO 8601 format. The module will convert the datetime value to UTC before passing it to the API.
Passing a start time filter directly
Instead of using the -startTimeBetween
or -startTimeAfter
parameters you can use -stf
and pass the filter string directly - don't HTML encode the characters though - the module will handle it. For example:
Get-NinjaOneBackupJobs -stf "startTime between (2021-08-01T00:00:00.000Z,2021-08-02T00:00:00.000Z)"