ShopifyShop {shopifyr} | R Documentation |
ShopifyShop class
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
- Article functions
- Asset functions
- Blog functions
- CarrierService functions
- Checkout functions
- Collect functions
- Comment functions
- Country functions
- CustomCollection functions
- Customer functions
- CustomerSavedSearch functions
- DiscountCode functions
- DraftOrder functions
- Event functions
- Fulfillment functions
- FulfillmentEvent functions
- FulfillmentService functions
- GiftCard functions
- Location functions
- MarketingEvent functions
- Metafield functions
- Order functions
- Order Risks functions
- Page functions
- PriceRule functions
- Policy functions
- Product functions
- Product Image functions
- ProductListing functions
- Product Variant functions
- Province functions
- RecurringApplicationCharge functions
- Redirect functions
- Refund functions
- Report functions
- ResourceFeedback functions
- ScriptTag functions
- ShippingZone functions
- Shop functions
- SmartCollection functions
- Theme functions
- Transaction functions
- UsageCharge functions
- User functions
- Webhook functions
Examples
## 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)