Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
12a4b73
Add param to apexrest to allow to set REST headers.
chexxor Mar 19, 2012
5eb681a
Change paramMap order in parameters and method name in error callback.
chexxor Mar 21, 2012
5a4f31b
UPDATE: add in a queryMore function to the forcetk to allow simpler h…
paulroth3d May 10, 2012
26285e4
Fix the whitespacing to be more inline with the rest of the forcetk t…
paulroth3d May 10, 2012
e83eb32
cleanup: also adjust the whitespacing in the doc comments.
paulroth3d May 10, 2012
329cde4
also remove tabs on the initial doc comment
paulroth3d May 10, 2012
13d11f1
Added mobile version of RemoteTK demo
Oct 15, 2012
3abd646
Use escape:false option rather than unescaping remote action result
Oct 15, 2012
b7c8f65
Clarify readme
Oct 15, 2012
6514b30
Merge pull request #16 from paulroth3d/master
Nov 9, 2012
75c6fbf
Merge pull request #15 from chexxor/master
Nov 9, 2012
b187b60
Check http-prefixed content-* headers
cwarden Nov 16, 2012
fd049d8
Add support for SOAP API
cwarden Nov 16, 2012
3d99e4b
Corrected search query param. Fixes #21
Nov 26, 2012
6f9efca
Merge branch 'master' of github-sfdc:developerforce/Force.com-JavaScr…
Nov 26, 2012
4954955
Add support for cloudforce.com instances
cwarden Jan 8, 2013
c2bd05f
Support RemoteTK within a namespace
cwarden Jan 10, 2013
a116718
Improve compatiblity of RemoteTK with ForceTK
cwarden Jan 10, 2013
7c8bcda
Improve field-type support in create calls
cwarden Jan 10, 2013
e30e637
Added support for custom domains
Mar 5, 2013
74b2cdd
Merge pull request #28 from jpearson-sfdc/master
Mar 5, 2013
c943383
Added JQuery deferred objects support. Updating to return promises
Mar 11, 2013
df6db59
Merge pull request #19 from cwarden/soap-support
Mar 13, 2013
d587eaf
Merged cwarden's change for http-prefixed content-* headers
Mar 13, 2013
e23a6ef
Merge pull request #23 from cwarden/cloudforce-support
Mar 13, 2013
5548cf8
Merge pull request #24 from cwarden/field-type-support
Mar 13, 2013
35397b1
Merge pull request #25 from cwarden/remotetk-forcetk-compatibility
Mar 13, 2013
7b2c9b3
Merge pull request #26 from cwarden/managed-package-support
Mar 13, 2013
a3aaa85
Merge pull request #29 from vrp-nikita-yaroshevich/master
Mar 13, 2013
99242ec
Added upsert
Mar 13, 2013
eb51ef3
Added tests for RemoteTKController.cls
Mar 21, 2013
971566b
fix arguments check in client.retrieve
rajaraodv Mar 29, 2013
be5cdd4
Accept String or correctly typed arguments in create, update, upsert.…
Apr 17, 2013
d2cbdce
Merge branch 'master' of github-sfdc:developerforce/Force.com-JavaScr…
Apr 17, 2013
bed85b4
dont send contentType for DELETE and update version to v27
rajaraodv Apr 29, 2013
ff4319f
Deleted leftover diff file
Sep 19, 2013
5610b9b
Include picklistValues in describe result
cwarden Apr 20, 2014
663af70
Merge pull request #50 from cwarden/describe-picklistValues
Apr 22, 2014
875df78
Fix typo in comment, code formatting, return type consistency
pomu0325 Dec 11, 2014
8108246
Merge pull request #59 from pomu0325/patch-1
Dec 11, 2014
3ceda4c
Remove RemoteTK, don't use proxy with REST API in Visualforce, add cr…
Dec 11, 2014
4ab6f9c
Merge changes
Dec 11, 2014
e530106
Update forcetk.js to support Windows8 in phonegap
hdramos Jan 9, 2015
5bd5ff1
Merge pull request #61 from hdramos/master
Jan 9, 2015
728e6aa
jQuery-ized blob sample
Jan 16, 2015
09f0f33
Merge branch 'master' of github-sfdc:developerforce/Force.com-JavaScr…
Jan 16, 2015
5896993
First cut of BulkTK
Mar 9, 2015
8f8620c
More detail in BulkTK readme
Mar 9, 2015
2349e0a
Added jxon.js
Mar 9, 2015
c3edd29
Dependencies, fix proxying in Visualforce
Mar 9, 2015
254b010
Updated to Cordova 4.3.0
Apr 1, 2015
42abd3d
Updated jQuery Mobile to latest
Apr 1, 2015
224c054
Updated README for Cordova 4.3.0, made sample filename more explicit.
Apr 1, 2015
54e9265
Fixed path to cordova-ios.html
Apr 1, 2015
0dcaf13
Return null from blob() for async calls - fixes #65
May 26, 2015
f177720
Accept JSON from API
May 28, 2015
b8c759e
Revert "Accept JSON from API"
May 28, 2015
fcbb8a7
Accept JSON from API. Fixes #65
May 28, 2015
21e7ab9
Replaced escape(soql) and escape(sosl)
mr-menno Jul 10, 2015
f766bb0
Merge pull request #69 from mennova/master
Jul 10, 2015
f13596c
removing extra new line that would corrupt ms office file attachments
seanpat09 Oct 2, 2015
f05d17c
adding content type for attachments for IE 11 support
seanpat09 Oct 2, 2015
fb34741
Fixed typo in filename parameter. Fixes #74
Oct 6, 2015
482d5b7
Merge branch 'master' of github-sfdc:developerforce/Force.com-JavaScr…
Oct 6, 2015
217010d
Merge pull request #72 from seanpat09/msOfficeFiles
Oct 7, 2015
1a25f90
Merge pull request #73 from seanpat09/IEContentType
Oct 7, 2015
e12fc02
Fixed all JSLint errors/warnings. Fixes #75
Oct 14, 2015
bef9edb
Merged changes
Oct 14, 2015
0c73636
Handle apexrest payloads correctly. Fixes #49
Oct 26, 2015
cf2e4e4
Updated/Added CODEOWNERS with ECCN
svc-scm Oct 12, 2021
52ab8a5
adding oss info files
Oct 14, 2022
688a615
Merge pull request #101 from developerforce/add-oss-matter
Oct 14, 2022
01974a1
Update README.markdown
pozil Jan 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.DS_Store
5 changes: 5 additions & 0 deletions BulkAPISampleFiles/delete.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Id
003E000001DJOfxIAH
003E000001DJOfyIAH
003E000001DJOV4IAP
003E000001DJOV5IAP
16 changes: 16 additions & 0 deletions BulkAPISampleFiles/delete.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Contact records -->
<sObjects xmlns="http://www.force.com/2009/06/asyncapi/dataload">
<sObject>
<Id>003E000001DJOfxIAH</Id>
</sObject>
<sObject>
<Id>003E000001DJOfyIAH</Id>
</sObject>
<sObject>
<Id>003E000001DJOV4IAP</Id>
</sObject>
<sObject>
<Id>003E000001DJOV5IAP</Id>
</sObject>
</sObjects>
3 changes: 3 additions & 0 deletions BulkAPISampleFiles/insert.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FirstName,LastName,Department,Birthdate,Description
Tom,Jones,Marketing,1940-06-07Z,"Self-described as ""the top"" branding guru on the West Coast"
Ian,Dury,R&D,,"World-renowned expert in fuzzy logic design. Influential in technology purchases."
17 changes: 17 additions & 0 deletions BulkAPISampleFiles/insert.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Contact records -->
<sObjects xmlns="http://www.force.com/2009/06/asyncapi/dataload">
<sObject>
<FirstName>Tom</FirstName>
<LastName>Jones</LastName>
<Department>Marketing</Department>
<Birthdate>1940-06-07Z</Birthdate>
<Description>Self-described as "the top" branding guru on the West Coast</Description>
</sObject>
<sObject>
<FirstName>Ian</FirstName>
<LastName>Dury</LastName>
<Department>R&amp;D</Department>
<Description>World-renowned expert in fuzzy logic design. Influential in technology purchases.</Description>
</sObject>
</sObjects>
2 changes: 2 additions & 0 deletions BulkAPISampleFiles/update.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Id,Title
003E000001CbzBi,Ninja
8 changes: 8 additions & 0 deletions BulkAPISampleFiles/update.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Contact records -->
<sObjects xmlns="http://www.force.com/2009/06/asyncapi/dataload">
<sObject>
<Id>003E000001CbzBi</Id>
<Title>Pirate</Title>
</sObject>
</sObjects>
2 changes: 2 additions & 0 deletions BulkAPISampleFiles/upsert.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Twitter_Handle__c,Title
pattest7,Guru
8 changes: 8 additions & 0 deletions BulkAPISampleFiles/upsert.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Contact records -->
<sObjects xmlns="http://www.force.com/2009/06/asyncapi/dataload">
<sObject>
<Twitter_Handle__c>pattest7</Twitter_Handle__c>
<Title>Pirate</Title>
</sObject>
</sObjects>
137 changes: 137 additions & 0 deletions BulkTK.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
BulkTK: Force.com Bulk API JavaScript Toolkit
=============================================

This minimal toolkit extends ForceTK to allow JavaScript in web pages to call the [Force.com Bulk API](https://www.salesforce.com/us/developer/docs/api_asynch/).

Background
==========

The Force.com Bulk API allows asynchronous data access. BulkTK extends ForceTK with methods to create Bulk API jobs, add batches to them, monitor job status and retrieve job results. Control plane XML is parsed to JavaScript objects for ease of use, while data is returned verbatim.

You should familiarize yourself with the [Force.com Bulk API documentation](https://www.salesforce.com/us/developer/docs/api_asynch/), since BulkTK is a relatively thin layer on the raw XML Bulk API.

[bulk.page](https://github.com/developerforce/Force.com-JavaScript-REST-Toolkit/blob/master/bulk.page) is a simple Visualforce single page application to demonstrate BulkTK. Try it out in a sandbox or developer edition.

Note that, just like ForceTK, BulkTK is unsupported and supplied as is. It is also currently in a very early stage of development. It appears to work well, but bugs cannot be ruled out, and the interface should not be considered stable.

Dependencies
============

* [jquery](http://jquery.com/)
* [ForceTK](https://github.com/developerforce/Force.com-JavaScript-REST-Toolkit)
* [jxon](https://github.com/developerforce/Force.com-JavaScript-REST-Toolkit/blob/master/jxon.js) (originally from the [Ratatosk](https://github.com/wireload/Ratatosk) project; this version preserves case in element and attribute names)

Example Usage
=============

This example focuses on Visualforce. See the [ForceTK documentation](https://github.com/developerforce/Force.com-JavaScript-REST-Toolkit) for details on authenticating from an external website, such as a Heroku app, or PhoneGap/Cordova.

First, include BulkTK and its dependencies:

<script src="{!$Resource.jquery}"></script>
<script src="{!$Resource.forcetk}"></script>
<script src="{!$Resource.jxon}"></script>
<script src="{!$Resource.bulkTK}"></script>

Now create a ForceTK client:

var client = new forcetk.Client();
client.setSessionToken('{!$Api.Session_ID}');

See the [ForceTK documentation](https://github.com/developerforce/Force.com-JavaScript-REST-Toolkit) for details on authenticating from an external website, such as a Heroku app, or PhoneGap/Cordova.

Create a job
------------

// See https://www.salesforce.com/us/developer/docs/api_asynch/Content/asynch_api_reference_jobinfo.htm
// for details of the JobInfo structure

// Insert Contact records in CSV format
var job = {
operation : 'insert',
object : 'Contact',
contentType : 'CSV'
};

client.createJob(job, function(response) {
jobId = response.jobInfo.id;
console.log('Job created with id '+jobId+'\n');
}, function(jqXHR, textStatus, errorThrown) {
console.log('Error creating job', jqXHR.responseText);
});

Add a batch of records to the job
---------------------------------

You can add multiple batches to the job; each batch can contain up to 10,000 records. See [batch size and limits](https://www.salesforce.com/us/developer/docs/api_asynch/Content/asynch_api_concepts_limits.htm#batch_size_title) for more details.

var csvData = "FirstName,LastName,Department,Birthdate,Description\n"+
"Tom,Jones,Marketing,1940-06-07Z,"Self-described as ""the top"" branding guru on the West Coast\n"+
"Ian,Dury,R&D,,"World-renowned expert in fuzzy logic design. Influential in technology purchases."\n";

client.addBatch(jobId, "text/csv; charset=UTF-8", csvData,
function(response){
console.log('Added batch '+response.batchInfo.id+'. State: '+response.batchInfo.state+'\n');
}, function(jqXHR, textStatus, errorThrown) {
console.log('Error adding batch', jqXHR.responseText);
});

See BulkAPISampleFiles for sample CSV and XML data for different operations.

Close the job
-------------

You must close the job to inform Salesforce that no more batches will be submitted for the job.

client.closeJob(jobId, function(response){
console.log('Job closed. State: '+response.jobInfo.state+'\n');
}, function(jqXHR, textStatus, errorThrown) {
console.log('Error closing job', jqXHR.responseText);
});

Check batch status
------------------

client.getBatchDetails(jobId, batchId, function(response){
console.log('Batch state: '+response.batchInfo.state+'\n');
}, function(jqXHR, textStatus, errorThrown) {
console.log('Error getting batch details', jqXHR.responseText);
});

Get batch results
-----------------

Pass `true` as the `parseXML` parameter to get batch results for a query, false otherwise.

client.getBatchResult(jobId, batchId, false, function(response){
console.log('Batch result: '+response);
}, function(jqXHR, textStatus, errorThrown) {
console.log('Error getting batch result', jqXHR.responseText);
});

Bulk query
----------

When adding a batch to a bulk query job, the `contentType` for the request must be either `text/csv` or `application/xml`, depending on the content type specified when the job was created. The actual SOQL statement supplied for the batch will be in plain text format.

var soql = 'SELECT Id, FirstName, LastName, Email FROM Contact';

client.addBatch(jobId, 'text/csv', soql, function(response){
console.log('Batch state: '+response.batchInfo.state+'\n');
}, function(jqXHR, textStatus, errorThrown) {
console.log('Error getting batch result', jqXHR.responseText);
});

Getting bulk query results is a two step process. Call `getBatchResult()` with `parseXML` set to `true` to get a set of result IDs, then call `getBulkQueryResult()` to get the actual records for each result

client.getBatchResult(jobId, batchId, true, function(response){
response['result-list'].result.forEach(function(resultId){
client.getBulkQueryResult(jobId, batchId, resultId, function(response){
console.log('Batch result: '+response);
}, function(jqXHR, textStatus, errorThrown) {
console.log('Error getting bulk query results', jqXHR.responseText);
});
});
}, function(jqXHR, textStatus, errorThrown) {
console.log('Error getting batch result', jqXHR.responseText);
});
2 changes: 2 additions & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Comment line immediately above ownership line is reserved for related gus information. Please be careful while editing.
#ECCN:Open Source
105 changes: 105 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
# Salesforce Open Source Community Code of Conduct

## About the Code of Conduct

Equality is a core value at Salesforce. We believe a diverse and inclusive
community fosters innovation and creativity, and are committed to building a
culture where everyone feels included.

Salesforce open-source projects are committed to providing a friendly, safe, and
welcoming environment for all, regardless of gender identity and expression,
sexual orientation, disability, physical appearance, body size, ethnicity, nationality,
race, age, religion, level of experience, education, socioeconomic status, or
other similar personal characteristics.

The goal of this code of conduct is to specify a baseline standard of behavior so
that people with different social values and communication styles can work
together effectively, productively, and respectfully in our open source community.
It also establishes a mechanism for reporting issues and resolving conflicts.

All questions and reports of abusive, harassing, or otherwise unacceptable behavior
in a Salesforce open-source project may be reported by contacting the Salesforce
Open Source Conduct Committee at [email protected].

## Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of gender
identity and expression, sexual orientation, disability, physical appearance,
body size, ethnicity, nationality, race, age, religion, level of experience, education,
socioeconomic status, or other similar personal characteristics.

## Our Standards

Examples of behavior that contributes to creating a positive environment
include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy toward other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Personal attacks, insulting/derogatory comments, or trolling
* Public or private harassment
* Publishing, or threatening to publish, others' private information—such as
a physical or electronic address—without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
* Advocating for or encouraging any of the above behaviors

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned with this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project email
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the Salesforce Open Source Conduct Committee
at [email protected]. All complaints will be reviewed and investigated
and will result in a response that is deemed necessary and appropriate to the
circumstances. The committee is obligated to maintain confidentiality with
regard to the reporter of an incident. Further details of specific enforcement
policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership and the Salesforce Open Source Conduct
Committee.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][contributor-covenant-home],
version 1.4, available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html.
It includes adaptions and additions from [Go Community Code of Conduct][golang-coc],
[CNCF Code of Conduct][cncf-coc], and [Microsoft Open Source Code of Conduct][microsoft-coc].

This Code of Conduct is licensed under the [Creative Commons Attribution 3.0 License][cc-by-3-us].

[contributor-covenant-home]: https://www.contributor-covenant.org (https://www.contributor-covenant.org/)
[golang-coc]: https://golang.org/conduct
[cncf-coc]: https://github.com/cncf/foundation/blob/master/code-of-conduct.md
[microsoft-coc]: https://opensource.microsoft.com/codeofconduct/
[cc-by-3-us]: https://creativecommons.org/licenses/by/3.0/us/
14 changes: 14 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
BSD 3-Clause License

Copyright (c) 2022 Salesforce, Inc.
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. Neither the name of Salesforce.com nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Loading