You are browsing the documentation for iTop 2.0 which is not the current version.

Consider browsing to iTop 3.2 documentation

Export data - export.php

Purpose

iTop provides a generic web service to export whatever data based on an OQL query.This can be used to extract data from iTop in order to use them in a third party tool. This web service can return data in several formats:

  • HTML
  • CSV
  • XML
  • Spreadsheet (for Excel or OpenOffice)

This service can be called locally on the iTop server via the command line interface, or remotely via an HTTP request.

Usage

Command line interface

php /var/www/itop/webservices/export.php --auth_login=login--auth_pwd=password --expression=query --format=csv --fields=<list of fields separated by a comma>

Remote web access

There are several ways to access the service remotely via a web connection. Here is the syntax to use with the wget command:

wget --http-user=login --http-password=password http://itopserver/webservices/export.php?expression=query&format=csv&fields=<list of fields separated by a comma>

Arguments

Argument Description Defaut value
param_file Parameters file - see Parameters file -
auth_login User login - CLI mode only -
auth_pwd User password - CLI mode only -
expression Object Query Language Reference query Mandatory if 'query' is missing
query Identifier of a query stored in the so-called query phrasebook. See Query Phrasebook Mandatory if 'expression' is missing
format spreadsheet (recommended for integration with MS-Excel), html, xml or csv html
fields coma separated list of attributes (e.g. “name,brand,model”) ; ignored for XML output ; ignored for HTML for versions earlier than 1.2 (RC) All the attributes code of the class specified by <expression>. Those one are not localized
no_localize If set to 0, then header and values are supposed to be localized in the language of the logged in user. Set to 1 to use internal attribute codes and values (enums) 0

Output

HTML

Spreadsheet

This format is dedicated to the integration into spreadsheets. In particular, it is the recommended method to use with Excel web queries.

Refer to the article How to create an Excel report using iTop queries for more information.

XML

<?xml version="1.0" encoding="UTF-8"?>
<Set>
   <Server alias="Server" id="1">
      <name>dbserver1.demo.com</name>
      <status>production</status>
      <org_id>2</org_id>
      <importance>medium</importance>
      <contact_list>Sorry, no yet implemented</contact_list>
      <document_list>Sorry, no yet implemented</document_list>
      <solution_list>Sorry, no yet implemented</solution_list>
      <contract_list>Sorry, no yet implemented</contract_list>
      <ticket_list>Sorry, no yet implemented</ticket_list>
      <brand>HP</brand>
      <model>DL380</model>
      <serial_number></serial_number>
      <asset_ref></asset_ref>
      <nwinterface_list>Sorry, no yet implemented</nwinterface_list>
      <description></description>
      <location_id>1</location_id>
      <location_details></location_details>
      <management_ip>10.1.1.10</management_ip>
      <default_gateway>255.255.255.0</default_gateway>
      <cpu>2</cpu>
      <ram>16Gb</ram>
      <hdd>120Gb</hdd>
      <os_family>Linux</os_family>
      <os_version>Debian (Lenny)</os_version>
      <application_list>Sorry, no yet implemented</application_list>
      <patch_list>Sorry, no yet implemented</patch_list>
   </Server>
   <Server alias="Server" id="6">
      <name>webserver.demo.com</name>
      <status>production</status>
      <org_id>2</org_id>
      <importance>medium</importance>
      <contact_list>Sorry, no yet implemented</contact_list>
      <document_list>Sorry, no yet implemented</document_list>
      <solution_list>Sorry, no yet implemented</solution_list>
      <contract_list>Sorry, no yet implemented</contract_list>
      <ticket_list>Sorry, no yet implemented</ticket_list>
      <brand>IBM</brand>
      <model>x3400 Tower Server</model>
      <serial_number></serial_number>
      <asset_ref></asset_ref>
      <nwinterface_list>Sorry, no yet implemented</nwinterface_list>
      <description></description>
      <location_id>1</location_id>
      <location_details></location_details>
      <management_ip>10.1.1.20</management_ip>
      <default_gateway>255.255.255.0</default_gateway>
      <cpu>4</cpu>
      <ram>8Gb</ram>
      <hdd>240Gb</hdd>
      <os_family>Unix</os_family>
      <os_version>AIX 4.0</os_version>
      <application_list>Sorry, no yet implemented</application_list>
      <patch_list>Sorry, no yet implemented</patch_list>
   </Server>
</Set>

CSV

id,Name,Management IP
1,"dbserver1.demo.com","10.1.1.10"
6,"webserver.demo.com","10.1.1.20"

Allowed users

There is no restriction on the usage of this page.

History

  • 0.9 First implementation of this feature
  • 1.2.1 Added the argument 'query', as an alternative to 'expression'.
  • 1.2.1 Added the format 'spreadsheet', which splits date and time columns.
  • 1.2.1 Fixed stopper issues with HTTPS and MS-IIS (Trac: #485).
  • 1.2.1 The parameter file can be specified as an argument (the documentation was wrong: it was not actually implemented).
  • Branch 1.2.1 Spreadsheet format: fixed issue with times (Trac: #541). The workaround is to use the XML format (XCel does support this)
  • 2.0: added the flag no_localize
2_0_3/advancedtopics/exportdata.txt · Last modified: 2018/12/19 11:40 (external edit)
Back to top
Contact us