GlpigetObject » History » Version 10

Version 9 (walid, 07/04/2011 01:24 PM) → Version 10/11 (walid, 07/04/2011 01:30 PM)

h1. [[En_devguide#Provided-Methods|Methods]] > glpi.getObject

| Version | Comments |
| 1.2.0 | options added : with_softwareversion, with_softwarelicense no changes |
| 1.1.0 | Method added |

!https://forge.indepnet.net/svn/webservices/authenticated.png! +@This method is only accessible by authenticated users@+

Retrieve information on a existing object if the authenticated user can view it.

*input* a hastable

* *help* option to get usage information *+OPTIONAL+*
* *itemtype* the object type *+MANDATORY+*
_itemtype can take one of the following_ https://forge.indepnet.net/embedded/glpi/annotated.html
* *id* the ID of object *+MANDATORY+*
* *show_label* option to show the lang label for each return field *+OPTIONAL+*
* *show_name* option to show the dropdown name value for each ID field *+OPTIONAL+*

+*Other input hastable options*+

The following options are available depending on the type that was defines in the "itemtype" option bellow.

* *with_infocom* option to show infocom informations in the output result
* *with_networkport* option to show network ports in the output result
* *with_phone* option to show connected phones in the output result (only for Computer type)
* *with_printer* option to show connected printers in the output result (only for Computer type)
* *with_monitor* option to show connected monitors in the output result (only for Computer type)
* *with_peripheral* option to show connected peripherals in the output result (only for Computer type)
* *with_document* option to show documents in the output result
* *with_ticket* option to show tickets in the output result (only for Ticket type)
* *with_tickettask* option to show ticket tasks in the output result (only for Ticket type)
* *with_ticketfollowup* option to show ticket followups in the output result (only for Ticket type)
* *with_ticketvalidation* option to show ticket validations informations in the output result (only for Ticket type)
* *with_reservation* option to show reservations available in the output result
* *with_software* option to show installed softwares in the output result (only for Computer type)
* *with_softwareversion* option to show version associated with a software (with-software parameter needed)
* *with_softwarelicense* option to show licensed associated with a software (with-software parameter needed)

* *with_contract* option to show attached contracts in the output result

*Default Call* example
<pre>
$ php testxmlrpc.php --session=0ptega61kobcnhkv0vokbercv1 --method=glpi.getObject --itemtype=Computer --id=501
+ Calling 'glpi.getObject' on http://localhost/glpi/plugins/webservices/xmlrpc.php?session=0ptega61kobcnhkv0vokbercv1
+ Response: Array
(
[name] => computers 0-1
[id] => 501
[locations_id] => 21
[computertypes_id] => 1
[computermodels_id] => 1
[states_id] => 5
[operatingsystems_id] => 1
[operatingsystemversions_id] => 2
[operatingsystemservicepacks_id] => 4
[autoupdatesystems_id] => 3
[os_license_number] => os sn 0
[os_licenseid] => os id 0
[serial] => m233a56mu6i
[otherserial] => vqcfci7a8si
[notepad] => note computer 0
[contact] => contact 0
[contact_num] => num 0
[users_id] => 748
[groups_id] => 3
[date_mod] => 2011-01-26 10:39:52
[networks_id] => 5
[domains_id] => 3
[manufacturers_id] => 1
[users_id_tech] => 579
[entities_id] => 1
[is_ocs_import] => 0
)</pre>

*Same call with_infocom* example
<pre>
$ php testxmlrpc.php --session=0ptega61kobcnhkv0vokbercv1 --method=glpi.getObject --itemtype=Computer --id=501 --with_infocom
+ Calling 'glpi.getObject' on http://localhost//glpi_078_svn/plugins/webservices/xmlrpc.php?session=0ptega61kobcnhkv0vokbercv1
+ Response: Array
(
[name] => computers 0-1
[id] => 501
[locations_id] => 21
[computertypes_id] => 1
[computermodels_id] => 1
[states_id] => 5
[operatingsystems_id] => 1
[operatingsystemversions_id] => 2
[operatingsystemservicepacks_id] => 4
[autoupdatesystems_id] => 3
[os_license_number] => os sn 0
[os_licenseid] => os id 0
[serial] => m233a56mu6i
[otherserial] => vqcfci7a8si
[notepad] => note computer 0
[contact] => contact 0
[contact_num] => num 0
[users_id] => 748
[groups_id] => 3
[date_mod] => 2011-01-26 10:39:52
[networks_id] => 5
[domains_id] => 3
[manufacturers_id] => 1
[users_id_tech] => 579
[entities_id] => 1
[is_ocs_import] => 0
[Infocom] => Array
(
[id] => 1126
[buy_date] => 2006-07-16
[use_date] => 2006-07-16
[warranty_duration] => 36
[warranty_info] => infowar comp 501
[warranty_value] => 315.0000
[suppliers_id] => 10
[order_number] => commande comp 501
[delivery_number] => BL comp 501
[immo_number] => immo comp 501
[value] => 3355.0000
[sink_time] => 5
[sink_type] => 1
[comment] => comment comp 501
[sink_coeff] => 5
[bill] => facture comp 501
[budgets_id] => 9
[itemtype] => Computer
[items_id] => 501
[alert] => 0
[entities_id] => 1
[is_recursive] => 0
)

)
</pre>