ShopifyShop class

Share:

Description

The ShopifyShop class fully encapsulates the Shopify API. It is an R6 class, and as such is initialized via the ‘new’ function (see the example section for details).

Arguments

shopURL

the URL of your shop, as in shopname.myshopify.com

password

a Shopify API private app password or permanent access token (see Details)

quiet

suppress output of API announcements

Details

In order to access the Shopify API, users will need a set of authorized API access credentials. Tthese so-called ‘private app’ credentials can be created in the Shopify store admin section. More information about how to do this can be found here. Once the credentials are created, they remain valid and can be used in subsequent R sessions.

At the moment, the ShopifyShop class does not support OAuth authentication. It is possible that this may be implemented in the future. Note that users who possess a valid ‘permanent access token’ from a previous OAuth Authentication (see here) may use it as the password field of the ShopifyShop class as the private app password is essentially analagous to the permanent token granted through successful OAuth authentication.

ShopifyShop Class Generator Usage

ShopifyShop$new(shopURL, password, quiet = FALSE)

if successful, will return a new ShopifyShop object.

Public Fields

shopInfo

information about the shop as returned by getShop

Public Functions

ApplicationCharge functions
  • createApplicationCharge

  • getApplicationCharge

  • getApplicationCharges

  • activateApplicationCharge

Article functions
  • getArticles

  • getArticlesCount

  • getArticle

  • createArticle

  • modifyArticle

  • getArticleAuthors

  • getArticleTags

  • deleteArticle

Asset functions
  • getAssets

  • getAsset

  • createAsset

  • modifyAsset

  • deleteAsset

Blog functions
  • getBlogs

  • getBlogsCount

  • getBlog

  • createBlog

  • modifyBlog

  • deleteBlog

CarrierService functions
  • createCarrierService

  • modifyCarrierService

  • getCarrierServices

  • getCarrierService

  • deleteCarrierService

Checkout functions
  • getCheckoutsCount

  • getCheckouts

Collect functions
  • createCollect

  • deleteCollect

  • getCollects

  • getCollectsCount

  • getCollect

Comment functions
  • getComments

  • getCommentsCount

  • getComment

  • createComment

  • modifyComment

  • markCommentAsSpam

  • markCommentAsNotSpam

  • approveComment

  • removeComment

  • restoreComment

Country functions
  • getCountries

  • getCountriesCount

  • getCountry

  • createCountry

  • modifyCountry

  • deleteCountry

CustomCollection functions
  • getCustomCollections

  • getCustomCollectionsCount

  • getCustomCollection

  • createCustomCollection

  • modifyCustomCollection

  • deleteCustomCollection

Customer functions
  • getCustomers

  • searchCustomers

  • getCustomer

  • createCustomer

  • modifyCustomer

  • deleteCustomer

  • getCustomersCount

  • getCustomerOrders

CustomerGroup & CustomerSavedSearch functions
  • getCustomerGroups

  • getCustomerGroupsCount

  • getCustomerGroup

  • getCustomerGroupCustomers

  • createCustomerGroup

  • modifyCustomerGroup

  • deleteCustomerGroup

Event functions
  • getEvents

  • getEvent

  • getEventsCount

Fulfillment functions
  • getFulfillments

  • getFulfillmentsCount

  • getFulfillment

  • createFulfillment

  • modifyFulfillment

  • completeFulfillment

  • cancelFulfillment

FulfillmentService functions
  • getFulfillmentServices

  • createFulfillmentService

  • getFulfillmentService

  • modifyFulfillmentService

  • deleteFulfillmentService

Location functions
  • getLocations

  • getLocation

Metafield functions
  • getMetafields

  • getMetafieldsCount

  • getMetafield

  • createMetafield

  • modifyMetafield

  • deleteMetafield

Order functions
  • getOrders

  • getOrder

  • getOrdersCount

  • closeOrder

  • openOrder

  • cancelOrder

  • createOrder

  • modifyOrder

  • deleteOrder

Order Risks functions
  • createOrderRisk

  • getOrderRisks

  • getOrderRisk

  • modifyOrderRisk

  • deleteOrderRisk

Page functions
  • getPages

  • getPagesCount

  • getPage

  • createPage

  • modifyPage

  • deletePage

Product functions
  • getProducts

  • getProductsCount

  • getProduct

  • createProduct

  • modifyProduct

  • deleteProduct

Product Image functions
  • getProductImages

  • getProductImagesCount

  • getProductImage

  • createProductImage

  • modifyProductImage

  • deleteProductImage

Product Variant functions
  • getProductVariants

  • getProductVariantsCount

  • getProductVariant

  • createProductVariant

  • modifyProductVariant

  • deleteProductVariant

Province functions
  • getProvinces

  • getProvincesCount

  • getProvince

  • modifyProvince

RecurringApplicationCharge functions
  • createRecurringCharge

  • getRecurringCharge

  • getRecurringCharges

  • activateRecurringCharge

  • cancelRecurringCharge

Redirect functions
  • getRedirects

  • getRedirectsCount

  • getRedirect

  • createRedirect

  • modifyRedirect

  • deleteRedirect

Refund functions
  • getRefund

ScriptTag functions
  • getScriptTags

  • getScriptTagsCount

  • getScriptTag

  • createScriptTag

  • modifyScriptTag

  • deleteScriptTag

Shop functions
  • getShop

SmartCollection functions
  • getSmartCollections

  • getSmartCollectionsCount

  • getSmartCollection

  • createSmartCollection

  • modifySmartCollection

  • orderSmartCollection

  • deleteSmartCollection

Theme functions
  • getThemes

  • getTheme

  • createTheme

  • modifyTheme

  • deleteTheme

Transaction functions
  • getTransactions

  • getTransactionsCount

  • getTransaction

  • createTransaction

Webhook functions
  • getWebhooks

  • getWebhooksCount

  • getWebhook

  • createWebhook

  • modifyWebhook

  • deleteWebhook

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
## Not run: 
# Before you can access the API, you must create a ShopifyShop object using your credentials
shop <- ShopifyShop$new("yourstore.myshopify.com","private_app_password")

# Get all smart collections
collections <- shop$getSmartCollections()

# Search for customers named Bob from the United States
bobs <- shop$searchCustomers("Bob country:United States")

# Create a new product
product <- list(title="The R Inferno",
                body="<b>The R Inferno</b><i>by Patrick Burns</i>",
                vendor="Burns Statistics",
                product_type="Paperback",
                images=list(list(src="http://www.burns-stat.com/wp-content/
                                      uploads/2012/12/R_inferno_cover.jpg")))
newProduct <- shop$createProduct(product)

## End(Not run)