Import Calender Events

Import Events

API: Import Calendar Events

Calendar events can be injected into the ServiceView database using an HTTP POST:

http://<serviceview_url>/put_event.php?service_code=<service_code>service_id=<service_id>&start=<start>&end=<end>&title=<title>&description=<description>&service_availability=<service_availability>&event_group_id=<event_group_id>&event_status_id=<event_status_id>&secret=<secret>

Parameters

<service_code>The unique code associated with each service entered from the add or edit service dialog.
<service_id>The ServiceView service_id for this service. Either specify servie_code or service_id.
<start>>Date and time the event started format YYYY-MM-DD HH:MM:SS
<end>Date and time the event ended format YYYY-MM-DD HH:MM:SS
<title>The event title.
<description>>The event description.
<service_availability>Service availability code, possible values are:
  • 1 - Service not available
  • 2 - Service reduced or impaired
  • 3 - No impact on the service.
<event_group_id>Possible values are:
  • 2 - Unscheduled
  • 4 - Scheduled
  • 9 - For information.
<event_status_id>Possible values are:
  • 1 - Active
  • 2 - Resolved
<secret>The value of the SECRET option set in the options setup section.

Returns

SUCCESS or FAILURE

Comments

The HTTP request can either be sent using a HTTP GET or POST request. Given the description section may be long a HTTP POST is recommended.

Sample Powershell 2 Code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#
#
# PowerShell 2
#
# Send service and equipment data to ServiceView
#
 
 
#
# URL to connect to ServiceView
#
$serviceview_api = "http://<serviceview_url>/put_event.php"
 
 
#
# The value of the SECRET option set in the options setup section.
#
$serviceview_secret = "<SECRET>"
 
#
# Build the connect URL
#
$url = "$($serviceview_api)?secret=$($serviceview_secret)"
 
#
# Load the JSON encoder/decoder
#
[System.Reflection.Assembly]::LoadWithPartialName("System.Web.Extensions")
$ser = New-Object System.Web.Script.Serialization.JavaScriptSerializer
 
#
# Create Web Client
#
$wc = New-Object Net.WebClient
 
#
# Setup the POST values
#
 
$nvc = new-object System.Collections.Specialized.NameValueCollection
$nvc.Add('service_code','Blackboard')
$nvc.Add('start','2013-12-03 12:00:00')
$nvc.Add('end','2013-12-03 13:30:00')
$nvc.Add('title','Blackboard Servers Upgrade2')
$nvc.Add('description','Blackboard Servers will be upgraded today')
$nvc.Add('service_availability','1') # 1 = Not available, 2 = Some impact, 3 = No impact
$nvc.Add('event_group_id','4') # 2 = Unscheduled, 4 = Scheduled, 9 = For Information
$nvc.Add('public_fg','yes')
$nvc.Add('event_status_id','1') # 1 = Active, 2 = Resolved
 
#
# Create a web client object
#
 
$wc = new-object net.webclient
 
#
# Pass in URL and POST data
#
$webpage = $wc.UploadValues($url, $nvc)
 
#
# See what came back
#
$ret = [System.Text.Encoding]::ASCII.GetString($webpage)
echo $ret
Download Code

.