Whoops. There was an error.

You do not have permission to access the booth requested. If this is your own booth and it hasn't been activated, you must be logged in to view it.

Perl Examples

package bonapitit;
use strict;
use JSON;
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Request::Common;

sub new {
  shift;

  my %params = @_;

  my $self = \%params;
  bless( $self );
  die("I need both X-BONANZLE-API-DEV-NAME and X-BONANZLE-API-CERT-NAME\n") unless ($self->{'X-BONANZLE-API-DEV-NAME'} && $self->{'X-BONANZLE-API-CERT-NAME'});

  $self->{ua} = LWP::UserAgent->new( 'agent' => 'Bonapitit perl api' );
  $self->{ua}->default_header(
    'Accept-Encoding'          => 'gzip, deflate',
    'X-BONANZLE-API-DEV-NAME'  => $self->{'X-BONANZLE-API-DEV-NAME'},
    'X-BONANZLE-API-CERT-NAME' => $self->{'X-BONANZLE-API-CERT-NAME'},
  );

  return $self;
}

sub standardRequest {
  my $self = shift;

  $self->_request( 'https://api.bonanza.com/api_requests/standard_request', @_ );
}

sub secureRequest {
  my $self = shift;

  $self->_request( 'https://api.bonanza.com/api_requests/secure_request', @_ );
}

sub _request {
  my $self = shift;
  my ( $url, $method, $data ) = @_;

  my $request = ( POST $url, [ $method => encode_json( $data ) ] );
  my $parsedResponse = decode_json ( $self->{ua}->request( $request )->decoded_content() );

  return $parsedResponse;
}

1;

Example usage

Create object

use strict;
use bonapitit;
use Data::Dumper;

my $bonapitit = bonapitit->new( 'X-BONANZLE-API-DEV-NAME' => 'xxxxxxxxxxxxxxxxxx', 'X-BONANZLE-API-CERT-NAME' => 'xxxxxxxxxxxxxxxxxx' );

Get items from a booth

my $result = $bonapitit->standardRequest( 'findItemsByKeywords', { itemFilter => { boothName => $booth } } );
print Dumper($result);
$VAR1 = {
          'timestamp' => '2011-01-03T11:39:48.000Z',
          'ack' => 'Success',
          'version' => '1.0beta',
          'findItemsByKeywordsResponse' => {
             'item' => [
                         {
                           'descriptionBrief' => 'Fair quality hardback copy of Stephen King\'s Needful Things.  Book has great illustrations inside.  The jacket has some wear and tear and there is a stain on the last page  otherwise in good shape    ',
                           'primaryCategory' => {
                                                  'categoryId' => 267,
                                                  'categoryName' => 'Books'
                                                },
                           'sellingStatus' => {
                                                'convertedCurrentPrice' => '5',
                                                'currentPrice' => '5',
                                                'sellingState' => 'Active'
                                              },
                           'shippingInfo' => {
                                               'shipToLocations' => 'US',
                                               'insuranceCost' => '1',
                                               'shippingType' => 'Flat',
                                               'insuranceType' => 'Optional',
                                               'shippingServiceCost' => '15'
                                             },
                           'paymentMethod' => [
                                                'GoogleCheckout',
                                                'Paypal'
                                              ],
                           'listingInfo' => {
                                              'convertedBuyItNowPrice' => '5',
                                              'bestOfferEnabled' => 'true',
                                              'lastChangeTime' => '2010-12-20T15:35:06.000Z',
                                              'startTime' => '2010-06-21T09:54:40.000Z',
                                              'price' => '5',
                                              'buyItNowPrice' => '5',
                                              'listingType' => 'FixedPrice'
                                            },
                           'globalId' => 'BONANZLE',
                           'viewItemURL' => 'https://www.bonanza.com/booths/alexwberg/items/Stephen_King_s_Needful_Things__Hardback_',
                           'location' => 'Seattle, WASH',
                           'sellerInfo' => {
                                             'userPicture' => 'http://bonanzleimages.s3.amazonaws.com/user_profile_image/afu/user_profile_images/0046/3780/me.jpg',
                                             'membershipLevel' => 2,
                                             'positiveFeedbackPercent' => '100',
                                             'availableForChat' => 'true',
                                             'sellerUserName' => 'alexwberg',
                                             'feedbackRatingStar' => 'Yellow'
                                           },
                           'affiliateCommission' => {
                                                      'enabled' => 'false'
                                                    },
                           'galleryURL' => 'http://bonanzleimages.s3.amazonaws.com/afu/images/7021/0091/DSC01965_thumb155_crop.JPG',
                           'itemId' => 16594654,
                           'storeInfo' => {
                                            'storeHasBonanza' => 'false',
                                            'storeName' => 'alexwberg\'s books \'n things',
                                            'storeURL' => 'https://www.bonanza.com/booths/alexwberg',
                                            'storeDiscount' => undef,
                                            'storeItemCount' => 4
                                          },
                           'title' => 'Stephen King\'s Needful Things (Hardback)',
                           'postalCode' => '98126'
                         },
        };

Reprice an item

my $result = $bonapitit->secureRequest( 'reviseFixedPriceItemRequest', { 'requesterCredentials' => { 'bonanzleAuthToken' => $clientId }, 'itemId' => $itemId, 'item' => { 'price' => $price } } );
print Dumper($result);
$VAR1 = {
          'timestamp' => '2011-01-03T11:42:03.000Z',
          'ack' => 'Success',
          'version' => '1.0beta',
          'reviseFixedPriceItemResponse' => {
            'itemId' => 24525598,
            'categoryId' => 39461,
            'sellingState' => 'Ready for sale'
          }
        };

Update booth

my $result = $bonapitit->secureRequest( 'updateBooth', { 'requesterCredentials' => { 'bonanzleAuthToken' => $clientId } } );
print Dumper $result;
$VAR1 = {
          'timestamp' => '2011-01-03T11:43:09.000Z',
          'ack' => 'Success',
          'version' => '1.0beta',
          'updateBoothResponse' => {
             'resultMessage' => 'Booth queued for update',
             'success' => bless( do{\(my $o = 1)}, 'JSON::XS::Boolean' )
           }
        };

Bonanza uses cookies to ensure you get the best experience on our website. Learn more