The PATCH
request is a write operation that allow you to update an existing object. The main difference between PATCH
and POST
or PUT
requests is that you can provide only the fields that contain new data rather than the entire object being updated. A PATCH
request is neither safe nor idempotent, because a PATCH operation cannot ensure the entire resource has been updated. Also,
unlike other API requests, a PATCH request contains instructions on how to modify a resource, rather than a version of the
resource itself.
Note |
The current release of Cisco ACI Multi-Site Orchestrator supports PATCH requests only for some objects. Check the Swagger API reference to see if an object supports PATCH requests.
|
When creating PATCH requests, the payload must contain the following:
-
op
: the operation to be performed by the request. Currently supported operations are add
, remove
, or replace
.
-
path
: the path to the resource that you are updating. The value contains the URI of the resource and the position inside that
resource where the information will be added.
For add
operations, the position value can be any positive integer or a dash (-
) to specify the end of the schema. For example, /templates/<template-name>/vrfs/-
would indicate adding a new VRF at the end of the current list, whereas /templates/<template-name>/vrfs/2
would add the VRF at the second position.
For replace
operations, the position value can also be a the name of the object to replace in addition to the index. For example, /templates/<template-name>/anps/AP1
would replace the application profile named AP1
-
value
: the new or updated value or object. For example, {"vrfname" : "vrf1"}
would specify a new VRF with the name vrf1.
You do not need to provide the value
field for remove
operations.
PATCH API has the following limitations:
-
You cannot use the PATCH API to change a template name, because multiple references in the fabric must be updated. Use PUT
request instead.
Names should not contain the slash (/
) character. If the name contains a slash, you cannot use it to access an element in an array and must use the element's index
instead.
Names must not contain numbers only. This limitation is caused by the fact that pure numbers are interpreted as the PATCH
index.
For site local schema objects, refer to the Site ID and Template name combination as <site-id>-<template-name>
, for example /sites/5b7d29c2a7fa00a7fae9bbf3-SampleTemplate/epgs
The following two example illustrate how to uses the PATCH
requests to add and remove a VRF in a template in an existing schema. The request response contains the entire object that
was updated.
Add an Object Using PATCH Request
The following example uses a PATCH
request to add a VRF to a template in an existing schema. The request response contains the entire object that was updated.
Original schema:
{
"id": "5c4b55db1a00003422f2215e",
"displayName": "SampleSchema",
"templates": [
{
"name": "Template1",
"displayName": "Template1",
"tenantId": "0000ffff0000000000000010",
"anps": [],
"vrfs": [],
"bds": [],
"contracts": [],
"filters": [],
"externalEpgs": [],
"serviceGraphs": [],
"intersiteL3outs": []
}
]
}
Request URL:
PATCH https://<mso-ip>/api/v1/schemas/5c4b55db1a00003422f2215e
Request payload:
[{
"op": "add",
"path": "/templates/Template1/vrfs/-",
"value": {
"displayName" : "vrf1",
"name" : "vrf1" }
}]
Request response:
{
"id": "5c4b55db1a00003422f2215e",
"displayName": "SampleSchema",
"templates": [
{
"name": "Template1",
"displayName": "T1",
"tenantId": "0000ffff0000000000000010",
"anps": [],
"vrfs": [
{
"name": "vrf1",
"displayName": "vrf1",
"vrfRef": "/schemas/5c4b55db1a00003422f2215e/templates/Template1/vrfs/vrf1",
"vzAnyProviderContracts": [],
"vzAnyConsumerContracts": []
}
],
"bds": [],
"contracts": [],
"filters": [],
"externalEpgs": [],
"serviceGraphs": [],
"intersiteL3outs": []
}
]
}
Remove an Object Using PATCH Request (VRF Example)
The following example uses a PATCH
request to remove a VRF from a template in an existing schema. The request response contains the entire object that was updated.
Original schema:
{
"id": "5c4b55db1a00003422f2215e",
"displayName": "SampleSchema",
"templates": [
{
"name": "Template1",
"displayName": "T1",
"tenantId": "0000ffff0000000000000010",
"anps": [],
"vrfs": [
{
"name": "vrf1",
"displayName": "vrf1",
"vrfRef": "/schemas/5c4b55db1a00003422f2215e/templates/Template1/vrfs/vrf1",
"vzAnyProviderContracts": [],
"vzAnyConsumerContracts": []
}
],
"bds": [],
"contracts": [],
"filters": [],
"externalEpgs": [],
"serviceGraphs": [],
"intersiteL3outs": []
}
]
}
Request URL:
PATCH https://<mso-ip>/api/v1/schemas/5c4b55db1a00003422f2215e
Request payload:
[{
"op": "remove",
"path": "/templates/Template1/vrfs/vrf1"
}]
Request response:
{
"id": "5c4b55db1a00003422f2215e",
"displayName": "SampleSchema",
"templates": [
{
"name": "Template1",
"displayName": "T1",
"tenantId": "0000ffff0000000000000010",
"anps": [],
"vrfs": [],
"bds": [],
"contracts": [],
"filters": [],
"externalEpgs": [],
"serviceGraphs": [],
"intersiteL3outs": []
}
]
}
Remove an Object Using PATCH Request (staticPort Example)
An additional example of using PATCH
request to remove a static port.
Original schema:
{
"id": "601acfed38000070a4ee9ec0",
"displayName": "Schema1",
"description": "",
"templates": [
{
"name": "Template1",
"displayName": "Template 1",
"tenantId": "0000ffff0000000000000010",
"anps": [
{
"name": "AP1",
"displayName": "AP 1",
"anpRef": "/schemas/601acfed38000070a4ee9ec0/templates/Template1/anps/AP1",
"epgs": [
{
"name": "EPG1",
"displayName": "EPG 1",
"epgRef": "/schemas/601acfed38000070a4ee9ec0/templates/Template1/anps/AP1/epgs/EPG1",
"contractRelationships": [],
"subnets": [],
"uSegEpg": false,
"uSegAttrs": [],
"intraEpg": "unenforced",
"prio": "unspecified",
"proxyArp": false,
"preferredGroup": false,
"bdRef": "/schemas/601acfed38000070a4ee9ec0/templates/Template1/bds/BD1",
"vrfRef": "",
"selectors": [],
"epgType": "application"
}
]
}
],
"vrfs": [
{
"name": "VRF1",
"displayName": "VRF 1",
"vrfRef": "/schemas/601acfed38000070a4ee9ec0/templates/Template1/vrfs/VRF1",
"l3MCast": false,
"preferredGroup": false,
"vzAnyEnabled": false,
"vzAnyProviderContracts": [],
"vzAnyConsumerContracts": [],
"rpConfigs": [],
"pcEnfPref": "enforced",
"ipDataPlaneLearning": "enabled"
}
],
"bds": [
{
"name": "BD1",
"displayName": "BD 1",
"bdRef": "/schemas/601acfed38000070a4ee9ec0/templates/Template1/bds/BD1",
"l2UnknownUnicast": "proxy",
"intersiteBumTrafficAllow": true,
"optimizeWanBandwidth": true,
"l2Stretch": true,
"subnets": [],
"vrfRef": "/schemas/601acfed38000070a4ee9ec0/templates/Template1/vrfs/VRF1",
"unkMcastAct": "flood",
"v6unkMcastAct": "flood",
"arpFlood": true,
"multiDstPktAct": "bd-flood"
}
],
"contracts": [],
"filters": [],
"externalEpgs": [],
"serviceGraphs": [],
"intersiteL3outs": [],
"templateType": "stretched-template",
"templateSubType": []
}
],
"_updateVersion": 1,
"sites": [
{
"siteId": "5efceb4a3600002738221157",
"templateName": "Template1",
"anps": [
{
"anpRef": "/schemas/601acfed38000070a4ee9ec0/templates/Template1/anps/AP1",
"epgs": [
{
"epgRef": "/schemas/601acfed38000070a4ee9ec0/templates/Template1/anps/AP1/epgs/EPG1",
"domainAssociations": [],
"staticPorts": [
{
"type": "port",
"path": "topology/pod-1/paths-101/pathep-[eth1/1]",
"portEncapVlan": 1,
"deploymentImmediacy": "lazy",
"mode": "regular"
},
{
"type": "port",
"path": "topology/pod-1/paths-102/pathep-[eth1/2]",
"portEncapVlan": 2,
"deploymentImmediacy": "lazy",
"mode": "regular"
}
],
"staticLeafs": [],
"uSegAttrs": [],
"subnets": [],
"selectors": []
}
]
}
],
"vrfs": [],
"bds": [],
"contracts": [],
"externalEpgs": [],
"serviceGraphs": [],
"intersiteL3outs": []
}
]
}
Request URL:
PATCH https://<mso-ip>/api/v1/schemas/601acfed38000070a4ee9ec0
Request payload:
[{
"op": "remove",
"path": "/sites/0/anps/0/epgs/0/staticPorts/1"
}]
Request response:
{
"id": "601acfed38000070a4ee9ec0",
"displayName": "Schema1",
"description": "",
"templates": [
{
"name": "Template1",
"displayName": "Template 1",
"tenantId": "0000ffff0000000000000010",
"anps": [
{
"name": "AP1",
"displayName": "AP 1",
"anpRef": "/schemas/601acfed38000070a4ee9ec0/templates/Template1/anps/AP1",
"epgs": [
{
"name": "EPG1",
"displayName": "EPG 1",
"epgRef": "/schemas/601acfed38000070a4ee9ec0/templates/Template1/anps/AP1/epgs/EPG1",
"contractRelationships": [],
"subnets": [],
"uSegEpg": false,
"uSegAttrs": [],
"intraEpg": "unenforced",
"prio": "unspecified",
"proxyArp": false,
"preferredGroup": false,
"bdRef": "/schemas/601acfed38000070a4ee9ec0/templates/Template1/bds/BD1",
"vrfRef": "",
"selectors": [],
"epgType": "application"
}
]
}
],
"vrfs": [
{
"name": "VRF1",
"displayName": "VRF 1",
"vrfRef": "/schemas/601acfed38000070a4ee9ec0/templates/Template1/vrfs/VRF1",
"l3MCast": false,
"preferredGroup": false,
"vzAnyEnabled": false,
"vzAnyProviderContracts": [],
"vzAnyConsumerContracts": [],
"rpConfigs": [],
"pcEnfPref": "enforced",
"ipDataPlaneLearning": "enabled"
}
],
"bds": [
{
"name": "BD1",
"displayName": "BD 1",
"bdRef": "/schemas/601acfed38000070a4ee9ec0/templates/Template1/bds/BD1",
"l2UnknownUnicast": "proxy",
"intersiteBumTrafficAllow": true,
"optimizeWanBandwidth": true,
"l2Stretch": true,
"subnets": [],
"vrfRef": "/schemas/601acfed38000070a4ee9ec0/templates/Template1/vrfs/VRF1",
"unkMcastAct": "flood",
"v6unkMcastAct": "flood",
"arpFlood": true,
"multiDstPktAct": "bd-flood"
}
],
"contracts": [],
"filters": [],
"externalEpgs": [],
"serviceGraphs": [],
"intersiteL3outs": [],
"templateType": "stretched-template",
"templateSubType": []
}
],
"_updateVersion": 1,
"sites": [
{
"siteId": "5efceb4a3600002738221157",
"templateName": "Template1",
"anps": [
{
"anpRef": "/schemas/601acfed38000070a4ee9ec0/templates/Template1/anps/AP1",
"epgs": [
{
"epgRef": "/schemas/601acfed38000070a4ee9ec0/templates/Template1/anps/AP1/epgs/EPG1",
"domainAssociations": [],
"staticPorts": [
{
"type": "port",
"path": "topology/pod-1/paths-101/pathep-[eth1/1]",
"portEncapVlan": 1,
"deploymentImmediacy": "lazy",
"mode": "regular"
}
],
"staticLeafs": [],
"uSegAttrs": [],
"subnets": [],
"selectors": []
}
]
}
],
"vrfs": [],
"bds": [],
"contracts": [],
"externalEpgs": [],
"serviceGraphs": [],
"intersiteL3outs": []
}
]
}