The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

WebService::Tesco::API - Web service for the Tesco groceries API

VERSION

version 1.110230

SYNOPSIS

use WebService::Tesco::API;

my $tesco = WebService::Tesco::API->new( app_key => 'xxxxxx', developer_key => 'yyyyyy', debug => 1, );

my $result = $tesco->login({ email => 'test@test.com', password => 'password', });

DESCRIPTION

Web service for the Tesco groceries API, currently in beta. Register at: https://secure.techfortesco.com/tescoapiweb/ Terms of use: http://www.techfortesco.com/tescoapiweb/terms.htm

NAME

WebService::Tesco::API - Web service for the Tesco groceries API.

VERSION

version 1.110210

NAME

WebService::Tesco::API - Web service for the Tesco groceries API

VERSION

Version 0.01

Constructor

new()

Creates and returns a new WebService::Tesco::API object

    my $tesco = WebService::Tesco::API->new(
            app_key         => 'xxxxxx',
            developer_key   => 'yyyyyy',
        );
  • app_key => 'xxxxx'

    Set the application key. This can be set up at: https://secure.techfortesco.com/tescoapiweb/

  • developer_key => 'yyyyyy'

    Set the developer key. This can be set up at: https://secure.techfortesco.com/tescoapiweb/

  • email => 'test@test.com'

    Set the email to log in with, only used for login

  • password => 'password'

    Set the password to log in with, only used for login

  • debug => [0|1]

    Show debugging information

METHODS

get($args)

General method for sending a GET request. Set $args->{secure} to use the https endpoint (required for certain requests). You shouldn't need to use this method directly

login({ email => 'test@test.com', password => 'password' })

Log in to the Tesco Grocery API It uses the https endpoint to send email and password. Returns a session key.

  • email => 'test@test.com'

    Set the email to log in with

  • password => 'password'

    Set the password to log in with

Returns:

{ "StatusCode" => 0, "StatusInfo" => "Command Processed OK", "BranchNumber" => "2431", "CustomerId" => "12592340", "CustomerName" => "Mr Lansley", "SessionKey" => "x38yJTParR282iuQrmvcmgBwLhwhLKJqKj6rcmxYy1WRR4j5me", "ChosenDeliverySlotInfo" => "No delivery slot is reserved." }

session_get( $args )

General method for sending a GET request that requires a session key. You shouldn't need to use this method directly

amend_order({ ordernumber => 1234567 })

Switches the API into ʻAmend Orderʼ Mode

  • ordernumber => 1234567

    Order number from list_pending_orders command

cancel_amend_order()

Cancels any edits to the amended order and returns to the current un-checked-out basket.

change_basket({ productid => 1234567, changequantity => 2, substitution => 'YES', notesforshopper => 'note' })

Enables products to be added to, removed from, and updated in the current basket.

  • productid => 123456789

    9-digit Product ID available in product data returned from search commands

  • changequantity => 1

    A positive or negative value that changes the products in the basket by that quantity, according to these rules:

    • 1) If the product was absent from the basket before that product was added, it is inserted into the basket at the requested quantity.

    • 2) If the product was already in the basket, the quantity is increased by requested quantity if positive, or reduced by the requested quantity if the requested quantity is negative.

    • 3) If a negative requested quantity is equal to or larger than the existing quantity, the product is removed from the basket.

    • 4) For products that sell by weight, quantities added or removed are still each. For example, if you are adding apples that are priced per Kg, selecting 2 for this parameter will add 2 individual apples to the basket, not 2 Kg of apples.

  • substitution => ['YES'|'NO']

    The allowed values are: YES (substitute with anything reasonable) , NO (do not substitute)

  • notesforshopper => 'I want a turnip shaped like a thingy'

    A short description to help the shopper choose something appropriate. Try to keep this below 50 characters.

choose_delivery_slot( deliveryslotid => 1234567 })

Selects a delivery slot from a list provided by list_delivery_slots.

  • deliveryslotid => 1234567

    Delivery slot id from list_delivery_slots command.

latest_app_version()

Returns your app's latest version (set by you in the developer portal).

list_delivery_slots()

Lists available delivery slots.

list_basket({ fast => 'Y' })

Lists the contents of the basket.

  • fast => ['Y'|'N']

    Massively speeds up retrieval (if set to 'Y') of the basket at the cost of not being able to find all of the core attributes required for a product, such as EANBarcode. (OPTIONAL)

list_basket_summary({ includeproducts => 'Y' })

Lists just summary information about the basket.

  • includeproducts => ['Y'|'N']

    includeproducts=N if you only wish to retrieve the basket header information. (OPTIONAL)

list_favourites({ page => 1 })

Returns the products in the customerʼs favourites list.

  • page => 1

    Used to get a page of favourites rather than all of them (the customer may have hundreds!). (OPTIONAL)

list_pending_orders()

Lists orders that have already been checked-out but not yet delivered.

list_product_categories()

Lists the departments, aisles and shelves in a nested format.

list_product_offers({ page => 1 })

Lists all the products currently on offer.

  • page => 1

    Used to get a page of offers rather than all of them. (OPTIONAL)

list_products_by_category({ category => 18, extendedinfo => 'Y' })

Lists the products for a given shelf (provided by list_product_categories).

  • extendedinfo => ['Y'|'N']

    Set to 'Y' for extended information. (OPTIONAL)

product_search({ searchtext => 'Turnip', extendedinfo => 'Y' })

Searches for products using text or barcode.

  • searchtext => 'Turnip'

    Text to search for products, 9-digit Product ID, or 13-digit numeric barcode value.

  • extendedinfo => ['Y'|'N']

    Set to 'Y' for extended information. (OPTIONAL)

ready_for_checkout()

Checks to see if an order is ready for checkout (that is, there are at least 5 products in the basket and a delivery slot has been selected).

server_date_time()

Returns the serverʼs current date and time.

save_amend_order()

The API is requested to save changes to the amended order.

AUTHOR

Willem Basson <willem.basson@gmail.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2011 by Willem Basson.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

AUTHOR

Willem Basson <willem.basson@gmail.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2011 by Willem Basson.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 357:

Non-ASCII character seen before =encoding in 'ʻAmend'. Assuming CP1252