Service and optionally equipment belonging to the service can be imported into ServiceView using the following API:
http://<serviceview_url>/put_service.php?data=<data>&create_groups=&secret=<secret>
<data> | JSON encoded string containing service and equipment details. See below for details |
<create_groups> | Create serice groups if they dont already exist:
|
<secret> | The value of the SECRET option set in the options setup section. |
The data parameter is a JSON encoded string of a nulti-dimentional array containing service details and optionally equipment details for each service
$data = array( array("service_id"=>"", "service_name"=>"Service 1", "service_group_name"=>"", "service_group_id"=>"", "description"=>"", "catalogue_fg"=>"", "budget_owner"=>"", "business_owner"=>"", "technical_owner"=>"", "service_code"=>"", "supported_hours"=>"", "public_fg"=>"", "equipment" => array( array("hardware_id"=>"", "hardware_name"=>"equipment 1", "service_id"=>"", "manufacturer"=>"", "model"=>"", "virtual_fg"=>"V", "leased_fg"=>"N", "purchase_date"=>"", "end_of_lease_date"=>"", "end_of_maintenance_date"=>"", "server_use"=>"", "operating_system"=>"", "serial_number"=>"", "asset_tag"=>"", "contract_id"=>"", "rack_units"=>"", "datacentre_id"=>"", "rack_id"=>"", "rack_position"=>"", "building_id"=>"", "floor"=>"", "room"=>"" ), array("hardware_id"=>"", "hardware_name"=>"equipment 2", "service_id"=>"", "manufacturer"=>"", "model"=>"", "virtual_fg"=>"P", "leased_fg"=>"Y", "purchase_date"=>"", "end_of_lease_date"=>"", "end_of_maintenance_date"=>"", "server_use"=>"", "operating_system"=>"", "serial_number"=>"", "asset_tag"=>"", "contract_id"=>"", "rack_units"=>"", "datacentre_id"=>"", "rack_id"=>"", "rack_position"=>"", "building_id"=>"", "floor"=>"", "room"=>"" ) ) ), array( "service_id"=>"", "service_name"=>"Service 2", "description"=>"", "catalogue_fg"=>"", "budget_owner"=>"", "business_owner"=>"", "technical_owner"=>"", "service_code"=>"", "supported_hours"=>"", "public_fg"=>"", ) )
SUCCESS or FAILURE
The best way to get the data structure is to call the API which queries ServiceView and returns the same JSON encoded multi-dimentional array.
Service and equipment belonging to the service can be exported from ServiceView using the following API:
http://<serviceview_url>/get_services.php?service_code=<service_code>&full=<full>&equipment=<equipment>&dependencies=<dependencies>&property_code=<property_code>secret=<secret>
<service_code> | Restrict export to this service. |
<full> | Set to 1 to return all fields, otherwise a subset of fields is returned. |
<equipment> | Set to 1 to include equipment with the service. |
<dependences> | Set to 1 to include dependences with the service. |
<property_code> | Set to the name of a service property to only return services with this property set. |
<secret> | The value of the SECRET. |
JSON encoded multi-dimentional array containing service details and optionally equipment details for each service matching the search criteria containing the following fields:
$data = array( array("service_id"=>"", "service_name"=>"Service 1", "service_group_name"=>"", "service_group_id"=>"", "description"=>"", "catalogue_fg"=>"", "budget_owner"=>"", "business_owner"=>"", "technical_owner"=>"", "service_code"=>"", "supported_hours"=>"", "public_fg"=>"", "equipment" => array( array("hardware_id"=>"", "hardware_name"=>"equipment 1", "service_id"=>"", "manufacturer"=>"", "model"=>"", "virtual_fg"=>"V", "leased_fg"=>"N", "purchase_date"=>"", "end_of_lease_date"=>"", "end_of_maintenance_date"=>"", "server_use"=>"", "operating_system"=>"", "serial_number"=>"", "asset_tag"=>"", "contract_id"=>"", "rack_units"=>"", "datacentre_id"=>"", "rack_id"=>"", "rack_position"=>"", "building_id"=>"", "floor"=>"", "room"=>"" ), array("hardware_id"=>"", "hardware_name"=>"equipment 2", "service_id"=>"", "manufacturer"=>"", "model"=>"", "virtual_fg"=>"P", "leased_fg"=>"Y", "purchase_date"=>"", "end_of_lease_date"=>"", "end_of_maintenance_date"=>"", "server_use"=>"", "operating_system"=>"", "serial_number"=>"", "asset_tag"=>"", "contract_id"=>"", "rack_units"=>"", "datacentre_id"=>"", "rack_id"=>"", "rack_position"=>"", "building_id"=>"", "floor"=>"", "room"=>"" ) ) ), array( "service_id"=>"", "service_name"=>"Service 2", "description"=>"", "catalogue_fg"=>"", "budget_owner"=>"", "business_owner"=>"", "technical_owner"=>"", "service_code"=>"", "supported_hours"=>"", "public_fg"=>"", ) )
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.
See also
Broken Link: APIImportServicesAndEquipment
Sample Powershell Code
Import equipment and optionally assign it to a service using the following API:
http://<serviceview_url>/equipment.php?service=<servicecode>&start=<start>&end=<end>&title=<title>&description=<description>&service_availability=<service_availability>&event_group_name=<event_group_name>&secret=<secret>
<servicecode> | The unique code associated with each service entered from the add or edit service dialog. |
<start>> | Date and time the event started format YYYY-MM-DD. |
<end> | Date and time the event ended format YYYY-MM-DD. |
<description>> | TheThe event description. |
<service_availability> | Service availability code, possible values are:
|
<event_group_name> | The name of the event group this event falls into as seen in the event group setup. See section on setting up event groups. |
<secret> | The value of the SECRET option set in the options setup section. |
SUCCESS or FAILURE
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.
<php $fields = "secret=<secret>&service=<servicecode>&start=2013-01-01+10:00:00&end=2013-01-01+10:00:00&title=<title>&description=<description>&service_availability=3&event_group_name=For+Information"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,"http://<serviceview_url>/event.php"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $fields); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec ($ch); curl_close ($ch);
<php $fields = "secret=<secret>&service=<servicecode>&start=2013-01-01+10:00:00&end=2013-01-01+10:00:00&title=<title>&description=<description>&service_availability=3&event_group_name=For+Information"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,"https://<serviceview_url>php/event.php"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_PORT , 443); curl_setopt($ch, CURLOPT_POSTFIELDS, $fields); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); $response = curl_exec ($ch); curl_close ($ch);
Documents stored as service properties can be exported using the following API:
http://<serviceview_url>/get_document.php?service_code=<service_code>&property_code=<property_code>&secret=<secret>
<service_code> | Service code referencing service containing the document. Optionally service_id can be used instead. |
<property_code>> | Set to the name of a service property to only return services with this property set. |
<return> | By default the API returns a summary of the document containing the type, filename size and modified date. Specifying return=base64encoded will return a JSON encoded array containg the summary information as well as the base64 encoded document. Setting return=binary will only return the document content. |
<secret> | The value of the SECRET option set in the options setup section. |
The return value depends on the return parameter:
Blank or summary | Summary infomration about the document JSON encoded containing the filename, the type, size and modified date and time |
base64encoded | Returns a JSON encoded object containing the summary information as well as a base64 encoded verson of the document |
binary | Just returns the binary document |
The HTTP request can either be sent using a HTTP GET or POST request.
Sample Powershell Code
Documents stored as service properties can be updated using the following API:
http://<serviceview_url>/put_document.php?service_code=<service_code>&property_code=<property_code>&filename=<filename>&content_type=<content_type>&file=<file>&secret=<secret>
service_code | Service code referencing service containing the document. Optionally service_id can be used instead. |
property_code | Set to the name of a service property to only return services with this property set. |
filename | Document name including extension. |
content_type | Type of document, typically: application/vnd.visio, application/vnd.ms-visio.viewer, application/vnd.ms-excel, application/pdf. See http://help.dottoro.com/lapuadlp.php for full list |
file | The document body. |
secret | The value of the SECRET option set in the options setup section. |
JSON encoded digest of upload, or FAILURE: Message
TO create a new metric using an API use:
http://<serviceview_url>/make_service_metric.php?metric=<metric_name>&description=<description>&units=<units>&service=<services>&secret=<secret>
<metric> | name for new metric. Note only letters, numbers and underscore, no spaces. |
<description> | Description of metric |
<units> | Units, i.e. logins per day |
<service> | Code for service to tie this metric to. See service codes. |
<secret> | The value of the SECRET. |
SUCCESS or FAILURE
Service and equipment belonging to the service can be exported from ServiceView using the following API:
http://<serviceview_url>/get_services.php?service_code=<service_code>&full=<full>&equipment=<equipment>&dependencies=<dependencies>&property_code=<property_code>secret=<secret>
<service_code> | Restrict export to this service |
<full>> | Set to 1 to return all fields, otherwise a subset of fields is returned |
<equipment> | Set to 1 to include equipment with the service |
<dependences> | Set to 1 to include dependences with the service |
<property_code>> | Set to the name of a service property to only return services with this property set. |
<secret> | The value of the SECRET option set in the options setup section. |
JSON encoded nulti-dimentional array containing service details and optionally equipment details for each service matching the search criteria containing the following fields:
$data = array( array("service_id"=>"", "service_name"=>"Service 1", "service_group_name"=>"", "service_group_id"=>"", "description"=>"", "catalogue_fg"=>"", "budget_owner"=>"", "business_owner"=>"", "technical_owner"=>"", "service_code"=>"", "supported_hours"=>"", "public_fg"=>"", "equipment" => array( array("hardware_id"=>"", "hardware_name"=>"equipment 1", "service_id"=>"", "manufacturer"=>"", "model"=>"", "virtual_fg"=>"V", "leased_fg"=>"N", "purchase_date"=>"", "end_of_lease_date"=>"", "end_of_maintenance_date"=>"", "server_use"=>"", "operating_system"=>"", "serial_number"=>"", "asset_tag"=>"", "contract_id"=>"", "rack_units"=>"", "datacentre_id"=>"", "rack_id"=>"", "rack_position"=>"", "building_id"=>"", "floor"=>"", "room"=>"" ), array("hardware_id"=>"", "hardware_name"=>"equipment 2", "service_id"=>"", "manufacturer"=>"", "model"=>"", "virtual_fg"=>"P", "leased_fg"=>"Y", "purchase_date"=>"", "end_of_lease_date"=>"", "end_of_maintenance_date"=>"", "server_use"=>"", "operating_system"=>"", "serial_number"=>"", "asset_tag"=>"", "contract_id"=>"", "rack_units"=>"", "datacentre_id"=>"", "rack_id"=>"", "rack_position"=>"", "building_id"=>"", "floor"=>"", "room"=>"" ) ) ), array( "service_id"=>"", "service_name"=>"Service 2", "description"=>"", "catalogue_fg"=>"", "budget_owner"=>"", "business_owner"=>"", "technical_owner"=>"", "service_code"=>"", "supported_hours"=>"", "public_fg"=>"", ) )
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.
See also
Broken Link: APIImportServicesAndEquipment
Sample Powershell Code