opendns / autotask-php

A PHP SOAP wrapper for the Autotask Web Service API
BSD 3-Clause "New" or "Revised" License
61 stars 33 forks source link

Select field data to variables? #102

Closed tim-shand closed 6 years ago

tim-shand commented 6 years ago

Hi Team, thank you for your work on this API. I would like to select a field, such as ticket number, from an API query and add the result to a variable in PHP website. I am unsure how to do this, can you please advise? I am creating a custom web portal and wish to display ticket information per customer. At the moment all I get is a full dump of information, I only want particular fields. Thank you.

image

image

reynolek commented 6 years ago

When making the request, there is no direct way to say "Only return this field". The QueryResponse object you are getting back contains everything that your query returned.

$result = $client->query($query);
foreach ($result->queryResult->EntityResults->Entity as $ticket) {
    print_r($ticket);
    var_dump($ticket->TicketNumber);
}

The objects provided back via the Autotask Client are PHP Objects, so you have to access them with -> -- they work slightly differently than Associative Arrays.