Share

Import & Export Services & Equipment

Import Services & EquipmentExport Services & EquipmentEquipmentExport DocumentsImport DocumentsCreate Service MetricExport Services & Equipment

API: Import Services & Equipment

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>

Parameters

<data>JSON encoded string containing service and equipment details. See below for details
<create_groups>Create serice groups if they dont already exist:
  • 0 or blank - Do not create groups, so reject service with unknown service groups.
  • 1 - Create groups automatically
<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"=>"",
        )
)

Returns

SUCCESS or FAILURE

Comments

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.

Sample Powershell Code

Download Code

API: Export Services & Equipment


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>

Parameters

<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.

Returns

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"=>"",
        )
)

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.

See also

Broken Link: APIImportServicesAndEquipment

Sample Powershell Code

Download Code

API: Import Equipment

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>

Parameters

<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:
  • 1 - Service was not available
  • 2 - Service was reduced or impaired
  • 3 - No impact on the service.
<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.

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 PHP Code

<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);

Sample PHP Code using SSL on port 443

<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);

API: Export Documents

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>

Parameters

<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.

Returns

The return value depends on the return parameter:

Blank or summarySummary infomration about the document JSON encoded containing the filename, the type, size and modified date and time
base64encodedReturns a JSON encoded object containing the summary information as well as a base64 encoded verson of the document
binaryJust returns the binary document

Comments

The HTTP request can either be sent using a HTTP GET or POST request.

Sample Powershell Code

Download Code

API: Import Documents

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>

Parameters

service_codeService code referencing service containing the document. Optionally service_id can be used instead.
property_codeSet to the name of a service property to only return services with this property set.
filenameDocument name including extension.
content_typeType 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
fileThe document body.
secretThe value of the SECRET option set in the options setup section.

Returns

JSON encoded digest of upload, or FAILURE: Message

Sample Powershell Code

Download Code

Sample PHP Code

Download Code



API: Create Service Metric


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>

Parameters

<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.

Returns

SUCCESS or FAILURE

API: Export Services & Equipment

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>

Parameters

<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.

Returns

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"=>"",
        )
)

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.

See also

Broken Link: APIImportServicesAndEquipment

Sample Powershell Code

Download Code