Idea Melt

Focus Mode

Library

Batch Import

Description

This utility makes it really easy to import all your users into IdeaMelt. It's a simple JavaScript app that can be run anywhere and does everything using only the console and a csv file. Best of all, you can import multiple csv files and send requests simultaneously from a single page. Also, the utility does not interact with the DOM at all, it works completely in the console.

Scripts

Include the following script where you want to run the batch process

<script src="http://www.ideamelt.com/static/apps/3.0/im.batcher.js"></script>

NOTE: jQuery is dependency

STEP 1

Open up the console and initialize the utility with new

var foo = new batcher('API_KEY', 'LOGGING', 'CSV_URL')
API_KEY
string
Your IdeaMelt API key
LOGGING
boolean
Specify here if you'd like the utility to log progress. Regardless of what you set here, the utility will always log any rows that failed so that they can be diagnosed accordingly.
default false
CSV_URL
string
The url of the CSV you'd like to use

Once the csv has been loaded and converted to an array that can be used, the utility will log the following message in the console

batcher ready
STEP 2

After initialization, you need to specify the index for the three values needed. You can easily check the indexes with the function below. Any line number will do, the utility will simply print the index and values of all the data points in the specified row

foo.show(ROW_NUMBER)

Once you've confirmed the indexes for each of the values we need, you can specify it in the index object

foo.index.url = 0;
foo.index.title = 1;
foo.index.avatar = 2;
STEP 3

Now you can simply begin the batch process with

foo.create(START, LAST)
START
integer
Specify the row in your csv you'd like to start from
LAST
integer/string
Specify the row in your csv you'd like to end at. You can also set this value to "end" which will iterate through the csv all the way to the end.
NOTES

You'll notice that the utility automatically spaces out requests to prevent your browser from freezing. This timeout is set by default at 100ms. You can change this value very easily. We don't recommend setting this to 0.

foo.timeout = 100

You can always check the current progress of the upload by accessing certain variables.

foo.total // total number of requests that have been sent
foo.success // total number of requests that have succeeded
foo.fail // total number of requests that have failed