Package 'walmartAPI'

Title: Walmart Open API Wrapper
Description: Provides API access to the Walmart Open API <https://developer.walmartlabs.com/>, that contains data about stores, Value of the day and products which includes names, sale prices, shipping rates and taxonomies.
Authors: Emil Hvitfeldt [aut, cre]
Maintainer: Emil Hvitfeldt <[email protected]>
License: MIT + file LICENSE
Version: 0.1.5.9000
Built: 2024-09-25 02:43:40 UTC
Source: https://github.com/emilhvitfeldt/walmartapi

Help Index


Returns NA if input is null, else returns input

Description

Returns NA if input is null, else returns input

Usage

ifelse_null(x)

Arguments

x

A number.

Value

A number or NA.

Examples

ifelse_null(NA)
ifelse_null(1)

Returns tibble of items in base response format

Description

response formats are described at the url https://developer.walmartlabs.com/docs/read/Item_Field_Description.

Usage

item_base_response(x)

Arguments

x

A List.

Value

A tibble with 15 columns in base response format.


Looks up product information

Description

lookup gives access to item price and availability in real-time.

Usage

lookup(key = auth_cache$KEY, lsPublisherId = NULL, id = NULL,
  upc = NULL, list_output = FALSE)

Arguments

key

Your API access key.

lsPublisherId

Your LinkShare Publisher Id.

id

vector of item ids.

upc

upc of the item.

list_output

Indicator for list output.

Details

An API key will be required to run this function and can be acquired by creating an account on the following website https://developer.walmartlabs.com/member.

For more information refer to the original documentation https://developer.walmartlabs.com/docs/read/Home.

Response formats are described at the url https://developer.walmartlabs.com/docs/read/Item_Field_Description.

Value

A tibble with 15 columns in base response format.

Examples

## Not run: 
key <- "************************"

## Up to 20 ids can be called at once.
lookup(id = c(12417882:12417937), key = key)

lookup(id = 12417832, key = key)

lookup(upc = 10001137891, key = key)

## First argument will be used with conflicting arguments.
lookup(id = 12417837, upc = 10001137891, key = key)

lookup(id = 12417832, key = key, list_output = TRUE)

## End(Not run)

Looks up product information

Description

lookup gives access to item price and availability in real-time.

Usage

paginted(key = auth_cache$KEY, lsPublisherId = NULL, category = NULL,
  brand = NULL, specialOffer = NULL, list_output = FALSE)

Arguments

key

Your API access key.

lsPublisherId

Your LinkShare Publisher Id.

category

Category id of the desired category. This should match the id field from taxonomy function.

brand

Brand name.

specialOffer

Special offers like (rollback, clearance, specialBuy).

list_output

Indicator for list output.

Details

An API key will be required to run this function and can be acquired by creating an account on the following website https://developer.walmartlabs.com/member.

For more information refer to the original documentation https://developer.walmartlabs.com/docs/read/Home.

Response formats are described at the url https://developer.walmartlabs.com/docs/read/Item_Field_Description.

Value

A tibble with 16 columns. First 15 is the items in base response format, followed by a column containing the URL path for the next page.

Examples

## Not run: 
key <- "************************"

paginted(key = key, brand = "Apple")

paginted(key = key, category = 3944)

paginted(key = key, category = 3944, specialOffer = "rollback")

paginted(key = key, brand = "Apple", list_output = TRUE)

## End(Not run)

Save API credentials for later use

Description

This functions caches the credentials to avoid need for entering it when calling other functions

Usage

save_walmart_credentials(app_key)

Arguments

app_key

application key

Examples

# since not checking is preformed not to waste API calls
# it falls on the user to save correct information
save_walmart_credentials("APP_KEY")

searching with text the Walmart catalogue

Description

searching allows text search on the Walmart.com catalogue and returns matching items available for sale online. An API key will be required to run this function and can be acquired by creating an account on the following website https://developer.walmartlabs.com/member.

Usage

searching(query, key = auth_cache$KEY, lsPublisherId = NULL,
  categoryId = NULL, start = NULL, sort = NULL, order = NULL,
  numItems = NULL, facet = FALSE, facet.filter = NULL,
  list_output = FALSE)

Arguments

query

Search text - whitespace separated sequence of keywords to search for.

key

Your API access key.

lsPublisherId

Your LinkShare Publisher Id.

categoryId

Category id of the category for search within a category. This should match the id field from Taxonomy API.

start

Starting point of the results within the matching set of items - up to 10 items will be returned starting from this item.

sort

Sorting criteria, allowed sort types are (relevance, price, title, bestseller, customerRating, new). Default sort is by relevance.

order

Sort ordering criteria, allowed values are (asc, desc). This parameter is needed only for the sort types (price, title, customerRating).

numItems

Number of matching items to be returned, max value 25. Default is 10.

facet

Logical. Enables facets. Default value is FALSE. Set this to on to enable facets.

facet.filter

Filter on the facet attribute values. This parameter can be set to <facet-name>:<facet-value> (without the angles). Here facet-name and facet-value can be any valid facet picked from the search API response when facets are on.

list_output

Indicator for list output.

Details

For more information refer to the original documentation https://developer.walmartlabs.com/docs/read/Search_API.

Response formats are described at the url https://developer.walmartlabs.com/docs/read/Item_Field_Description.

Value

A tibble with 15 columns in base response format.

Examples

## Not run: 
key <- "************************"

searching(query = "ipod", key = key)

searching(query = "ipod", key = key, categoryId = 3944)

searching(query = "ipod", key = key, start = 44)

searching(query = "ipod", key = key, numItems = 44)

searching(query = "ipod", key = key, sort = "price", order = "asc")

searching(query = "ipod", key = key, sort = "bestseller")

searching(query = "ipod", key = key, list_output = TRUE)

## End(Not run)

Subsets up to n elements in a vector

Description

Subsets up to n elements in a vector

Usage

smart_subset(x, n)

Arguments

x

A vector.

n

A number.

Value

vector of length equal to length of x or n, whichever is smallest.

Examples

smart_subset(1:10, 5)
smart_subset(1:10, 50)

Locale nearby Walmart stores

Description

store_locator helps locate nearest Walmart Stores by letting you users search for stores by latitude and longitude, by zip code and by city.

Usage

store_locator(key = auth_cache$KEY, lat = NULL, lon = NULL, city = NULL,
  zip = NULL, list_output = FALSE)

Arguments

key

Your API access key.

lat

latitude.

lon

longitude.

city

city.

zip

zip code.

list_output

Indicator for list output.

Details

An API key will be required to run this function and can be acquired by creating an account on the following website https://developer.walmartlabs.com/member.

For more information refer to the original documentation https://developer.walmartlabs.com/docs/read/Store_Locator_API.

Value

A tibble with 12 columns in base response format.

Examples

## Not run: 
key <- "************************"

store_locator(key = key, lat = 29, lon = -95)

store_locator(key = key, city = "Houston")

store_locator(key = key, zip = 77063)

store_locator(key = key, zip = 77063, list_output = TRUE)

## End(Not run)

The category taxonomy used by walmart.com to categorize items

Description

This function returns the top level of categories only, for further levels run function with list_output = FALSE for nested list.

Usage

taxonomy(key = auth_cache$KEY, list_output = FALSE)

Arguments

key

Your API access key.

list_output

Indicator for list output.

Details

taxonomy gives returns the category taxonomy used by walmart.com to categorize items.

An API key will be required to run this function and can be acquired by creating an account on the following website https://developer.walmartlabs.com/member.

For more information refer to the original documentation https://developer.walmartlabs.com/docs/read/Taxonomy_API.

Value

A tibble with 15 columns in base response format.

Examples

## Not run: 
key <- "************************"

taxonomy(key = key)

taxonomy(key = key, list_output = TRUE)

## End(Not run)

Value of the day

Description

VOD provides the Value of the Day item at walmart.

Usage

VOD(key = auth_cache$KEY, list_output = FALSE)

Arguments

key

Your API access key.

list_output

Indicator for list output.

Details

An API key will be required to run this function and can be acquired by creating an account on the following website https://developer.walmartlabs.com/member.

Response formats are described at the url https://developer.walmartlabs.com/docs/read/Item_Field_Description.

Value

A tibble with 15 columns in base response format.

Examples

## Not run: 
key <- "************************"

VOD(key = key)

VOD(key = key, list_output = TRUE)

## End(Not run)