insert

The insert query parameter

You can use the insert query parameter to specify how a resource should be inserted within an ordered-by user list. The possible values are:
Table 1. Insert Query Parameter Values
Value Description
first Insert the new data as the new first entry
last Insert the new data as the new last entry
before Insert the new data before the insertion point, as specified by the value of the point parameter
after Insert the new data after the insertion point, as specified by the value of the point parameter

The default value is last.

Note

Note

The insert parameter is supported only for the POST and PUT methods. It is also only supported if the target resource is a data resource, and that data represents a YANG list or leaf-list that is ordered-by user.

A point query parameter MUST also be present for the insert query parameter if the values before or after are used, otherwise a 400 Bad Request status is returned.

Sample request from client to insert an access control entry at the head of the list

POST  /rest/restconf/data/ietf-access-control-list:acls/acl=acl/aces?insert=first
    HTTP/1.1
    Host: 10.50.130.172
    Content-Type: application/yang-data+json
    {
        ietf-access-control-list:aces": [    
        {
            "matches": {
                "eth": {          
                    "ethertype": 0       
                }      
            },       
            "name": "ace0",
            "actions": {        
            "forwarding": "drop"     
            }   
       }
      ]
    }

Sample response data from server

{
  "ietf-access-control-list:aces": {
    "ace": [
      {
        "actions": {
          "forwarding": "drop"
        }, 
        "matches": {
          "eth": {
            "ethertype": 0
          }
        }, 
        "name": "ace0", 
        "statistics": {
          "matched-packets": 0
        }
      }, 
      {
        "actions": {
          "forwarding": "drop"
        }, 
        "matches": {
          "eth": {
            "ethertype": 1
          }
        }, 
        "name": "ace1", 
        "statistics": {
          "matched-packets": 0
        }
      }, 
      {
        "actions": {
          "forwarding": "drop"
        }, 
        "matches": {
          "eth": {
            "ethertype": 288
          }
        }, 
        "name": "ace2", 
        "statistics": {
          "matched-packets": 0
        }
      }, 
      {
        "actions": {
          "forwarding": "drop"
        }, 
        "matches": {
          "eth": {
            "ethertype": 3
          }
        }, 
        "name": "ace3", 
        "statistics": {
          "matched-packets": 0
        }
      }, 
      {
        "actions": {
          "forwarding": "drop"
        }, 
        "matches": {
          "eth": {
            "ethertype": 4
          }
        }, 
        "name": "ace4", 
        "statistics": {
          "matched-packets": 0
        }
      }
    ]
  }
}