ShopifyShop: ShopifyShop class

Description Arguments Details ShopifyShop Class Generator Usage Public Fields Public Functions Examples

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)

storeFrontToken

a Storefront API access token

quiet

suppress output of API announcements

Details

In order to access the Shopify Admin 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

CustomerSavedSearch functions
  • getCustomerSavedSearches

  • getCustomerSavedSearchesCount

  • getCustomerSavedSearch

  • getCustomerSavedSearchResults

  • createCustomerSavedSearch

  • modifyCustomerSavedSearch

  • deleteCustomerSavedSearch

DiscountCode functions
  • createDiscountCode

  • modifyDiscountCode

  • getDiscountCodes

  • getDiscountCode

  • deleteDiscountCode

  • deleteDiscountCode

  • createDiscountCodesCreationJob

  • getDiscountCodesCreationJob

  • getDiscountCodesFromCreationJob

DraftOrder functions
  • createDraftOrder

  • modifyDraftOrder

  • getDraftOrders

  • getDraftOrder

  • getDraftOrdersCount

  • sendDraftOrderInvoice

  • deleteDraftOrder

  • completeDraftOrder

Event functions
  • getEvents

  • getEvent

  • getEventsCount

Fulfillment functions
  • getFulfillments

  • getFulfillmentsCount

  • getFulfillment

  • createFulfillment

  • modifyFulfillment

  • completeFulfillment

  • cancelFulfillment

FulfillmentEvent functions
  • getFulfillmentEvents

  • getFulfillmentEvent

  • createFulfillmentEvent

  • deleteFulfillmentEvent

FulfillmentService functions
  • getFulfillmentServices

  • createFulfillmentService

  • getFulfillmentService

  • modifyFulfillmentService

  • deleteFulfillmentService

GiftCard functions
  • getGiftCards

  • getGiftCard

  • getGiftCardsCount

  • createGiftCard

  • modifyGiftCard

  • disableGiftCard

  • searchGiftCards

Location functions
  • getLocations

  • getLocation

MarketingEvent functions
  • getMarketingEvents

  • getMarketingEventsCount

  • getMarketingEvent

  • createMarketingEvent

  • updateMarketingEvent

  • deleteMarketingEvent

  • createMarketingEventEngagements

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

PriceRule functions
  • getPriceRules

  • getPriceRulesCount

  • getPriceRule

  • createPriceRule

  • modifyPriceRule

  • deletePriceRule

Policy functions
  • getPolicies

Product functions
  • getProducts

  • getProductsCount

  • getProduct

  • createProduct

  • modifyProduct

  • deleteProduct

Product Image functions
  • getProductImages

  • getProductImagesCount

  • getProductImage

  • createProductImage

  • modifyProductImage

  • deleteProductImage

ProductListing functions
  • getProductListings

  • getProductListingProducts

  • getProductListingsCount

  • getProductListing

  • createProductListing

  • deleteProductListing

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

Report functions
  • getReports

  • getReport

  • createReport

  • modifyReport

  • deleteReport

ResourceFeedback functions
  • createResourceFeedback

  • getResourceFeedbacks

ScriptTag functions
  • getScriptTags

  • getScriptTagsCount

  • getScriptTag

  • createScriptTag

  • modifyScriptTag

  • deleteScriptTag

ShippingZone functions
  • getShippingZones

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

UsageCharge functions
  • createUsageCharge

  • getUsageCharge

  • getUsageCharges

User functions
  • getUsers

  • getUser

  • getCurrentUser

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)

shopifyr documentation built on July 22, 2019, 9:04 a.m.