{"id":84,"date":"2019-02-06T15:11:11","date_gmt":"2019-02-06T20:11:11","guid":{"rendered":"https:\/\/blog.markdepalma.com\/?p=84"},"modified":"2019-02-08T14:32:44","modified_gmt":"2019-02-08T19:32:44","slug":"airwatch-api-the-argument-cannot-be-null","status":"publish","type":"post","link":"https:\/\/blog.markdepalma.com\/?p=84","title":{"rendered":"AirWatch API &#8211; The argument cannot be null"},"content":{"rendered":"\n<p>I recently was creating a PowerShell script that uses the AirWatch REST API to perform mass updates to enrollment users. When testing the process using an API tool (Insomnia) I was receiving the following error when issuing a <strong>POST <\/strong>to &#8220;<strong>\/api\/V1\/system\/users\/{id}\/update<\/strong>&#8220;:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?xml version=\"1.0\" encoding=\"utf-8\"?>\n&lt;AirWatchFaultContract\n  xmlns:xsd=\"http:\/\/www.w3.org\/2001\/XMLSchema\"\n  xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\"\n  xmlns=\"http:\/\/www.air-watch.com\/\">\n  &lt;ErrorCode>1018&lt;\/ErrorCode>\n  &lt;Message>The argument cannot be null&lt;\/Message>\n  &lt;ActivityId>99311627-d7fd-4fa3-bede-78553fe0ac88&lt;\/ActivityId>\n&lt;\/AirWatchFaultContract><\/code><\/pre>\n\n\n\n<p>I was using an XML body to pass one parameter as per the documentation and the user id was correct. I was unable to find any information on this error and the only thing I was left with was using a JSON body instead of XML for the POST. Once I switched to a JSON body the call was successful. I tested other POST commands using an XML body and they did not produce this error.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I recently was creating a PowerShell script that uses the AirWatch REST API to perform mass updates to enrollment users. When testing the process using an API tool (Insomnia) I was receiving the following error when issuing a POST to &#8220;\/api\/V1\/system\/users\/{id}\/update&#8220;: I was using an XML body to pass one parameter as per the documentation [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[67],"tags":[34,35,37,36,15],"class_list":["post-84","post","type-post","status-publish","format-standard","hentry","category-scripting","tag-airwatch","tag-api","tag-json","tag-rest","tag-xml"],"_links":{"self":[{"href":"https:\/\/blog.markdepalma.com\/index.php?rest_route=\/wp\/v2\/posts\/84","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.markdepalma.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.markdepalma.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.markdepalma.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.markdepalma.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=84"}],"version-history":[{"count":1,"href":"https:\/\/blog.markdepalma.com\/index.php?rest_route=\/wp\/v2\/posts\/84\/revisions"}],"predecessor-version":[{"id":85,"href":"https:\/\/blog.markdepalma.com\/index.php?rest_route=\/wp\/v2\/posts\/84\/revisions\/85"}],"wp:attachment":[{"href":"https:\/\/blog.markdepalma.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=84"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.markdepalma.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=84"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.markdepalma.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=84"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}