ballerinax/sfdc.bulk Ballerina library

Deprecated3.0.1

Overview

Salesforce Bulk API is a specialized asynchronous RESTful API for loading and querying bulk of data at once. This module provides bulk data operations for CSV, JSON, and XML data types.

This module supports Salesforce Bulk API v1.

Prerequisites

Before using this connector in your Ballerina application, complete the following:

  1. Create Salesforce account
  2. Obtain tokens - Follow the steps listed under OAuth 2.0 Web Server Flow for Web App Integration.

Quickstart

To use the Salesforce connector in your Ballerina application, update the .bal file as follows:

Step 1: Import connector

Import the ballerinax/sfdc and ballerinax/sfdc.bulk modules into the Ballerina project.

Copy
import ballerinax/sfdc;
import ballerinax/sfdc.bulk;

Step 2: Create a new connector instance

Create a sfdc:ConnectionConfig with the OAuth2 tokens obtained, and initialize the connector with it.

Copy
fdc:ConnectionConfig sfConfig = {
  baseUrl: <"EP_URL">,
  clientConfig: {
    clientId: <"CLIENT_ID">,
    clientSecret: <"CLIENT_SECRET">,
    refreshToken: <"REFRESH_TOKEN">,
    refreshUrl: <"REFRESH_URL"> 
  }
;

ulk:Client bulkClient = new (sfConfig);

Step 3: Invoke connector operation

  1. Now you can use the operations available within the connector. Note that they are in the form of remote operations.
    Following is an example on how to insert bulk contacts using the connector.

    Copy
    json contacts = [
        {
            description: "Created_from_Ballerina_Sf_Bulk_API",
            FirstName: "Morne",
            LastName: "Morkel",
            Title: "Professor Grade 03",
            Phone: "0442226670",
            Email: "morne89@gmail.com"
        }
    ];
    
    public function main() returns error? {
        bulk:BulkJob insertJob = check bulkClient->createJob("insert", "Contact", "JSON");
    
        bulk:BatchInfo batch = check bulkClient->addBatch(insertJob, contacts);
    }
  2. Use bal run command to compile and run the Ballerina program.

You can find a list of samples here

Import

import ballerinax/sfdc.bulk;Copy

Metadata

Released date: over 2 years ago

Version: 3.0.1

License: Apache-2.0


Compatibility

Platform: java11

Ballerina version: slbeta3


Pull count

Total: 0

Current verison: 588


Weekly downloads


Source repository


Keywords

Sales & CRM/Customer Relationship Management

Cost/Freemium


Contributors

Other versions

See more...