Automated Loading
This process can be automated, and a script follows to give an example of this automation. This script uses the Ruby gems scripting language but other languages could be used. This code or similar can be embedded in your daily process in order to automate the bulk load process.
Note: Single csv or xml files can also be loaded this way, and do not need to be zipped; the zip file performs the secondary purpose of grouping several files together when a group of files is to be loaded together.
Once only installation of ruby gems:
Download and install rubygems.
Run the following commands at a command prompt:
gem install rest-client
irb -rubygems
Script to be run daily:
#!/usr/bin/env ruby
require 'rubygems'
require 'rest_client'
# usage: ruby -w load_wf_csv.rb 'C:\Load Files\mydata.zip'
# these are configuration variables
@user = "MyOrg.Admin"
@pass = "MyPassword"
@domain = "workflow.vectorrisk.com"
@path = "dailyprocess.ashx"
@org = "MyOrg"
@env = "Test"
# dont change below
@url = "https://#@user:#@pass@#@domain/#@path"
@fpath = ARGV[0]
puts "Loading to #@url #@org.#@env"
RestClient.post(@url,
:q => 'bulkload', # only loading csv for now. could be 'bulkload' for xml
:e => "#@org.#@env",
:datafile => File.new(@fpath, "rb")
)
Note: The technical reference includes further information on this topic in the section Workflow Automation.