Skip to content
timotheus edited this page Mar 12, 2013 · 1 revision

###Usage

use eBay::API::Simple::JSON;

my $api = eBay::API::Simple::JSON->new();

# 'GET' call
$api->get( 
   'http://localhost-django-vm.ebay.com/green/api/v1/greenerAlternative/32/'
);

if ( $api->has_error() ) {
    die "Call Failed:" . $api->errors_as_string();
}

# convenience methods
my $hash = $api->response_hash();
my $response_content = $api->response_content();
my $request_content = $api->request_content();

# HTTP::Request
print $api->request->as_string();

# HTTP::Response
print $api->response->as_string();
print $api->response->content();
print $api->response->is_error();

# HTTP::Headers
print $api->response->headers->as_string();
print $api->response->headers->content_type();

# 'POST', 'PUT', 'DELETE' calls

my $data = {     
    "user_eais_token" => "tim", 
    "body_text" => "mytext"
};

$api->post( 'http://myendpoint', $data );
$api->put( 'http://myendpoint', $data );
$api->delete( 'http://myendpoint' );
Clone this wiki locally