Options

AxAPI Export or Download example?

I'm wanting to snag the fixed-nat port mapping file periodically and save it elsewhere, or in a database. I have managed to get the list of files, but I can't seem to figure out the export command.

Could someone by chance share an example of how this would be done?

In a perfect world i'd like to hit the API, get the file name, and download it from the same script. But if I have to scp/ftp it somewhere first that is fine as well.


Any help would be greatly appreciated!


Thanks!

Tagged:

Comments

  • Options
    tmitsuhatatmitsuhata Member, Administrator admin

    Hi brandonbelew,

    You can use export command with either cli or aXAPI to upload the fixed-nat port-mapping-file(s) to scp/ftp server.

    [CLI] vThunder#export fixed-nat <file name> use-mgmt-port scp://user:pass@server-ip/directory/

    With aXAPI, you can do something like this.

    • Get port-mapping-file names using /axapi/v3/cgnv6/fixed-nat/port-mapping-files/oper
    [aXAPI example]
    curl -X GET "https://your-thunder-ip/axapi/v3/cgnv6/fixed-nat/port-mapping-files/oper" -H "accept: application/json" -H "Authorization: A10 610b000000a68f28f3bace139ba5a347" -H "content-type: application/json"
    
    [Response]
    {
     "port-mapping-files": {
      "oper": {
       "file-list": [
        {
         "file-name": "fixed_nat_ip_list_fixed_nat_public_2022_04_21_125309",
         "write-status": "Done"
        }
    
    • Export the file port-mapping-file using /axapi/v3/export
    [Example Values]
    {
     "export": {
      "fixed-nat": "fixed_nat_ip_list_fixed_nat_public_2022_04_21_125309",
      "use-mgmt-port": 1,
      "remote-file": "scp://user:pass@10.10.10.1/port-mapping-repo/"
     }
    }
    
    [aXAPI example]
    curl -X POST "https://you-thunder-ip/axapi/v3/export" -H "accept: application/json" -H "Authorization: A10 610b000000a68f28f3bace139ba5a347" -H "content-type: application/json" -d "{ \"export\": { \"fixed-nat\": \"fixed_nat_ip_list_fixed_nat_public_2022_04_21_125309\", \"use-mgmt-port\": 1, \"remote-file\": \"scp://user:pass@10.10.10.1/port-mapping-repo/\" }}"
    
    [Response]
    {
     "response": {
      "status": "OK",
      "msg": "Done.\n"
     }
    }
    

    Hope this helps.

  • Options

    Thanks! I actually found a script shortly after making this post of an example dumping the AXDEBUG files that pointed me in the right direction, identical direction even.


    Thanks!

Sign In or Register to comment.