Submit Batch


Before diving into this advanced sample, we strongly recommend you review the Single File Scan example and get familiarized with its flow.

The following activity allows the user to submit multiple files for a scan in one call. In most cases, you will use this option in order to compare the files to one another (in addition to external sources).

See the flow diagram below:

Analyzing Steps

The first task is to get the Copyleaks authentication token. You will need to add this token later on to your API requests in order to verify your identity. This task is being done through the Login method. Once you have this token, you are ready to continue forward to the next step.

Now, a key-point that differentiates this flow from others, in order to compare the files also against each other, you should submit the files with properties.action: 1 (price-check). You should repeat this process for each one of the files in the same batch. Note that when you are submitting the files with properties.action: 1, the files will be price-checked first. So, you will get a Credit-Checked webhook sent to your server. Wait until all of the scans will complete the price-check status. At this point, you will be ready to start scanning all the files in the batch.

Trigger the scan of the batch done by calling the batch/start method. From this point, you should treat each process exactly like you would if it were a single file scan.