Creating a server user using curl on Windows command line?

I’m trying to “create a server user” as explained in this REST API documentation example. I’m using curl on the Windows command line as shown below. I get a fairly cryptic error response (also shown below). The error log also gives me an error message (also shown below), but I’m not finding that very helpful either. I’ve been able to issue simpler curl commands. For example, the command to query log info as shown below works fine. Any help on what I’m doing wrong with would be appreciated. Thank you.

Windows command line curl command I use:

curl -X POST --digest -u "user:pw" http://localhost:8087/v2/servers/_defaultServer_/users -d @json.txt

json.txt:

{    "userName": "WowzaNewbie",    "password":"mypassword",    "groups": [       ""    ] }

Command line response:

<?xml version="1.0" encoding="UTF-8" standalone="no"?><error><wowzaServer>4.8.0</wowzaServer><code>500</code><message>The server encountered an unexpected condition which prevented it from fulfilling the request</message></error>

Error Log Info:

ERROR    server    comment    2020-05-15    09:33:35    -    -    -    -    -    88596.69    -    -    -    -    -    -    -    -    class com.wowza.wms.rest.user.UserConfig.post : java.lang.NullPointerException|at com.wowza.wms.rest.ConfigBase.post(ConfigBase.java:3578)|at com.wowza.wms.rest.user.UsersConfig.post(UsersConfig.java:324)|at org.restlet.resource.ServerResource.doHandle(ServerResource.java:454)|at org.restlet.resource.ServerResource.doNegotiatedHandle(ServerResource.java:683)|at org.restlet.resource.ServerResource.doConditionalHandle(ServerResource.java:357)|

This curl command works fine:

curl -X GET --digest -u "user:pw" "http://localhost:8087/v2/servers/_defaultServer_/logfiles?order=newestFirst"

I ran this just now in Postman and was able to get the same 500 error when my JSON body was set to text and not JSON. Instead of sending your JSON file as a .txt, can you send it as a .json file?

Hi Amara - Thanks for the reply. I believe the issue was with properly escaping slashes and quotes on the Windows command line. I switched to a BASH command line that runs on Windows and was able to run this with no problem… So problem solved… Thanks again. -Terence

No problem! Glad you got it working. Escaping is always sneaky.