messageSet method

Future<Map<String, dynamic>> messageSet(
  1. String id,
  2. Map postBody
)
inherited

messageSet -> /v1/message/{id}

Sets the details of the specified message. The UUID and index in the request body are ignored. They are not updated.

PARAMETERS

id (required) : The ID of the message, either UUID, name, or index.

  • Example (by_uuid): 3C39C433-5C18-4F51-B357-55BB870227C4
  • Example (by_name): Mask
  • Example (by_index): 3

postBody (required) : This is the data that must be sent with this request.

Example:

{
  "id": {
    "name": "Test Message",
    "uuid": "942C3FC3-C4B2-44F7-A55D-4CC913BB8A5D",
    "index": 0
  },
  "message": "Text {text}, Clock {System Clock}, Countdown {Timer 1}, Countdown to time {Timer 2}, Elapsed {Timer 3}",
  "tokens": [
    {
      "name": "text",
      "text": {
        "text": "142"
      }
    },
    {
      "name": "System Clock",
      "clock": {
        "format": {
          "date": "short",
          "time": "long",
          "is_24_hours": true
        }
      }
    },
    {
      "name": "Timer 1",
      "timer": {
        "configuration": {
          "id": {
            "name": "Timer 1",
            "uuid": "43b4c5c6-145a-4b19-9968-7b78e6980e82",
            "index": 0
          },
          "allows_overrun": true,
          "countdown": {
            "duration": 300
          }
        },
        "format": {
          "hour": "remove_long",
          "minute": "remove_long",
          "second": "short",
          "millisecond": "none"
        }
      }
    },
    {
      "name": "Timer 2",
      "timer": {
        "configuration": {
          "id": {
            "name": "Timer 2",
            "uuid": "1355b458-5f99-4e6e-8ac7-8522061f6bdb",
            "index": 0
          },
          "allows_overrun": true,
          "count_down_to_time": {
            "time_of_day": "09:30",
            "period": "am"
          }
        },
        "format": {
          "hour": "remove_long",
          "minute": "remove_long",
          "second": "short",
          "millisecond": "none"
        }
      }
    },
    {
      "name": "Timer 3",
      "timer": {
        "configuration": {
          "id": {
            "name": "Timer 3",
            "uuid": "8efe5ec8-daf4-4609-aea2-7c80efa7f6fa",
            "index": 0
          },
          "allows_overrun": true,
          "elapsed": {
            "start_time": 0
          }
        },
        "format": {
          "hour": "remove_long",
          "minute": "remove_long",
          "second": "short",
          "millisecond": "none"
        }
      }
    }
  ],
  "theme": {
    "name": "Default",
    "uuid": "f5468354-01fb-44d8-b7b3-5ede94c6115c",
    "index": 0
  }
}

Example (text_token):

{
  "id": {
    "name": "Message with text token",
    "uuid": "",
    "index": 0
  },
  "message": "Please come to room {room}",
  "tokens": [
    {
      "name": "room",
      "text": {
        "text": "142"
      }
    }
  ],
  "theme": {
    "name": "",
    "uuid": "",
    "index": 0
  }
}

Example (clock_token):

{
  "id": {
    "name": "Message with clock token",
    "uuid": "",
    "index": 0
  },
  "message": "The current time is {time}",
  "tokens": [
    {
      "name": "time",
      "clock": {
        "format": {
          "date": "short",
          "time": "long",
          "is_24_hours": true
        }
      }
    }
  ],
  "theme": {
    "name": "",
    "uuid": "",
    "index": 0
  }
}

Example (timer_token_countdown):

{
  "id": {
    "name": "Message with countdown timer token",
    "uuid": "",
    "index": 0
  },
  "message": "Time until start: {Timer Token}",
  "tokens": [
    {
      "name": "Timer Token",
      "timer": {
        "id": {
          "name": "Countdown Timer",
          "uuid": "942C3FC3-C4B2-44F7-A55D-4CC913BB8A5D",
          "index": 1
        },
        "allows_overrun": true,
        "format": {
          "hour": "remove_long",
          "minute": "remove_long",
          "second": "short",
          "millisecond": "none"
        },
        "countdown": {
          "duration": 300
        }
      }
    }
  ],
  "theme": {
    "name": "",
    "uuid": "",
    "index": 0
  }
}

Example (timer_token_countdown_to_time):

{
  "id": {
    "name": "Message with countdown to time timer token",
    "uuid": "",
    "index": 0
  },
  "message": "Time until start: {Timer Token}",
  "tokens": [
    {
      "name": "Timer Token",
      "timer": {
        "id": {
          "name": "Count Down to Time Timer",
          "uuid": "942C3FC3-C4B2-44F7-A55D-4CC913BB8A5D",
          "index": 1
        },
        "allows_overrun": true,
        "format": {
          "hour": "remove_long",
          "minute": "remove_long",
          "second": "short",
          "millisecond": "none"
        },
        "count_down_to_time": {
          "time_of_day": 3600,
          "period": "pm"
        }
      }
    }
  ],
  "theme": {
    "name": "",
    "uuid": "",
    "index": 0
  }
}

Example (timer_token_elapsed):

{
  "id": {
    "name": "Message with elapsed timer token",
    "uuid": "",
    "index": 0
  },
  "message": "Time since start: {Timer Token}",
  "tokens": [
    {
      "name": "Timer Token",
      "timer": {
        "id": {
          "name": "Elapsed Timer",
          "uuid": "942C3FC3-C4B2-44F7-A55D-4CC913BB8A5D",
          "index": 1
        },
        "allows_overrun": true,
        "format": {
          "hour": "remove_long",
          "minute": "remove_long",
          "second": "short",
          "millisecond": "none"
        },
        "elapsed": {
          "start_time": 0,
          "end_time": 60
        }
      }
    }
  ],
  "theme": {
    "name": "",
    "uuid": "",
    "index": 0
  }
}

RESPONSE 200:

The request was processed successfully.

content-type: application/json

schema:

{
  "type": "object",
  "required": [
    "id",
    "message",
    "theme"
  ],
  "example": {
    "id": {
      "name": "Test Message",
      "uuid": "942C3FC3-C4B2-44F7-A55D-4CC913BB8A5D",
      "index": 0
    },
    "message": "Text {text}, Clock {System Clock}, Countdown {Timer 1}, Countdown to time {Timer 2}, Elapsed {Timer 3}",
    "tokens": [
      {
        "name": "text",
        "text": {
          "text": "142"
        }
      },
      {
        "name": "System Clock",
        "clock": {
          "format": {
            "date": "short",
            "time": "long",
            "is_24_hours": true
          }
        }
      },
      {
        "name": "Timer 1",
        "timer": {
          "configuration": {
            "id": {
              "name": "Timer 1",
              "uuid": "43b4c5c6-145a-4b19-9968-7b78e6980e82",
              "index": 0
            },
            "allows_overrun": true,
            "countdown": {
              "duration": 300
            }
          },
          "format": {
            "hour": "remove_long",
            "minute": "remove_long",
            "second": "short",
            "millisecond": "none"
          }
        }
      },
      {
        "name": "Timer 2",
        "timer": {
          "configuration": {
            "id": {
              "name": "Timer 2",
              "uuid": "1355b458-5f99-4e6e-8ac7-8522061f6bdb",
              "index": 0
            },
            "allows_overrun": true,
            "count_down_to_time": {
              "time_of_day": "09:30",
              "period": "am"
            }
          },
          "format": {
            "hour": "remove_long",
            "minute": "remove_long",
            "second": "short",
            "millisecond": "none"
          }
        }
      },
      {
        "name": "Timer 3",
        "timer": {
          "configuration": {
            "id": {
              "name": "Timer 3",
              "uuid": "8efe5ec8-daf4-4609-aea2-7c80efa7f6fa",
              "index": 0
            },
            "allows_overrun": true,
            "elapsed": {
              "start_time": 0
            }
          },
          "format": {
            "hour": "remove_long",
            "minute": "remove_long",
            "second": "short",
            "millisecond": "none"
          }
        }
      }
    ],
    "theme": {
      "name": "Default",
      "uuid": "f5468354-01fb-44d8-b7b3-5ede94c6115c",
      "index": 0
    }
  }
}

RESPONSE 400:

The request was not valid.

content-type: ``

Implementation

Future<Map<String, dynamic>> messageSet(String id, Map postBody) async {
  String url = '/v1/message/$id';

  return await call('put', url, httpAccept: 'application/json');
}