GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  ZENOSS::RESPONSE (3)

.ds Aq ’

NAME

Zenoss::Response - Handles responses from Zenoss::Router

CONTENTS

SYNOPSIS



    use Zenoss;
    use Data::Dumper;
   
    # Create a Zenoss object
    my $api = Zenoss->connect(
        {
            username    => admin,
            password    => zenoss,
            url         => http://zenossinstance:8080,
        }
    );
   
    # Issue a request to get all devices from Zenoss
    my $response = $api->device_getDevices();
   
    # $response is now an instance of Zenoss::Response
    # now we can do things like
    print $response->json();
    print $response->http_code();
   
    # get the response in reference form
    my $reference = $response->decoded();
    print Dumper $reference;



DESCRIPTION

This module is NOT instantiated directly. When the Zenoss API issues a response to a request initiated by Zenoss::Router, a Zenoss::Response instance is created. To call methods from this module create an instance of Zenoss and issue a request to the Zenoss API.

Please review the SYNOPSIS for examples.

ATTRIBUTES

Attributes can be retrieved by calling $obj->attribute.

    sent_tid

This attribute is set upon the creation of Zenoss::Response by Zenoss::Router. Each request issued to the Zenoss API is coded with a transaction ID (tid). This can be compared with the received_tid to ensure that the proper response was received for what was requested.

    received_tid

This attribute is set by extracting the transaction ID (tid) from the response Zenoss sends. This can be compared with the sent_tid to ensure that the proper response was received for what was requested.

METHODS

CW$obj->json()

Returns the response, from the Zenoss API request, in JSON format.

CW$obj->decoded()

Returns the result response, from the Zenoss API request, in a PERL reference.

CW$obj->raw_response()

Returns a textual representation of the response.

CW$obj->http_code()

Returns a 3 digit number that encodes the overall outcome of a HTTP response.

For example 200, for OK.

CW$obj->http_code_description()

Returns a short human readable single line string that explains the response code.

For example, OK.

CW$obj->http_status()

Returns the string <http_code> <http_code_description>. If the http_code_description attribute is not set then the official name of <code> (see HTTP::Status) is substituted.

CW$obj->is_success()

Returns true if the http response was successful. Note this does not mean the API request was successful or not.

See HTTP::Status for the meaning of these.

CW$obj->is_error()

Returns true if the http response had an error. Note this does not mean the API request was successful or not.

See HTTP::Status for the meaning of these.

CW$obj->error_as_HTML()

Returns a string containing a complete HTML document indicating what error occurred. This method should only be called when $obj->is_error is TRUE.

CW$obj->header()

This is used to get header values and it is inherited from HTTP::Headers via HTTP::Message.

CW$obj->request_time()

Calculates the current age of the response as specified by RFC 2616 section 13.2.3. The age of a response is the time since it was sent by the origin server. The returned value is a number representing the age in seconds.

CW$obj->received_tid()

Returns the transaction id (tid) that was returned by Zenoss.

CW$obj->sent_tid()

Returns the transaction id (tid) that was sent to Zenoss

SEE ALSO

o Zenoss

AUTHOR

Patrick Baker <patricksbaker@gmail.com>

COPYRIGHT AND LICENSE

Copyright (C) 2010 by Patrick Baker <patricksbaker@gmail.com>

This module is free software: you can redistribute it and/or modify it under the terms of the Artistic License 2.0.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

You can obtain the Artistic License 2.0 by either viewing the LICENSE file provided with this distribution or by navigating to <http://opensource.org/licenses/artistic-license-2.0.php>.

Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 ZENOSS::RESPONSE (3) 2011-10-20

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.