PowerShell Invoke-WebRequest | API Call
Looking at the Swagger UI site, it seems to me the json must contain properties in lower-caps only
{ "email": "myuser@mydomain.com", "full_name": "My User", "login_name": "myuser", "password": "P@w0rd", "send_notify": $true, "source_id": 0, "username": "myuser"}
Also, according to the Swagger site, you need to state the -ContentType.Your code would look like this:
# Filling my var with some data$username="myuser"$email="myuser@mydomain.com"$full_name="My User"$password="P@$$w0rd"# Building a hash with my data$hash = @{ email = $($email); # string full_name = $($full_name); # string login_name = $($username); # string password = $($password); # string send_notify = $false; # boolean source_id = 0; # int username = $($username) # string}# Converting my hash to json format$JSON = $hash | ConvertTo-Json# Displaying my JSON var$JSON# just to make it somewhat easier on the eyes$token = "3bb81a498393f4af3d278164b5755fc23b74b785"$url = "http://try.gitea.io/api/v1/admin/users?access_token=$token"Invoke-WebRequest -uri $url -Method POST -Body $JSON -ContentType 'application/json'