Example: Scheduling an Event
Scheduling an event via API requires multiple calls:
- Get ID value of source.
- Create a session.
- Add source to session.
- Create event for the session.
Each step is described below.
Step 1: Get ID Value of Source
Assuming sources already exist, get the list of sources to obtain the source ID value to add to the session. (See Get the Source List for details.)
GET https://192.168.0.168/apis/sources |
The server returns a list of all sources. Find the source you wish to schedule, and note its id value:
... |
Step 2: Create a Session
Create a session by issuing a POST /api/sessions request. (See Create a Session for details.)
POST https://192.168.0.168/apis/sessions |
The server returns the following. Note the session ID value for use in the next section.
{ |
The new session also appears in the web interface:
Step 3: Add Source to Session
Add the selected source to the new session by issuing a POST /apis/sessions/:sessionId/sources request, using the corresponding IDs you noted in the previous two steps (See Add a Session Source for details.)
POST https://192.168.0.168/apis/sessions/ccf00271-adda-42b4-895f-bb54338fb932/sources
{ |
The server's response confirms the source was added to the session:
{ |
Step 4: Create Event for the Session
Finally, create the event using the POST /apis/sessions/:sessionId/events request. Use the session ID in the endpoint. (See Create a Session Event for details.)
POST https://192.168.0.168/apis/sessions/ccf00271-adda-42b4-895f-bb54338fb932/events |
The response confirms the scheduled event:
{ |
And the web interface's Scheduler page is updated with the recurring event: