NodePing.Schedules.update

You're seeing just the function update, go back to NodePing.Schedules module for more information.
Link to this function

update(token, id, data, customerid \\ nil)

View Source

Create a schedule for your account or subaccount

Parameters

  • token - NodePing API token that is provided with account
  • id - The name or ID you want to give your schedule
  • data - Map containing schedule information
    • time1 - start of time span
    • time2 - end of time span
    • exclude - inverts the time span so it is all day except for the time between time1 and time2
    • disabled - disables notifications for this day
    • allday - enables notifications for the entire day
  • customerid - optional ID to access a subaccount

Examples

iex> token = System.fetch_env!("TOKEN")
iex> id = "My Work Schedule"
iex> data = %{
"data" => %{
  "friday" => %{"exclude" => 1, "time1" => "6:00", "time2" => "18:00"},
  "monday" => %{"disabled" => true},
  "saturday" => %{"allday" => true},
  "sunday" => %{"exclude" => 0, "time1" => "6:00", "time2" => "18:00"},
  "thursday" => %{"exclude" => 0, "time1" => "6:00", "time2" => "18:00"},
  "tuesday" => %{"exclude" => 0, "time1" => "12:00", "time2" => "18:00"},
  "wednesday" => %{"exclude" => 0, "time1" => "6:00", "time2" => "18:00"}
  }
}
iex> {:ok, result} = NodePing.Schedules.update(token, id, data)