如何使用 databasedotcom gem 通过批量 api 在单个 api 调用中添加多条记录?现在我使用正常的 activerecord 类型方法插入每条记录需要一个 api 调用
4 回答
databasedotcom gem 不支持批量 API,因为它只是 SFDC REST API 的包装器 在此处查看:https ://github.com/heroku/databasedotcom/issues/50
你必须自己实现 Bulk API,我找不到任何 ruby gem 。这是参考http://www.salesforce.com/us/developer/docs/api_asynch/
我刚刚遇到了用于批量 API 调用的 salesforce_bulk gem。这是一篇关于如何使用它的文章: http ://wiki.developerforce.com/page/Accessing_Salesforce_Data_From_Ruby
从 SFDC 获取记录。
rails generate scaffold_controller Account Name:String
宝石文件
gem "databasedotcom"
gem "databasedotcom-rails"
创建数据库dotcom.yml
//Create remote access in SFDC
client_id:
client_secret:
username:
password:
host: login.salesforce.com debugging: true version: 25.0删除 public/index.html
路线.rb
root :to "accounts#index"
resources :accounts
控制器/accounts_controller.rb
include Databasedotcom::Rails::Controller
更改
"account.destroy"
为"account.delete"
create @account['OwnerId'] = '00590000000pQOL'
(必填项目).error
在 views/_form.html.erb 中删除