Batching Requests

Multiple GET requests for different URI’s can be issued by a POST request against /axapi/v3/batch-get. Using batching requests reduces the number of API calling times which improves the performance on the CLIENT side.

Intended Use and Limitations

  • Only the POST method is allowed.
  • The schema request call should not use the Batch-Get operation as it will result in failure.

Error Handling

  • If one of the API calls is incorrect, its corresponding response attribute resp will contain the error JSON data.

Example

The following example shows how to call multiple API’s in a single call:

    POST /axapi/v3/batch-get
    {
"batch-get-list" : [
             {"uri":"/axapi/v3/interface/ethernet/1/schema"},
             {"uri":"/axapi/v3/interface/ethernet?total=true"},
             {"uri":"/axapi/v3/interface/ethernet?start=2&count=3"},
             {"uri":"/axapi/v3/interface/ethernet?start=2&count=3&wrong-filter=xxx"},
             {"uri":"/axapi/v3/interface/ethernet/1/oper"},
             {"uri":"/axapi/v3/slb/server/s1/stats"},
             {"uri":"/axapi/v3/no-such-endpoint"}
    ]
}

If this request succeeds, the following response will be recieved:

{
  "batch-get-list": [
        {
          "uri":"/axapi/v3/interface/ethernet/1/schema",
          "resp":{
                "http-status":400,
                "status":"fail",
                  "err": {
                        "code":1023524864,
                        "msg":"JSON message is wrong."
                  }
          }
        },
        {
          "uri":"/axapi/v3/interface/ethernet?total=true",
          "resp":{
                "total-count":8
          }
        },
        {
          "uri":"/axapi/v3/interface/ethernet?start=2&count=3",
          "resp":{
                "ethernet-list": [
                  {
                        "ifnum":3,
                        "l3-vlan-fwd-disable":0,
                        "load-interval":300,
                        "mtu":1500,
                        "trap-source":0,
                        "duplexity":"auto",
                        "speed":"auto",
                        "flow-control":0,
                        "action":"disable",
                        "uuid":"46e93848-844d-11e5-8d0b-000d480a65d0",
                        "a10-url":"/axapi/v3/interface/ethernet/3"
                  },
                  {
                        "ifnum":4,
                        "l3-vlan-fwd-disable":0,
                        "load-interval":300,
                        "mtu":1500,
                        "trap-source":0,
                        "duplexity":"auto",
                        "speed":"auto",
                        "flow-control":0,
                        "action":"disable",
                        "uuid":"46e93c8a-844d-11e5-8d0b-000d480a65d0",
                        "a10-url":"/axapi/v3/interface/ethernet/4"
                  },
                  {
                        "ifnum":5,
                        "l3-vlan-fwd-disable":0,
                        "load-interval":300,
                        "mtu":1500,
                        "trap-source":0,
                        "duplexity":"auto",
                        "speed":"auto",
                        "flow-control":0,
                        "action":"disable",
                        "uuid":"46e940c2-844d-11e5-8d0b-000d480a65d0",
                        "a10-url":"/axapi/v3/interface/ethernet/5"
                  }
                ]
          }
        },
        {
          "uri":"/axapi/v3/interface/ethernet?start=2&count=3&wrong-filter=xxx",
          "resp":{
                "http-status":400,
                "status":"fail",
                  "err": {
                        "code":1023524866,
                        "msg":"Wrong URI filter."
                 }
          }
        },
        {
          "uri":"/axapi/v3/interface/ethernet/1/oper",
          "resp":{
                "ethernet": {
                  "oper" : {
                        "state":"DISABLED",
                        "line_protocol":"DOWN",
                        "link_type":"GigabitEthernet",
                        "mac":"000d.480a.65cf",
                        "config_speed":"auto",
                        "actual_speed":"unknown",
                        "config_duplexity":"auto",
                        "actual_duplexity":"unknown",
                        "media_type":"Copper"
                  },
                  "a10-url":"/axapi/v3/interface/ethernet/1/oper",
                  "ifnum":1
                }
          }
        },
        {
          "uri":"/axapi/v3/slb/server/s1/stats",
          "resp":{
                "server": {
                  "stats" : {
                        "curr-conn":0,
                        "total-conn":0,
                        "fwd-pkt":0,
                        "rev-pkt":0,
                        "peak-conn":0
                  },
                  "a10-url":"/axapi/v3/slb/server/s1/stats",
                  "name":"s1"
                }
          }
        },
        {
          "uri":"/axapi/v3/no-such-endpoint",
          "resp":{
                "http-status":404,
                "status":"fail",
                  "err": {
                        "code":1023525888,
                        "msg":"URI not found."
                  }
          }
        }
  ]
}