ASM Export JSON - size Limit ?

Hello,
I’m trying to export an ASM Policy in json format through API

I’m using theses Steps:
- Start the export:

https://{hostname}/mgmt/tm/asm/tasks/export-policy

{
“format”: “json”,

“filename”: “exported_file.json”,

“minimal”: true,

“policyReference”: {

“link”: “https://localhost/mgmt/tm/asm/policies/{policyID}”

}

}

- Waiting for the export to end

- Download The export
https://{hostname}//mgmt/tm/asm/file-transfer/downloads/exported_file.json

The downloaded file is imcomplete, truncated and not usable if I try to import it 
Not sure if it the cause but the size of the file is 1Mo

While if I export it manually through GUI it’s 1,3Mo sized 
Also I’ve already modified the max_json_policy_size to 5Mo in the
Security  ››  Options : Application Security : Advanced Configuration : System Variables
Because I had issues when importing the same policie.

Is there some kind of limit for export ?

Hi IVD,

I found two previous threads about it.

They wrote that the file download size limit is 1024kb, and it can be solved using content-range.

API Calls to F5 limited to 1024 KB download | DevCentral

Error code 400 while downloading a file via REST API | DevCentral

Hello Thanks for you reply,
I ended up at the same conclusion,
F5 Bigip API cannot manage large file and
I needs to upload or download file in 1024kb chunks parts.

Haven’t find how to do it with ansible,
so  I did it in shellwith:

url= “https://{{ inventory_hostname }}/mgmt/tm/asm/file-transfer/downloads/{{ export_filename }}”
    output=“{{ export_filename }}”
    taille={{ task_status.json.result.fileSize }}
    chunk=1048576
    debut=0
    fin=1048575
    while [ $debut -lt $taille ]; do
      if [ $fin -ge $taille ]; then
        fin=$(($taille - 1))
      fi
      curl -s -H “Content-Range: $debut-$fin/$chunk” -o /tmp/partie_$debut -H “Content-Type: application/json” -H “X-F5-Auth-Token: {{ extracted_auth_token }}” $url
      debut=$(($debut + $chunk))
      fin=$(($fin + $chunk))
    done
    cat /tmp/partie_* > {{ dest_dir }}/{{ export_filename }}

if someone else have a better way to do it, I’m interrested…