The service end point for most of the calls is defined as follows:

All the Methods are defined by a UriTemplate that are relative to:

http://computerName:port/BbsbService

 

    public interface IBbsbService
    {
        /// <summary>
        /// Retrieves an array of all the controllable items within the service
        /// </summary>
        /// <returns></returns>
        UriTemplate = "/allitems"
        ControllableItem[] GetAllItems();

        /// <summary>
        /// Gets a specific item from the service based on its Id
        /// </summary>
        /// <param name="id">The Identifier of the item</param>
        /// <returns></returns>
        UriTemplate = "/item?id={id}"
        ControllableItem GetItem(Guid id);

        /// <summary>
        /// Gets basic information on all the Groups that are of a specific type
        /// </summary>
        /// <param name="filter"></param>
        /// <returns></returns>
        UriTemplate = "/groups?filter={filter}"
        BaseItem[] GetGroups(GroupType filter);

        /// <summary>
        /// Gets full information on all the Groups that are of a specific type
        /// </summary>
        /// <param name="filter"></param>
        /// <returns></returns>
        UriTemplate = "/detailedgroups?filter={filter}"
        Group[] GetDetailedGroups(GroupType filter);

        /// <summary>
        /// Gets a specific Group based on its Identifier
        /// </summary>
        /// <param name="id">The unique identifier of the group</param>
        /// <returns></returns>
        UriTemplate = "/group?id={id}"
        Group GetGroup(Guid id);

        /// <summary>
        /// Gets a specific Task based on its Id, this is one of OneOffTask, RecurringTask or ScheduledTask
        /// </summary>
        /// <param name="id">The unique identifier of the Task</param>
        /// <returns></returns>
        UriTemplate = "/task?id={id}"
        BaseTask GetTask(Guid id);

        /// <summary>
        /// Gets all the Tasks being served by the service
        /// </summary>
        /// <returns></returns>
        UriTemplate = "/tasks"
        BaseTask[] GetTasks();

        /// <summary>
        /// Sets a sleep timer to turn a device off
        /// </summary>
        /// <param name="id">The Id of the Item/Group to turn off</param>
        /// <param name="delay">The amount of minutes to delay</param>
        UriTemplate = "/sleep?id={id}&delay={delay}"
        void Sleep(Guid id, int delay);

        /// <summary>
        /// Sends a power command to a device
        /// </summary>
        /// <param name="id">The Id of the Item/Group to turn off</param>
        /// <param name="option">The option of call (on or off)</param>
        /// <returns>True for success, false otherwise</returns>
        UriTemplate = "/power?id={id}&com={option}"
        bool SendPower(Guid id, PowerOption option);

        /// <summary>
        /// Sends an On command to a specific device/group
        /// </summary>
        /// <param name="id">The Id of the Item/Group</param>
        /// <returns>True for success, false otherwise</returns>
        UriTemplate = "/poweron?id={id}"
        bool PowerOn(Guid id);

        /// <summary>
        /// Sends the Off command to a specific device/group
        /// </summary>
        /// <param name="id">The Id of the Item/Group</param>
        /// <returns>True for success, false otherwise</returns>
        UriTemplate = "/poweroff?id={id}"
        bool PowerOff(Guid id);

        /// <summary>
        /// Toggles the power of an item (if it is unknown it tries to turn it on by default)
        /// </summary>
        /// <param name="id">The Id of the Item</param>
        /// <returns>The new state of the Item</returns>
        UriTemplate = "/toggle?id={id}"
        PowerState Toggle(Guid id);

        /// <summary>
        /// Saves an Item to the service (this can be to update or add an item)
        /// </summary>
        /// <param name="item">The item to save</param>
        [WebInvoke(Method = "INSERT", UriTemplate = "/item", RequestFormat = WebMessageFormat.Json)]
        void SaveItem(ControllableItem item);

        /// <summary>
        /// Saves a Group to the service (this can be to update or add a group)
        /// </summary>
        /// <param name="group">The Group to save</param>
        [WebInvoke(Method = "INSERT", UriTemplate = "/group", RequestFormat = WebMessageFormat.Json)]
        void SaveGroup(Group group);

        /// <summary>
        /// Saves a Task to the service (this can be to update or add a task)
        /// </summary>
        /// <param name="task">The task to save</param>
        [WebInvoke(Method = "INSERT", UriTemplate = "/task", RequestFormat = WebMessageFormat.Json)]
        void SaveTask(BaseTask task);

        /// <summary>
        /// Removes an item from the service
        /// </summary>
        /// <param name="item">The item to be removed</param>
        [WebInvoke(Method = "DELETE", UriTemplate = "/item", RequestFormat = WebMessageFormat.Json)]
        void RemoveItem(ControllableItem item);

        /// <summary>
        /// Removes a Group from the service
        /// </summary>
        /// <param name="group">The group to be removed</param>
        [WebInvoke(Method = "DELETE", UriTemplate = "/group", RequestFormat = WebMessageFormat.Json)]
        void RemoveGroup(Group group);

        /// <summary>
        /// Removes a Task from the service
        /// </summary>
        /// <param name="task"></param>
        [WebInvoke(Method = "DELETE", UriTemplate = "/task", RequestFormat = WebMessageFormat.Json)]
        void RemoveTask(BaseTask task);
    }

Last edited Sep 4, 2010 at 2:04 PM by evorgevol, version 1

Comments

No comments yet.