Skip to content
This repository has been archived by the owner on May 23, 2019. It is now read-only.

Bulk Submissions

Gabriel Iovino edited this page Nov 16, 2015 · 2 revisions

If you are using the API to submit over 50 records you will want to ensure you are not making 50 individual HTTP POSTs to the CIF server.

Use a list / array

Make sure you are submitting a single list/array of 50 records. Note that the server will not return the submission IDs until all the post processing is done, if you are submitting 10000 records it could take a few minutes to get a return from the server.

Python SDK Example:

from cifsdk.client import Client
import json

cli = Client(token='<token>',
             remote='https://localhost',
             no_verify_ssl=1)

# sample dict
d = {"observable":"1.1.1.1","tlp":"amber","confidence":"85","tags":"malware","provider":"me.com","group":"everyone"}                                                                                       

# build list of dicts
build = 0
data = []
while build < 10000:
    data.append(d)
    build += 1

# json'ify the list
json_data = json.dumps(data)

ret = cli.submit(json_data)
print(ret)

Use the nowait argument

Use the client argument nowait to tell the server to batch submissions on the server side.

Python SDK Example:

cli = Client(token='<token>',
             remote='https://localhost',
             no_verify_ssl=1
             nowait=True)

Reference:
Bottleneck sending events through HTTP API

Clone this wiki locally