diff --git a/DESCRIPTION b/DESCRIPTION index f9ffbad0..7da979f1 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,12 +1,12 @@ Package: salesforcer Title: An Implementation of 'Salesforce' APIs Using Tidy Principles -Version: 0.1.1.9000 -Date: 2018-04-08 +Version: 0.1.2 +Date: 2018-04-12 Description: An implementation of the 'Salesforce' Platform APIs (REST, SOAP, - Bulk, and Metadata) . + Bulk 1.0, Bulk 2.0, and Metadata) . This package is an articulation of the most API methods into R. The API calls - return XML or JSON that is parsed into lists and tibbles using tidy data principles. - For more details please see the 'Salesforces' API references and this package's website + return XML or JSON that is parsed tidy data structures. For more details please + see the 'Salesforces' API references and this package's website for more information, documentation, and examples. Authors@R: c( diff --git a/NEWS.md b/NEWS.md index ad50a5f0..593e3218 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,12 +1,13 @@ -## salesforcer 0.1.1.9000 +## salesforcer 0.1.2 ### Features - * Nothing Yet! - -### Bug Fixes - - * Nothing Yet! + * Add support for Bulk 1.0 operations of "create", "update", "upsert", "delete" and "hardDelete" + * Bulk 2.0 operations, by default, now return a single `tbl_df` containing all + of the successful records, error records, and unprocessed records + * Created internal functions that explicity call each API for an operation. For + example, `sf_create()` routes into `sf_create_soap()`, `sf_create_rest()`, and + `sf_bulk_operation()`. --- diff --git a/R/bulk-operation.R b/R/bulk-operation.R index be8c0e0f..2ac7b3c5 100644 --- a/R/bulk-operation.R +++ b/R/bulk-operation.R @@ -54,6 +54,8 @@ sf_create_job_bulk <- function(operation = c("insert", "delete", "upsert", "upda verbose=FALSE){ api_type <- match.arg(api_type) + operation <- match.arg(operation) + content_type <- match.arg(content_type) if(api_type == "Bulk 1.0"){ job_response <- sf_create_job_bulk_v1(operation=operation, object_name=object_name, @@ -65,10 +67,13 @@ sf_create_job_bulk <- function(operation = c("insert", "delete", "upsert", "upda if(!(operation %in% c("insert", "delete", "upsert", "update"))){ stop('Bulk 2.0 only supports the following operations: "insert", "delete", "upsert", and "update"') } + if(!(content_type %in% c("CSV"))){ + stop('Bulk 2.0 only supports the "CSV" content type.') + } job_response <- sf_create_job_bulk_v2(operation=operation, object_name=object_name, external_id_fieldname=external_id_fieldname, - content_type='CSV', + content_type=content_type, line_ending=line_ending, column_delimiter=column_delimiter, verbose=verbose) @@ -153,7 +158,7 @@ sf_create_job_bulk_v2 <- function(operation = c("insert", "delete", "upsert", "u verbose=FALSE){ operation <- match.arg(operation) - #content_type <- match.arg(content_type) + content_type <- match.arg(content_type) line_ending <- match.arg(line_ending) column_delimiter <- match.arg(column_delimiter) if(column_delimiter != "COMMA"){ diff --git a/README.Rmd b/README.Rmd index 5fad8da4..4c2c5573 100644 --- a/README.Rmd +++ b/README.Rmd @@ -20,12 +20,12 @@ knitr::opts_chunk$set( [![Coverage Status](https://codecov.io/gh/StevenMMortimer/salesforcer/branch/master/graph/badge.svg)](https://codecov.io/gh/StevenMMortimer/salesforcer?branch=master) **salesforcer** is an R package that connects to Salesforce Platform APIs using -tidy principles. The package implements most actions from the SOAP, REST, Bulk, -and Metadata APIs. Package features include: +tidy principles. The package implements most actions from the SOAP, REST, Bulk 1.0, +Bulk 2.0, and Metadata APIs. Package features include: - * OAuth 2.0 and Basic authentication methods (`sf_auth()`) - * CRUD (Create, Retrieve, Update, Delete) methods for records using the REST and Bulk APIs - * Query records via REST and Bulk APIs (`sf_query()`) + * OAuth 2.0 (Single Sign On) and Basic (Username-Password) Authentication methods (`sf_auth()`) + * CRUD (Create, Retrieve, Update, Delete) methods for records using the SOAP, REST, and Bulk APIs + * Query records via the SOAP, REST, and Bulk 1.0 APIs using `sf_query()` * Retrieve and modify metadata (Custom Objects, Fields, etc.) using the Metadata API with: * `sf_describe_objects()`, `sf_create_metadata()`, `sf_update_metadata()` * Utilize backwards compatible functions for the **RForcecom** package, such as: @@ -167,12 +167,22 @@ deleted_records ### Bulk Operations For really large operations (inserts, updates, upserts, deletes, and queries) Salesforce -provides a [Bulk API](https://developer.salesforce.com/docs/atlas.en-us.api_asynch.meta/api_asynch/asynch_api_intro.htm). In order to use the Bulk API in **salesforcer** you can just add -`api_type = "Bulk"` to your functions and the operation will be executed using the Bulk API. -It's that simple. The benefits of using the Bulk API for larger datasets is that +provides the [Bulk 1.0](https://developer.salesforce.com/docs/atlas.en-us.api_asynch.meta/api_asynch/asynch_api_intro.htm) +and [Bulk 2.0](https://developer.salesforce.com/docs/atlas.en-us.api_bulk_v2.meta/api_bulk_v2/introduction_bulk_api_2.htm) +APIs. In order to use the Bulk APIs in **salesforcer** you can just add `api_type = "Bulk 1.0"` +or `api_type = "Bulk 2.0"` to your functions and the operation will be executed using the Bulk APIs. +It's that simple. + +The benefits of using the Bulk API for larger datasets is that the operation will reduce the number of individual API calls (organization usually -have a limit on total calls) and batching the requests in Bulk is usually quicker -than running thousands of individuals calls when your data is large. +have a limit on total calls) and batching the requests in bulk is usually quicker +than running thousands of individuals calls when your data is large. **Note:** the +Bulk 2.0 API does **NOT** guarantee the order of the data submitted is preserved in +the output. This means that you must join on other data columns to match up the Ids that +are returned in the output with the data you submitted. For this reason, Bulk 2.0 may not +be a good solution for creating, updating, or upserting records where you need to keep +track of the created Ids. The Bulk 2.0 API would be fine for deleting records where +you only need to know which Ids were successfully deleted. ```{r} # create contacts using the Bulk API @@ -305,7 +315,7 @@ as they are explained better there. More information is also available on the `pkgdown` site at https://StevenMMortimer.github.io/salesforcer. -[Top](#salesforcer-) +[Top](#salesforcer) --- Please note that this project is released with a [Contributor Code of Conduct](CONDUCT.md). diff --git a/README.md b/README.md index 59f030c0..adae6a83 100644 --- a/README.md +++ b/README.md @@ -4,11 +4,11 @@ salesforcer [![Build Status](https://travis-ci.org/StevenMMortimer/salesforcer.svg?branch=master)](https://travis-ci.org/StevenMMortimer/salesforcer) [![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/StevenMMortimer/salesforcer?branch=master&svg=true)](https://ci.appveyor.com/project/StevenMMortimer/salesforcer) [![CRAN\_Status\_Badge](http://www.r-pkg.org/badges/version/salesforcer)](http://cran.r-project.org/package=salesforcer) [![Coverage Status](https://codecov.io/gh/StevenMMortimer/salesforcer/branch/master/graph/badge.svg)](https://codecov.io/gh/StevenMMortimer/salesforcer?branch=master) -**salesforcer** is an R package that connects to Salesforce Platform APIs using tidy principles. The package implements most actions from the SOAP, REST, Bulk, and Metadata APIs. Package features include: +**salesforcer** is an R package that connects to Salesforce Platform APIs using tidy principles. The package implements most actions from the SOAP, REST, Bulk 1.0, Bulk 2.0, and Metadata APIs. Package features include: -- OAuth 2.0 and Basic authentication methods (`sf_auth()`) -- CRUD (Create, Retrieve, Update, Delete) methods for records using the REST and Bulk APIs -- Query records via REST and Bulk APIs (`sf_query()`) +- OAuth 2.0 (Single Sign On) and Basic (Username-Password) Authentication methods (`sf_auth()`) +- CRUD (Create, Retrieve, Update, Delete) methods for records using the SOAP, REST, and Bulk APIs +- Query records via the SOAP, REST, and Bulk 1.0 APIs using `sf_query()` - Retrieve and modify metadata (Custom Objects, Fields, etc.) using the Metadata API with: - `sf_describe_objects()`, `sf_create_metadata()`, `sf_update_metadata()` - Utilize backwards compatible functions for the **RForcecom** package, such as: @@ -93,8 +93,8 @@ created_records #> # A tibble: 2 x 2 #> id success #> -#> 1 0036A00000SnhBRQAZ true -#> 2 0036A00000SnhBSQAZ true +#> 1 0036A00000SnhbfQAB true +#> 2 0036A00000SnhbgQAB true ``` ### Query @@ -115,8 +115,8 @@ queried_records #> # A tibble: 2 x 4 #> Id Account FirstName LastName #> * -#> 1 0036A00000SnhBRQAZ NA Test Contact-Create-1 -#> 2 0036A00000SnhBSQAZ NA Test Contact-Create-2 +#> 1 0036A00000SnhbfQAB NA Test Contact-Create-1 +#> 2 0036A00000SnhbgQAB NA Test Contact-Create-2 ``` ### Update @@ -134,13 +134,15 @@ updated_records #> # A tibble: 2 x 2 #> id success #> -#> 1 0036A00000SnhBRQAZ true -#> 2 0036A00000SnhBSQAZ true +#> 1 0036A00000SnhbfQAB true +#> 2 0036A00000SnhbgQAB true ``` ### Bulk Operations -For really large operations (inserts, updates, upserts, deletes, and queries) Salesforce provides a [Bulk API](https://developer.salesforce.com/docs/atlas.en-us.api_asynch.meta/api_asynch/asynch_api_intro.htm). In order to use the Bulk API in **salesforcer** you can just add `api_type = "Bulk"` to your functions and the operation will be executed using the Bulk API. It's that simple. The benefits of using the Bulk API for larger datasets is that the operation will reduce the number of individual API calls (organization usually have a limit on total calls) and batching the requests in Bulk is usually quicker than running thousands of individuals calls when your data is large. +For really large operations (inserts, updates, upserts, deletes, and queries) Salesforce provides the [Bulk 1.0](https://developer.salesforce.com/docs/atlas.en-us.api_asynch.meta/api_asynch/asynch_api_intro.htm) and [Bulk 2.0](https://developer.salesforce.com/docs/atlas.en-us.api_bulk_v2.meta/api_bulk_v2/introduction_bulk_api_2.htm) APIs. In order to use the Bulk APIs in **salesforcer** you can just add `api_type = "Bulk 1.0"` or `api_type = "Bulk 2.0"` to your functions and the operation will be executed using the Bulk APIs. It's that simple. + +The benefits of using the Bulk API for larger datasets is that the operation will reduce the number of individual API calls (organization usually have a limit on total calls) and batching the requests in bulk is usually quicker than running thousands of individuals calls when your data is large. **Note:** the Bulk 2.0 API does **NOT** guarantee the order of the data submitted is preserved in the output. This means that you must join on other data columns to match up the Ids that are returned in the output with the data you submitted. For this reason, Bulk 2.0 may not be a good solution for creating, updating, or upserting records where you need to keep track of the created Ids. The Bulk 2.0 API would be fine for deleting records where you only need to know which Ids were successfully deleted. ``` r # create contacts using the Bulk API @@ -284,7 +286,7 @@ Salesforce provides client libraries and examples in many programming langauges More information is also available on the `pkgdown` site at . -[Top](#salesforcer-) +[Top](#salesforcer) ------------------------------------------------------------------------ diff --git a/cran-comments.md b/cran-comments.md index 0620bc7e..f0fb2e5f 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -13,4 +13,3 @@ Possibly mis-spelled words in DESCRIPTION: APIs (2:42, 5:61) JSON (8:19) - tibbles (8:54) diff --git a/docs/NEWS.html b/docs/NEWS.html index 7f0d1acc..8ec20ce1 100644 --- a/docs/NEWS.html +++ b/docs/NEWS.html @@ -128,21 +128,16 @@

/Users/steven.mortimer/github/salesforcer/NEWS.md

-
+

-salesforcer 0.1.1.9000

+salesforcer 0.1.2

Features

    -
  • Nothing Yet!
  • -
-
-
-

-Bug Fixes

-
    -
  • Nothing Yet!
  • +
  • Add support for Bulk 1.0 operations of “create”, “update”, “upsert”, “delete” and “hardDelete”
  • +
  • Bulk 2.0 operations, by default, now return a single tbl_df containing all of the successful records, error records, and unprocessed records
  • +
  • Created internal functions that explicity call each API for an operation. For example, sf_create() routes into sf_create_soap(), sf_create_rest(), and sf_bulk_operation().

@@ -183,9 +178,9 @@

  • Make the default file name for a cached token .httr-oauth-salesforcer so that it does not clash with other package token names
  • -
    +

    -Bug Fixes

    +Bug Fixes
    • sf_user_info() returning argument is of length zero because token is not automatically refreshed before calling GET

    • sf_token() ignoring basic auth’ed sessions since it was only looking for a token using token_avaiable(). Replace with sf_auth_check() so now it considers a session or a token to be “available” (#1).

    • diff --git a/docs/README.html b/docs/README.html index 037e148e..10f0018a 100644 --- a/docs/README.html +++ b/docs/README.html @@ -132,11 +132,12 @@

      salesforcer

      Build Status AppVeyor Build Status CRAN_Status_Badge Coverage Status

      -

      salesforcer is an R package that connects to Salesforce Platform APIs using tidy principles. The package implements most actions from the SOAP, REST, Bulk, and Metadata APIs. Package features include:

      +

      salesforcer is an R package that connects to Salesforce Platform APIs using tidy principles. The package implements most actions from the SOAP, REST, Bulk 1.0, Bulk 2.0, and Metadata APIs. Package features include:

        -
      • OAuth 2.0 and Basic authentication methods (sf_auth())
      • -
      • CRUD (Create, Retrieve, Update, Delete) methods for records using the REST and Bulk APIs
      • -
      • Query records via REST and Bulk APIs (sf_query())
      • +
      • OAuth 2.0 (Single Sign On) and Basic (Username-Password) Authentication methods (sf_auth())
      • +
      • CRUD (Create, Retrieve, Update, Delete) methods for records using the SOAP, REST, and Bulk APIs
      • +
      • Query records via the SOAP, REST, and Bulk 1.0 APIs using sf_query() +
      • Retrieve and modify metadata (Custom Objects, Fields, etc.) using the Metadata API with:
        • @@ -227,8 +228,8 @@

          #> # A tibble: 2 x 2 #> id success #> <chr> <chr> -#> 1 0036A00000SnhBRQAZ true -#> 2 0036A00000SnhBSQAZ true

    +#> 1 0036A00000SnhbfQAB true +#> 2 0036A00000SnhbgQAB true

    @@ -247,8 +248,8 @@

    #> # A tibble: 2 x 4 #> Id Account FirstName LastName #> * <chr> <lgl> <chr> <chr> -#> 1 0036A00000SnhBRQAZ NA Test Contact-Create-1 -#> 2 0036A00000SnhBSQAZ NA Test Contact-Create-2

    +#> 1 0036A00000SnhbfQAB NA Test Contact-Create-1 +#> 2 0036A00000SnhbgQAB NA Test Contact-Create-2

    @@ -264,13 +265,14 @@

    #> # A tibble: 2 x 2 #> id success #> <chr> <chr> -#> 1 0036A00000SnhBRQAZ true -#> 2 0036A00000SnhBSQAZ true

    +#> 1 0036A00000SnhbfQAB true +#> 2 0036A00000SnhbgQAB true

    Bulk Operations

    -

    For really large operations (inserts, updates, upserts, deletes, and queries) Salesforce provides a Bulk API. In order to use the Bulk API in salesforcer you can just add api_type = "Bulk" to your functions and the operation will be executed using the Bulk API. It’s that simple. The benefits of using the Bulk API for larger datasets is that the operation will reduce the number of individual API calls (organization usually have a limit on total calls) and batching the requests in Bulk is usually quicker than running thousands of individuals calls when your data is large.

    +

    For really large operations (inserts, updates, upserts, deletes, and queries) Salesforce provides the Bulk 1.0 and Bulk 2.0 APIs. In order to use the Bulk APIs in salesforcer you can just add api_type = "Bulk 1.0" or api_type = "Bulk 2.0" to your functions and the operation will be executed using the Bulk APIs. It’s that simple.

    +

    The benefits of using the Bulk API for larger datasets is that the operation will reduce the number of individual API calls (organization usually have a limit on total calls) and batching the requests in bulk is usually quicker than running thousands of individuals calls when your data is large. Note: the Bulk 2.0 API does NOT guarantee the order of the data submitted is preserved in the output. This means that you must join on other data columns to match up the Ids that are returned in the output with the data you submitted. For this reason, Bulk 2.0 may not be a good solution for creating, updating, or upserting records where you need to keep track of the created Ids. The Bulk 2.0 API would be fine for deleting records where you only need to know which Ids were successfully deleted.

    # create contacts using the Bulk API
     n <- 2
     new_contacts <- tibble(FirstName = rep("Test", n),
    @@ -401,7 +403,7 @@ 

    More Information

    Salesforce provides client libraries and examples in many programming langauges (Java, Python, Ruby, and PhP) but unfortunately R is not a supported language. However, most all operations supported by the Salesforce APIs are available via this package. This package makes requests best formatted to match what the APIs require as input. This articulation is not perfect and continued progress will be made to add and improve functionality. For details on formatting, attributes, and methods please refer to Salesforce’s documentation as they are explained better there.

    More information is also available on the pkgdown site at https://StevenMMortimer.github.io/salesforcer.

    -

    Top

    +

    Top


    Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

    diff --git a/docs/articles/getting-started.html b/docs/articles/getting-started.html index 538f91d9..af13eefe 100644 --- a/docs/articles/getting-started.html +++ b/docs/articles/getting-started.html @@ -135,8 +135,8 @@

    #> # A tibble: 2 x 2 #> id success #> <chr> <chr> -#> 1 0036A00000SnhCyQAJ true -#> 2 0036A00000SnhCzQAJ true

    +#> 1 0036A00000SnhcYQAR true +#> 2 0036A00000SnhcZQAR true

    @@ -149,8 +149,8 @@

    #> # A tibble: 2 x 3 #> Id FirstName LastName #> <chr> <chr> <chr> -#> 1 0036A00000SnhCyQAJ Test Contact-Create-1 -#> 2 0036A00000SnhCzQAJ Test Contact-Create-2

    +#> 1 0036A00000SnhcYQAR Test Contact-Create-1 +#> 2 0036A00000SnhcZQAR Test Contact-Create-2

    @@ -169,8 +169,8 @@

    #> # A tibble: 2 x 4 #> Id Account FirstName LastName #> * <chr> <lgl> <chr> <chr> -#> 1 0036A00000SnhCyQAJ NA Test Contact-Create-1 -#> 2 0036A00000SnhCzQAJ NA Test Contact-Create-2

    +#> 1 0036A00000SnhcYQAR NA Test Contact-Create-1 +#> 2 0036A00000SnhcZQAR NA Test Contact-Create-2

    @@ -186,8 +186,8 @@

    #> # A tibble: 2 x 2 #> id success #> <chr> <chr> -#> 1 0036A00000SnhCyQAJ true -#> 2 0036A00000SnhCzQAJ true

    +#> 1 0036A00000SnhcYQAR true +#> 2 0036A00000SnhcZQAR true

    @@ -198,8 +198,8 @@

    #> # A tibble: 2 x 3 #> id success errors #> <chr> <lgl> <list> -#> 1 0036A00000SnhCyQAJ TRUE <list [0]> -#> 2 0036A00000SnhCzQAJ TRUE <list [0]>

    +#> 1 0036A00000SnhcYQAR TRUE <list [0]> +#> 2 0036A00000SnhcZQAR TRUE <list [0]>

    @@ -226,9 +226,9 @@

    #> # A tibble: 3 x 3 #> created id success #> <chr> <chr> <chr> -#> 1 false 0036A00000SnhDDQAZ true -#> 2 false 0036A00000SnhDEQAZ true -#> 3 true 0036A00000SnhDNQAZ true

    +#> 1 false 0036A00000SnhciQAB true +#> 2 false 0036A00000SnhcjQAB true +#> 3 true 0036A00000SnhcnQAB true

    diff --git a/docs/articles/index.html b/docs/articles/index.html index d9d6521b..d8de5e75 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -122,7 +122,7 @@
    diff --git a/docs/articles/transitioning-from-RForcecom.html b/docs/articles/transitioning-from-RForcecom.html index fb430f5a..5e0f0556 100644 --- a/docs/articles/transitioning-from-RForcecom.html +++ b/docs/articles/transitioning-from-RForcecom.html @@ -142,13 +142,13 @@

    result1 <- RForcecom::rforcecom.create(session, objectName=object, fields) result1 #> id success -#> 1 0036A00000SnhDSQAZ true +#> 1 0036A00000SnhcsQAB true # replicated in salesforcer package result2 <- salesforcer::rforcecom.create(session, objectName=object, fields) result2 #> id success -#> 1 0036A00000SnhDXQAZ true

    +#> 1 0036A00000SnhcxQAB true

    Here is an example showing the reduction in code of using salesforcer if you would like to create multiple records.

    n <- 2
     new_contacts <- tibble(FirstName = rep("Test", n),
    @@ -164,8 +164,8 @@ 

    } rforcecom_results #> id success -#> 1 0036A00000SnhDcQAJ true -#> 2 0036A00000SnhDhQAJ true +#> 1 0036A00000Snhd2QAB true +#> 2 0036A00000Snhd7QAB true # the better way in salesforcer to do multiple records salesforcer_results <- sf_create(new_contacts, object_name="Contact") @@ -173,8 +173,8 @@

    #> # A tibble: 2 x 2 #> id success #> <chr> <chr> -#> 1 0036A00000SnhDmQAJ true -#> 2 0036A00000SnhDnQAJ true

    +#> 1 0036A00000SnhdCQAR true +#> 2 0036A00000SnhdDQAR true

    diff --git a/docs/articles/working-with-bulk-api.html b/docs/articles/working-with-bulk-api.html index 731228d2..4f2797ff 100644 --- a/docs/articles/working-with-bulk-api.html +++ b/docs/articles/working-with-bulk-api.html @@ -122,16 +122,16 @@

    #> # A tibble: 2 x 3 #> id success errors #> <chr> <lgl> <list> -#> 1 0036A00000SnhDrQAJ TRUE <list [0]> -#> 2 0036A00000SnhDsQAJ TRUE <list [0]> +#> 1 0036A00000SnhdHQAR TRUE <list [0]> +#> 2 0036A00000SnhdIQAR TRUE <list [0]> # Bulk bulk_created_records <- sf_create(new_contacts, object_name="Contact", api_type="Bulk 1.0") bulk_created_records #> # A tibble: 2 x 4 #> Id Success Created Error #> <chr> <chr> <chr> <lgl> -#> 1 0036A00000SnhDwQAJ true true NA -#> 2 0036A00000SnhDxQAJ true true NA

    +#> 1 0036A00000SnhdMQAR true true NA +#> 2 0036A00000SnhdNQAR true true NA

    There are some differences in the way each API returns response information; however, the end result is exactly the same for these two calls. Also, note that this package utilizes the Bulk 2.0 API for most bulk calls except for bulk queries since Salesforce has not yet implemented it in 2.0.

    Here is a simple workflow of adding, querying, and deleting records using the Bulk API.

    # just add api_type="Bulk" to most calls!
    @@ -145,8 +145,8 @@ 

    #> # A tibble: 2 x 4 #> Id Success Created Error #> <chr> <chr> <chr> <lgl> -#> 1 0036A00000SnhDyQAJ true true NA -#> 2 0036A00000SnhDzQAJ true true NA +#> 1 0036A00000SnhdWQAR true true NA +#> 2 0036A00000SnhdXQAR true true NA # query bulk my_soql <- sprintf("SELECT Id, @@ -161,8 +161,8 @@

    #> # A tibble: 2 x 3 #> Id FirstName LastName #> <chr> <chr> <chr> -#> 1 0036A00000SnhDyQAJ Test Contact-Create-1 -#> 2 0036A00000SnhDzQAJ Test Contact-Create-2 +#> 1 0036A00000SnhdWQAR Test Contact-Create-1 +#> 2 0036A00000SnhdXQAR Test Contact-Create-2 # delete bulk deleted_records <- sf_delete(queried_records$Id, object_name=object, api_type="Bulk 1.0") @@ -170,8 +170,8 @@

    #> # A tibble: 2 x 4 #> Id Success Created Error #> <chr> <chr> <chr> <lgl> -#> 1 0036A00000SnhDyQAJ true false NA -#> 2 0036A00000SnhDzQAJ true false NA

    +#> 1 0036A00000SnhdWQAR true false NA +#> 2 0036A00000SnhdXQAR true false NA diff --git a/docs/cran-comments.html b/docs/cran-comments.html index 09a77a84..0e4fe178 100644 --- a/docs/cran-comments.html +++ b/docs/cran-comments.html @@ -144,7 +144,7 @@

    • checking CRAN incoming feasibility … NOTE
    -

    Possibly mis-spelled words in DESCRIPTION: APIs (2:42, 5:61) JSON (8:19) tibbles (8:54)

    +

    Possibly mis-spelled words in DESCRIPTION: APIs (2:42, 5:61) JSON (8:19)

    diff --git a/docs/index.html b/docs/index.html index 399313fa..6e8a633f 100644 --- a/docs/index.html +++ b/docs/index.html @@ -11,10 +11,10 @@ @@ -108,11 +108,12 @@


    -

    salesforcer is an R package that connects to Salesforce Platform APIs using tidy principles. The package implements most actions from the SOAP, REST, Bulk, and Metadata APIs. Package features include:

    +

    salesforcer is an R package that connects to Salesforce Platform APIs using tidy principles. The package implements most actions from the SOAP, REST, Bulk 1.0, Bulk 2.0, and Metadata APIs. Package features include:

      -
    • OAuth 2.0 and Basic authentication methods (sf_auth())
    • -
    • CRUD (Create, Retrieve, Update, Delete) methods for records using the REST and Bulk APIs
    • -
    • Query records via REST and Bulk APIs (sf_query())
    • +
    • OAuth 2.0 (Single Sign On) and Basic (Username-Password) Authentication methods (sf_auth())
    • +
    • CRUD (Create, Retrieve, Update, Delete) methods for records using the SOAP, REST, and Bulk APIs
    • +
    • Query records via the SOAP, REST, and Bulk 1.0 APIs using sf_query() +
    • Retrieve and modify metadata (Custom Objects, Fields, etc.) using the Metadata API with:
      • @@ -203,8 +204,8 @@

        #> # A tibble: 2 x 2 #> id success #> <chr> <chr> -#> 1 0036A00000SnhCUQAZ true -#> 2 0036A00000SnhCVQAZ true

    +#> 1 0036A00000Snhc4QAB true +#> 2 0036A00000Snhc5QAB true

    @@ -223,8 +224,8 @@

    #> # A tibble: 2 x 4 #> Id Account FirstName LastName #> * <chr> <lgl> <chr> <chr> -#> 1 0036A00000SnhCUQAZ NA Test Contact-Create-1 -#> 2 0036A00000SnhCVQAZ NA Test Contact-Create-2

    +#> 1 0036A00000Snhc4QAB NA Test Contact-Create-1 +#> 2 0036A00000Snhc5QAB NA Test Contact-Create-2

    @@ -240,13 +241,14 @@

    #> # A tibble: 2 x 2 #> id success #> <chr> <chr> -#> 1 0036A00000SnhCUQAZ true -#> 2 0036A00000SnhCVQAZ true

    +#> 1 0036A00000Snhc4QAB true +#> 2 0036A00000Snhc5QAB true

    Bulk Operations

    -

    For really large operations (inserts, updates, upserts, deletes, and queries) Salesforce provides a Bulk API. In order to use the Bulk API in salesforcer you can just add api_type = "Bulk" to your functions and the operation will be executed using the Bulk API. It’s that simple. The benefits of using the Bulk API for larger datasets is that the operation will reduce the number of individual API calls (organization usually have a limit on total calls) and batching the requests in Bulk is usually quicker than running thousands of individuals calls when your data is large.

    +

    For really large operations (inserts, updates, upserts, deletes, and queries) Salesforce provides the Bulk 1.0 and Bulk 2.0 APIs. In order to use the Bulk APIs in salesforcer you can just add api_type = "Bulk 1.0" or api_type = "Bulk 2.0" to your functions and the operation will be executed using the Bulk APIs. It’s that simple.

    +

    The benefits of using the Bulk API for larger datasets is that the operation will reduce the number of individual API calls (organization usually have a limit on total calls) and batching the requests in bulk is usually quicker than running thousands of individuals calls when your data is large. Note: the Bulk 2.0 API does NOT guarantee the order of the data submitted is preserved in the output. This means that you must join on other data columns to match up the Ids that are returned in the output with the data you submitted. For this reason, Bulk 2.0 may not be a good solution for creating, updating, or upserting records where you need to keep track of the created Ids. The Bulk 2.0 API would be fine for deleting records where you only need to know which Ids were successfully deleted.

    # create contacts using the Bulk API
     n <- 2
     new_contacts <- tibble(FirstName = rep("Test", n),
    diff --git a/docs/news/index.html b/docs/news/index.html
    index cd0b5545..c483248c 100644
    --- a/docs/news/index.html
    +++ b/docs/news/index.html
    @@ -129,21 +129,16 @@ 

    Change log All releases

    -
    +

    -salesforcer 0.1.1.9000

    +salesforcer 0.1.2

    Features

      -
    • Nothing Yet!
    • -
    -
    -
    -

    -Bug Fixes

    -
      -
    • Nothing Yet!
    • +
    • Add support for Bulk 1.0 operations of “create”, “update”, “upsert”, “delete” and “hardDelete”
    • +
    • Bulk 2.0 operations, by default, now return a single tbl_df containing all of the successful records, error records, and unprocessed records
    • +
    • Created internal functions that explicity call each API for an operation. For example, sf_create() routes into sf_create_soap(), sf_create_rest(), and sf_bulk_operation().

    @@ -184,9 +179,9 @@

  • Make the default file name for a cached token .httr-oauth-salesforcer so that it does not clash with other package token names
  • -
    +

    -Bug Fixes

    +Bug Fixes

    • sf_user_info() returning argument is of length zero because token is not automatically refreshed before calling GET

    • sf_token() ignoring basic auth’ed sessions since it was only looking for a token using token_avaiable(). Replace with sf_auth_check() so now it considers a session or a token to be “available” (#1).

    • @@ -245,7 +240,7 @@

      Contents

      diff --git a/docs/reference/index.html b/docs/reference/index.html index 451f614c..d45525ef 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -126,7 +126,7 @@ diff --git a/index.Rmd b/index.Rmd index 74fd9af8..cc6a1c38 100644 --- a/index.Rmd +++ b/index.Rmd @@ -21,12 +21,12 @@ knitr::opts_chunk$set( **salesforcer** is an R package that connects to Salesforce Platform APIs using -tidy principles. The package implements most actions from the SOAP, REST, Bulk, -and Metadata APIs. Package features include: +tidy principles. The package implements most actions from the SOAP, REST, Bulk 1.0, +Bulk 2.0, and Metadata APIs. Package features include: - * OAuth 2.0 and Basic authentication methods (`sf_auth()`) - * CRUD (Create, Retrieve, Update, Delete) methods for records using the REST and Bulk APIs - * Query records via REST and Bulk APIs (`sf_query()`) + * OAuth 2.0 (Single Sign On) and Basic (Username-Password) Authentication methods (`sf_auth()`) + * CRUD (Create, Retrieve, Update, Delete) methods for records using the SOAP, REST, and Bulk APIs + * Query records via the SOAP, REST, and Bulk 1.0 APIs using `sf_query()` * Retrieve and modify metadata (Custom Objects, Fields, etc.) using the Metadata API with: * `sf_describe_objects()`, `sf_create_metadata()`, `sf_update_metadata()` * Utilize backwards compatible functions for the **RForcecom** package, such as: @@ -168,12 +168,22 @@ deleted_records ### Bulk Operations For really large operations (inserts, updates, upserts, deletes, and queries) Salesforce -provides a [Bulk API](https://developer.salesforce.com/docs/atlas.en-us.api_asynch.meta/api_asynch/asynch_api_intro.htm). In order to use the Bulk API in **salesforcer** you can just add -`api_type = "Bulk"` to your functions and the operation will be executed using the Bulk API. -It's that simple. The benefits of using the Bulk API for larger datasets is that +provides the [Bulk 1.0](https://developer.salesforce.com/docs/atlas.en-us.api_asynch.meta/api_asynch/asynch_api_intro.htm) +and [Bulk 2.0](https://developer.salesforce.com/docs/atlas.en-us.api_bulk_v2.meta/api_bulk_v2/introduction_bulk_api_2.htm) +APIs. In order to use the Bulk APIs in **salesforcer** you can just add `api_type = "Bulk 1.0"` +or `api_type = "Bulk 2.0"` to your functions and the operation will be executed using the Bulk APIs. +It's that simple. + +The benefits of using the Bulk API for larger datasets is that the operation will reduce the number of individual API calls (organization usually -have a limit on total calls) and batching the requests in Bulk is usually quicker -than running thousands of individuals calls when your data is large. +have a limit on total calls) and batching the requests in bulk is usually quicker +than running thousands of individuals calls when your data is large. **Note:** the +Bulk 2.0 API does **NOT** guarantee the order of the data submitted is preserved in +the output. This means that you must join on other data columns to match up the Ids that +are returned in the output with the data you submitted. For this reason, Bulk 2.0 may not +be a good solution for creating, updating, or upserting records where you need to keep +track of the created Ids. The Bulk 2.0 API would be fine for deleting records where +you only need to know which Ids were successfully deleted. ```{r} # create contacts using the Bulk API