Cisco Unity Connection Provisioning Interface (CUPI) API -- Schedule Example

From DocWiki

Revision as of 00:05, 14 December 2010 by Gscorbin (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Links to Other API pages: Cisco_Unity_Connection_APIs

CUPI Guide Contents
API Overview
Index of All CUPI Documentation
Schedule Example

Contents


Schedules in Unity Connection are composed of several objects. As an example, let's model a weekday schedule with the lunch hour blocked out as unavailable every work day, and with various holidays blocked out as well. Using the objects discussed on the CUPI Schedules page, this schedule might be composed like so:

  • First, we create a top-level ScheduleSet called WeekdaySet. WeekdaySet includes the WeekdaySchedule and excludes the HolidaySchedule (2 Schedule objects).
  • After we create these 2 Schedule objects, we create 2 ScheduleSetMemberMap objects for WeekdaySet - one to include WeekdaySchedule and one to exclude HolidaySchedule.
  • Then, we create 2 ScheduleDetail objects for WeekdaySchedule - one active from 8AM to 12PM Mon-Fri, and the other active from 1PM to 5PM Mon-Fri.
  • Finally, we create various ScheduleDetails objects for HolidaySchedule, one per holiday. For example, we might create a July4ScheduleDetail with start and end dates both set to July 4 2010, and a WinterBreakScheduleDetail with a start date of Dec 23 2010 and an end date of Jan 3 2011.

In this example, we will assume that the Owner for the ScheduleSet and Schedules is the Unity Connection Location, which can be retrieved by making a GET to +/vmrest/locations/connectionlocations+ and then a look-up of the ObjectId field.


Create the ScheduleSet "WeekdaySet"

To create the top-level ScheduleSet called "WeekdaySet", an administrator makes a POST to the schedulesets resource like this:

POST /vmrest/schedulesets

<ScheduleSet>
  <DisplayName>WeekdaySet</DisplayName>
  <OwnerLocationObjectId>6a56503e-c1c8-406c-85fd-76be40994d39</OwnerLocationObjectId>
</ScheduleSet>

This will return the URI to the newly created "WeekdaySet" (which includes its ObjectId):

201
Created
/vmrest/user/schedulesets/7f7e1df2-df8d-4cac-9111-3fc4efc106e6


Create the Schedules "WeekdaySchedule" and "HolidaySchedule"

To create the top-level Schedules called "WeekdaySchedule" and "HolidaySchedule", an administrator makes two POSTs to the schedules resource as shown below.


Creating the "WeekdaySchedule"

POST /vmrest/schedules

<Schedule>
  <DisplayName>WeekdaySchedule</DisplayName>
  <OwnerLocationObjectId>6a56503e-c1c8-406c-85fd-76be40994d39</OwnerLocationObjectId>
  <IsHoliday>false</IsHoliday>
</Schedule>

This will return the URI to the newly created "WeekdaySchedule" (which includes its ObjectId):

201
Created
/vmrest/user/schedules/8b2fdf44-ed5e-4fe1-a5b8-7124cb199c4b


Creating the "HolidaySchedule"

POST /vmrest/schedules

<Schedule>
  <DisplayName>HolidaySchedule</DisplayName>
  <OwnerLocationObjectId>6a56503e-c1c8-406c-85fd-76be40994d39</OwnerLocationObjectId>
  <IsHoliday>true</IsHoliday>
</Schedule>

This will return the URI to the newly created "HolidaySchedule" (which includes its ObjectId):

201
Created
/vmrest/user/schedules/f0aacc32-6183-47ae-91ea-41aab0e7170c


Add "WeekdaySchedule" and "HolidaySchedule" to "WeekdaySet"

To associate the "WeekdaySchedule" and "HolidaySchedule" with the "WeekdaySet", an administrator makes two POSTs to "WeekdaySet"'s schedulesetmembers resource as shown below. Note that the ScheduleSetObjectId and ScheduleObjectIds were returned when we created those objects earlier.


Creating the ScheduleSetMember that includes "WeekdaySchedule" in "WeekdaySet"

POST /vmrest/schedulesets/7f7e1df2-df8d-4cac-9111-3fc4efc106e6/schedulesetmembers

<ScheduleSetMember>
  <ScheduleSetObjectId>7f7e1df2-df8d-4cac-9111-3fc4efc106e6</ScheduleSetObjectId>
  <ScheduleObjectId>8b2fdf44-ed5e-4fe1-a5b8-7124cb199c4b</ScheduleObjectId>
  <Exclude>false</Exclude>
</ScheduleSetMember>

This will return the URI to the newly created ScheduleSetMember (which includes its ObjectId):

201
Created
/vmrest/user/schedulesets/7f7e1df2-df8d-4cac-9111-3fc4efc106e6/schedulesetmembers/eb1f344c-90a2-4e6d-9b87-3523cf9f6838


Creating the ScheduleSetMember that excludes "HolidaySchedule" from "WeekdaySet"

POST /vmrest/schedulesets/7f7e1df2-df8d-4cac-9111-3fc4efc106e6/schedulesetmembers

<ScheduleSetMember>
  <ScheduleSetObjectId>7f7e1df2-df8d-4cac-9111-3fc4efc106e6</ScheduleSetObjectId>
  <ScheduleObjectId>f0aacc32-6183-47ae-91ea-41aab0e7170c</ScheduleObjectId>
  <Exclude>true</Exclude>
</ScheduleSetMember>

This will return the URI to the newly created ScheduleSetMember (which includes its ObjectId):

201
Created
/vmrest/user/schedulesets/7f7e1df2-df8d-4cac-9111-3fc4efc106e6/schedulesetmembers/3ba9b61f-6eb1-4e5e-bddf-1c0d321445bc


Add ScheduleDetails to "WeekdaySchedule"

To fill out the "WeekdaySchedule" for every weekday with the lunch hour blocked out, an administrator makes two POSTs to "WeekdaySchedule"'s scheduledetails resource as shown below. Note that the ScheduleObjectId in the URI was returned when we created the "WeekdaySchedule" object earlier.


Creating the "WeekdayMorning ScheduleDetail" for 8AM to 12PM

POST /vmrest/schedules/8b2fdf44-ed5e-4fe1-a5b8-7124cb199c4b/scheduledetails

<ScheduleDetail>
  <Subject>WeekdayMorning ScheduleDetail</Subject>
  <StartTime>480</StartTime>
  <EndTime>720</EndTime>
  <IsActiveMonday>true</IsActiveMonday>
  <IsActiveTuesday>true</IsActiveTuesday>
  <IsActiveWednesday>true</IsActiveWednesday>
  <IsActiveThursday>true</IsActiveThursday>
  <IsActiveFriday>true</IsActiveFriday>
</ScheduleDetail>

This will return the URI to the newly created "WeekdayMorning ScheduleDetail" (which includes its ObjectId):

201
Created
/vmrest/schedules/8b2fdf44-ed5e-4fe1-a5b8-7124cb199c4b/scheduledetails/d5d98691-770d-44ad-b267-51fe55531ff0


Creating the "WeekdayAfternoon ScheduleDetail" for 1PM to 5PM

POST /vmrest/schedules/8b2fdf44-ed5e-4fe1-a5b8-7124cb199c4b/scheduledetails

<ScheduleDetail>
  <Subject>WeekdayAfternoon ScheduleDetail</Subject>
  <StartTime>780</StartTime>
  <EndTime>1020</EndTime>
  <IsActiveMonday>true</IsActiveMonday>
  <IsActiveTuesday>true</IsActiveTuesday>
  <IsActiveWednesday>true</IsActiveWednesday>
  <IsActiveThursday>true</IsActiveThursday>
  <IsActiveFriday>true</IsActiveFriday>
</ScheduleDetail>

This will return the URI to the newly created "WeekdayAfternoon ScheduleDetail" (which includes its ObjectId):

201
Created
/vmrest/schedules/8b2fdf44-ed5e-4fe1-a5b8-7124cb199c4b/scheduledetails/09df80a7-8f46-415c-a4d9-f9b2a44ac869


Add ScheduleDetails to "HolidaySchedule"

To add July 4th and Winter Break holidays to "HolidaySchedule", an administrator makes two POSTs to "HolidaySchedule"'s scheduledetails resource as shown below. Note that the ScheduleObjectId in the URI was returned when we created the "HolidaySchedule" object earlier.


Creating the July 4th holiday

POST /vmrest/schedules/f0aacc32-6183-47ae-91ea-41aab0e7170c/scheduledetails

<ScheduleDetail>
  <Subject>July 4th ScheduleDetail</Subject>
  <StartDate>2010-07-04</StartDate>
  <EndDate>2010-07-04</EndDate>
</ScheduleDetail>

This will return the URI to the newly created "July 4th ScheduleDetail" (which includes its ObjectId):

201
Created
/vmrest/schedules/f0aacc32-6183-47ae-91ea-41aab0e7170c/scheduledetails/ce7bf677-97d5-4290-8c59-e2258ca351b6


Creating the Winter Break holiday (Dec 23 to Jan 3)

POST /vmrest/schedules/f0aacc32-6183-47ae-91ea-41aab0e7170c/scheduledetails

<ScheduleDetail>
  <Subject>Winter Break ScheduleDetail</Subject>
  <StartDate>2010-12-23</StartDate>
  <EndDate>2011-01-03</EndDate>
</ScheduleDetail>

This will return the URI to the newly created "Winter Break ScheduleDetail" (which includes its ObjectId):

201
Created
/vmrest/schedules/f0aacc32-6183-47ae-91ea-41aab0e7170c/scheduledetails/a85efd4e-cd27-4e21-a8ba-10d7ed7676d3

Rating: 0.0/5 (0 votes cast)

Personal tools