8.1.11.2. Batch processing

By default closing batch will not be successful while inner files are still being processed, and expecting client to keep retrying to close batch again later.

Client can switch from this polling to webhooks mode by setting callbackurl header mentioned in 8.1.4.4. Close Batch . When configured properly on batch closing request, Core will:

  • Monitor all inner files until they are all done

  • Close that batch,

  • Proactively notify back to client's designated URL with a full batch result.

By doing so, REST client will use batch closing API just to confirm that all inner files submitted successfully tied to that batch. REST Client will no longer be required to wait for all inner files to finish the analysis in order to close the batch.

MetaDefender Core will take care of the rest and will notify client (via callbackurl) when batch is closed and the analysis for the entire batch is available to client.

URL

/file/batch/<batch_id>/close/callback

Method

POST

Header

Type

Required

Description

apikey

string

No

User's session id, if it was set for creation it is required

callbackurl

string ( <protocol://><ip | domain>:<port></path>)

Yes

Client's URL where MetaDefender Core will notify batch result back to whenever batch is closed successfully (webhooks model). See details at 8.1.11.2. Batch processing

For example: http://10.0.1.100:8081/callback

Result Code

Description

200

Callback URL is set successfully

400

Bad request, (e.g.: wrong header values, batch is already closed, invalid API key)

403

Access denied

404

Batch not found

500

Internal server error

Successful response

HTTP status code: 200

{
"<batch_id>": "Callback url set"
}

Error response

Callback URL is invalid

HTTP status code: 400

{
"err": "Callback url is invalid."
}

Callback URL is missed

HTTP status code: 403

{
"err": "No callback url given."
}

When batch is closed successfully on Core, a batch result will be automatically sent to URL address which pre-configured via callbackurl header. See more about batch result example at 8.1.4.4. Close Batch