Using the Batch API

The Batch API is most efficient if you have a a large number of leads to score at a given time. Essentially you construct a CSV of all the leads you want to score and POST it as the body to the following URL:

POST https://api.infer.com/api/v1/formula/<formula_id>/batched

For example, if we want to score these leads:

phone,company,state_province,full_name,email,zip_postal_code,industry
1231231231,Infer,CA,Chung Wu,chungwu@infer.com,,
485-787-6512,acme,NY,John Tops,john@acme.com,,Media
,GroundUp,CA,Joyce,joyce@groundup.com,,Collaboration

Then the POST content is simply the above posted as binary data.

Since the POST content is not form data, please set the Content-Type header to application/octet-stream:

Content-Type: application/octet-stream

Once the leads are saved to a CSV (say leads.csv) then you can post like so:

curl "https://api.infer.com/api/v1/formula/<formula_id>/batched" \
-u <auth_key>:X \
--data-binary "@leads.csv" \
--header "Content-Type: application/octet-stream"

If you have a lot of data you can gzip the CSV content in order to significantly reduce the request size. If you so so, be sure to set the Content-Encoding header:

Content-Encoding: gzip

And an example curl command would be:

curl "https://api.infer.com/api/v1/formula/<formula_id>/batched" \
-u <auth_key>:X \
--data-binary "@leads.csv.gz" \
--header "Content-Type: application/octet-stream" \
--header "Content-Encoding: gzip"

Please try not to send more than 1000 companies per batch call, to avoid excessively long HTTP connections.
 

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

Powered by Zendesk