Gzip compression method reduces file size by identifying and replacing repeated sequences with shorter references.
Using GZIP compression
The API supports GZIP compressed files when doing a POST payment call to upload batches. To use GZIP compression, you should either:
- Set up the
Content-Encoding
header togzip
, or - Make sure that the file you want to upload has a
.gzip
extension.
Make sure to gzip the file before upload using the Gzip standard only, the API cannot perform this action.
For windows, external applications needs to be installed for gzip functionality.
For linux/mac you can use bash gzip command:
gzip $1 --best
Example for gzip file using the Java content:
public static byte[] gzipContent(String content) throws IOException {
if (content == null || content.isEmpty()) {
throw new IllegalArgumentException("Content cannot be null or empty");
}
try (ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
GZIPOutputStream gzipOutputStream = new GZIPOutputStream(byteArrayOutputStream)) {
gzipOutputStream.write(content.getBytes());
gzipOutputStream.finish();
return byteArrayOutputStream.toByteArray();
}
}
Only the XML file (e.g., PAIN.001) should be zipped. Exclude headers, signatures, or any other metadata from the gzip file.
Creating the Digest
The digest must be created from the gzip content and the metadata should be part of the digest. The digest calculation remains the same, now only the content must be Gzipped.
Use SHA-512 or SHA-256 for hashing, and base64 encode the resulting hash.
Content Encoding
To indicate to the API that the upload is a GZIP content, either the header Content-Encoding
must be set to gzip
or the file extension of the upload file must be set to .gzip
.
Header example Key -> value example:
“content-encoding” -> “gzip”
Zipping is mandatory for files containing more than 25,000 transactions. Zipping is also required when the file size exceeds 40MB.
Maximum Number of Transactions
The maximum number of transactions allowed in a single file is 100,000. For more details, refer to the Rabobank website [https://www.rabobank.nl/en/business/support/online-bankieren/formats].