<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Validation error in APIv2 PATCH requests in VeloCloud Discussions</title>
    <link>https://communities.vmware.com/t5/VeloCloud-Discussions/Validation-error-in-APIv2-PATCH-requests/m-p/2952005#M68</link>
    <description>&lt;P class=""&gt;I've started to play around with the VMware SD-WAN (née Velocloud) API. I've had a lot of success with gathering information using basic GET requests but I've been struggling to understand using it for configuration. For example, say I want to change the management traffic override setting. According to&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A class="" href="https://developer.vmware.com/apis/vmware-sase-platform/" target="_blank" rel="noopener nofollow ugc"&gt;the docs&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;I need to send a&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A class="" href="https://developer.vmware.com/apis/vmware-sase-platform/vmware-sdwan/latest/api/sdwan/v2/enterprises/enterpriseLogicalId/edges/edgeLogicalId/deviceSettings/patch/" target="_blank" rel="noopener nofollow ugc"&gt;PATCH request&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;with a 'PatchSchema' array:&lt;/P&gt;&lt;P class=""&gt;VMware's example:&lt;/P&gt;&lt;PRE&gt;{
    "PatchSchema": [
        {
            "op": "replace",
            "path": "/softwareUpdate/windowed",
            "value": true
        }
    ]
}&lt;/PRE&gt;&lt;P class=""&gt;This particular setting needs a&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A class="" href="https://developer.vmware.com/apis/vmware-sase-platform/vmware-sdwan/latest/data-structures/DeviceSettingsLANManagementTraffic/" target="_blank" rel="noopener nofollow ugc"&gt;DeviceSettingsLANManagementTraffic&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;object, with both fields described as optional:&lt;/P&gt;&lt;PRE&gt;{
	"override": false,
	"sourceInterface": "string"
}&lt;/PRE&gt;&lt;P class=""&gt;I'm using Python's Requests library, but here is VMware's example using cURL:&lt;/P&gt;&lt;PRE&gt;curl -X PATCH -H "Content-Type: application/json" -d '{"PatchSchema":[{"op":"replace","path":"/softwareUpdate/windowed","value":true},{"op":"remove","path":"/lan/networks/0"},{"op":"add","path":"/snmp/snmpv2c/allowedIp","value":"1.2.3.4"},{"from":"/lan/networks/0/interfaces/0","op":"remove","path":"/lan/networks/1/interfaces/1"}]}' https://{api_host}/api/sdwan/v2/enterprises/{enterpriseLogicalId}/edges/{edgeLogicalId}/deviceSettings&lt;/PRE&gt;&lt;P class=""&gt;My basic request is:&lt;/P&gt;&lt;PRE&gt;body = json.dumps({"PatchSchema": {"op":"replace","path":"/lan/managementTraffic","value":{"override": True}}})
reqs = requests.patch(full_url, headers=head, data=body)&lt;/PRE&gt;&lt;P class=""&gt;I can confirm that the url and headers are correct since I can perform GETs to the same endpoint without issue, but the PATCH requests keep returning the same error to me:&lt;/P&gt;&lt;PRE&gt;'{"code":"ValidationError","message":"Validation Error","errors":[{"message":"\\"value\\" must be an array","path":""}]}'&lt;/PRE&gt;&lt;P class=""&gt;VMware's own docs show that as a JSON object, with the particular value as a boolean. I've also tried the following for the body but they're all either invalid or return the same result:&lt;/P&gt;&lt;PRE&gt;body = json.dumps({"PatchSchema": [{"op":"replace","path":"/lan/managementTraffic","value":{"override": True}}]})
body = json.dumps({"PatchSchema": {"op":"replace","path":"/lan/managementTraffic","value":[{"override": True}]}})
body = json.dumps({"PatchSchema": {"op":"replace","path":"/lan/managementTraffic","value":{"managementTraffic": {"override": True}}}})
body = json.dumps({"PatchSchema": {"op":"replace","path":"/lan","value":{"managementTraffic": {"override": True}}}})
body = json.dumps({"PatchSchema": {"op":"replace","path":"/lan","value":{"lan": {"managementTraffic": {"override": True}}}}})
body = json.dumps({"PatchSchema": {"op":"replace","path":"/lan/managementTraffic/override","value": True}})
body = json.dumps({"PatchSchema": [{"op":"replace","path":"/lan/managementTraffic/override","value": True}]})&lt;/PRE&gt;&lt;P class=""&gt;I've tried to change other settings and apparently I just don't understand their documentation because I get the same error no matter what I've tried. Any ideas what I'm getting wrong?&lt;/P&gt;</description>
    <pubDate>Wed, 01 Feb 2023 20:51:59 GMT</pubDate>
    <dc:creator>jagno</dc:creator>
    <dc:date>2023-02-01T20:51:59Z</dc:date>
    <item>
      <title>Validation error in APIv2 PATCH requests</title>
      <link>https://communities.vmware.com/t5/VeloCloud-Discussions/Validation-error-in-APIv2-PATCH-requests/m-p/2952005#M68</link>
      <description>&lt;P class=""&gt;I've started to play around with the VMware SD-WAN (née Velocloud) API. I've had a lot of success with gathering information using basic GET requests but I've been struggling to understand using it for configuration. For example, say I want to change the management traffic override setting. According to&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A class="" href="https://developer.vmware.com/apis/vmware-sase-platform/" target="_blank" rel="noopener nofollow ugc"&gt;the docs&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;I need to send a&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A class="" href="https://developer.vmware.com/apis/vmware-sase-platform/vmware-sdwan/latest/api/sdwan/v2/enterprises/enterpriseLogicalId/edges/edgeLogicalId/deviceSettings/patch/" target="_blank" rel="noopener nofollow ugc"&gt;PATCH request&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;with a 'PatchSchema' array:&lt;/P&gt;&lt;P class=""&gt;VMware's example:&lt;/P&gt;&lt;PRE&gt;{
    "PatchSchema": [
        {
            "op": "replace",
            "path": "/softwareUpdate/windowed",
            "value": true
        }
    ]
}&lt;/PRE&gt;&lt;P class=""&gt;This particular setting needs a&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A class="" href="https://developer.vmware.com/apis/vmware-sase-platform/vmware-sdwan/latest/data-structures/DeviceSettingsLANManagementTraffic/" target="_blank" rel="noopener nofollow ugc"&gt;DeviceSettingsLANManagementTraffic&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;object, with both fields described as optional:&lt;/P&gt;&lt;PRE&gt;{
	"override": false,
	"sourceInterface": "string"
}&lt;/PRE&gt;&lt;P class=""&gt;I'm using Python's Requests library, but here is VMware's example using cURL:&lt;/P&gt;&lt;PRE&gt;curl -X PATCH -H "Content-Type: application/json" -d '{"PatchSchema":[{"op":"replace","path":"/softwareUpdate/windowed","value":true},{"op":"remove","path":"/lan/networks/0"},{"op":"add","path":"/snmp/snmpv2c/allowedIp","value":"1.2.3.4"},{"from":"/lan/networks/0/interfaces/0","op":"remove","path":"/lan/networks/1/interfaces/1"}]}' https://{api_host}/api/sdwan/v2/enterprises/{enterpriseLogicalId}/edges/{edgeLogicalId}/deviceSettings&lt;/PRE&gt;&lt;P class=""&gt;My basic request is:&lt;/P&gt;&lt;PRE&gt;body = json.dumps({"PatchSchema": {"op":"replace","path":"/lan/managementTraffic","value":{"override": True}}})
reqs = requests.patch(full_url, headers=head, data=body)&lt;/PRE&gt;&lt;P class=""&gt;I can confirm that the url and headers are correct since I can perform GETs to the same endpoint without issue, but the PATCH requests keep returning the same error to me:&lt;/P&gt;&lt;PRE&gt;'{"code":"ValidationError","message":"Validation Error","errors":[{"message":"\\"value\\" must be an array","path":""}]}'&lt;/PRE&gt;&lt;P class=""&gt;VMware's own docs show that as a JSON object, with the particular value as a boolean. I've also tried the following for the body but they're all either invalid or return the same result:&lt;/P&gt;&lt;PRE&gt;body = json.dumps({"PatchSchema": [{"op":"replace","path":"/lan/managementTraffic","value":{"override": True}}]})
body = json.dumps({"PatchSchema": {"op":"replace","path":"/lan/managementTraffic","value":[{"override": True}]}})
body = json.dumps({"PatchSchema": {"op":"replace","path":"/lan/managementTraffic","value":{"managementTraffic": {"override": True}}}})
body = json.dumps({"PatchSchema": {"op":"replace","path":"/lan","value":{"managementTraffic": {"override": True}}}})
body = json.dumps({"PatchSchema": {"op":"replace","path":"/lan","value":{"lan": {"managementTraffic": {"override": True}}}}})
body = json.dumps({"PatchSchema": {"op":"replace","path":"/lan/managementTraffic/override","value": True}})
body = json.dumps({"PatchSchema": [{"op":"replace","path":"/lan/managementTraffic/override","value": True}]})&lt;/PRE&gt;&lt;P class=""&gt;I've tried to change other settings and apparently I just don't understand their documentation because I get the same error no matter what I've tried. Any ideas what I'm getting wrong?&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2023 20:51:59 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VeloCloud-Discussions/Validation-error-in-APIv2-PATCH-requests/m-p/2952005#M68</guid>
      <dc:creator>jagno</dc:creator>
      <dc:date>2023-02-01T20:51:59Z</dc:date>
    </item>
    <item>
      <title>Re: Validation error in APIv2 PATCH requests</title>
      <link>https://communities.vmware.com/t5/VeloCloud-Discussions/Validation-error-in-APIv2-PATCH-requests/m-p/2952877#M69</link>
      <description>&lt;P&gt;I tried to change the APIv2 settings using postman.&lt;BR /&gt;I changed the DHCP setting on the Edge from enabled to disabled and the configuration was successful.&lt;BR /&gt;The cURL at that time is below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;curl --location --request PATCH 'https://&amp;lt;vco&amp;gt;/api/sdwan/v2/enterprises/&amp;lt;enterprise-id&amp;gt;/edges/&amp;lt;edge-id&amp;gt;' \&lt;BR /&gt;--header 'Authorization: Token &amp;lt;token&amp;gt; \&lt;BR /&gt;--header 'Content-Type: application/json' \&lt;BR /&gt;--data-raw '[&lt;BR /&gt;&amp;nbsp; &amp;nbsp; {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "op": "replace",&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "path": "/lan/networks/3/dhcp/enabled",&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "value": "false"&lt;BR /&gt;&amp;nbsp; &amp;nbsp; }&lt;BR /&gt;]'&lt;/P&gt;</description>
      <pubDate>Mon, 06 Feb 2023 16:38:22 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VeloCloud-Discussions/Validation-error-in-APIv2-PATCH-requests/m-p/2952877#M69</guid>
      <dc:creator>khirom</dc:creator>
      <dc:date>2023-02-06T16:38:22Z</dc:date>
    </item>
  </channel>
</rss>

