1

如何使用 databasedotcom gem 通过批量 api 在单个 api 调用中添加多条记录?现在我使用正常的 activerecord 类型方法插入每条记录需要一个 api 调用

4

4 回答 4

5

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/

于 2012-02-15T13:56:32.277 回答
1

你可以看看rforce gem。是插入多条记录的示例。

于 2012-02-21T12:25:33.813 回答
0

我刚刚遇到了用于批量 API 调用的 salesforce_bulk gem。这是一篇关于如何使用它的文章: http ://wiki.developerforce.com/page/Accessing_Salesforce_Data_From_Ruby

于 2012-04-12T02:16:49.900 回答
0

从 SFDC 获取记录。

  1. rails generate scaffold_controller Account Name:String

  2. 宝石文件
    gem "databasedotcom"
    gem "databasedotcom-rails"

  3. 创建数据库dotcom.yml
    //Create remote access in SFDC
    client_id:
    client_secret:
    username:
    password:
    host: login.salesforce.com debugging: true  version: 25.0

  4. 删除 public/index.html

  5. 路线.rb
    root :to "accounts#index"
    resources :accounts

  6. 控制器/accounts_controller.rb include Databasedotcom::Rails::Controller

    更改"account.destroy""account.delete"

    create @account['OwnerId'] = '00590000000pQOL'(必填项目)

  7. .error在 views/_form.html.erb 中删除

于 2012-09-02T05:45:22.863 回答