getSalesReport: Retrieve sales reports.

View source: R/getSalesReports.R

getSalesReportR Documentation

Retrieve sales reports.

Description

getSalesReport provides comphrehensive access to sales reports from the appFigures web API.

Usage

getSalesReport(product_ids, end_date, start_date, group_by, country,
  dataset = c("none", "financial"), granularity = c("daily", "weekly",
  "monthly", "yearly"), format = c("flat", "csv", "json"),
  include_inapps = FALSE, curlHandle, verbose = FALSE,
  orgJSON = FALSE)

Arguments

product_ids

Numeric. A vector of appFigures-assigned product ids. The default will return sales for all products in the account.

end_date

Character string or date object. Date of last ranks to be reported. Defaults to today. See Details.

start_date

Character string or date object. Date of first ranks to be reported. Defaults to the last 31 days. See Details.

group_by

Character. Choose one or more of: "dates", "products", "store", "countries", or "regions"

country

Character. One or more country iso abbreviations. Defaults to all countries.

dataset

Character. Choose either "none" or "financial". Defaults to "none". This only applies to Apple products.

granularity

Character. How should values be aggregated in time. Options include "daily", "weekly", "monthly", or "yearly". See Details.

format

Character. Choose between "flat", "csv", or "json". Defaults to "flat". See Details

include_inapps

Logical. If set to TRUE, any products given in product_ids will have their children automatically selected as well. Defaults to FALSE.

curlHandle

Provide an instance of the CURLHandle-class from the RCurl package. The default will create a curl handle specific to the function call.

verbose

Logical. Should details of the web request print to the console? Defaults to FALSE.

orgJSON

Logical. Should the JSON string be returned without being converted to R objects? Defaults to FALSE.

Details

For start_date and end_date, if the supplied argument can be interepreted as a date or POSIX object, any hour, minute, or second is ignored. If a string is supplied, it should have the format: 'yyyy-MM-dd'.

The argument granularity only matters if group_by contains "dates".

For the format argument, "csv" and "flat" return similar fields. Both values will truncate some of the data returned in the original JSON. A times (i.e. group_by = "products"), "csv" will contain a few more fields than "flat". Since different combinations of group_by arguments will lead to different nested JSON structures, if format is set to "json", the unformatted JSON string will be returned.

Value

A data frame containing the requested sales report.

See Also

Official documentation: http://docs.appfigures.com/api/reference/v2/sales.


appfigures/afapi documentation built on Nov. 13, 2022, 9:27 a.m.