<html>
<head><title>301 Moved Permanently</title></head>
<body bgcolor="white">
<center><h1>301 Moved Permanently</h1></center>
<hr><center>nginx</center>
</body>
</html>
{"success":false,"message":"You have not completed all the user fields"}
I also tried watching the network traffic through dev tools on my instance and creating a new user, but it was posting to /login not /users so I was greatly confused. Any help that someone could give me would be greatly appreciated.
I just tried the same curl command on my local and its working fine:
$ curl -X POST "Content-Type: multipart/form-data;" -F "apc5acaefaf303ce47e64dd3182947df42b74ceef7b99f4b726dcced111babd" -F "api_username=discourse1" -F "name=My Name" -F "email=email@test.com" -F "password=Strong123Blah" -F "username=discourse3" "http://localhost:3000/users"
curl: (6) Could not resolve host: Content-Type
{"success":true,"active":false,"message":"\u003cp\u003eYou're almost done! We sent an activation mail to \u003cb\u003eemail@test.com\u003c/b\u003e. Please follow the instructions in the email to activate your account.\u003c/p\u003e\u003cp\u003eIf it doesn't arrive, check your spam folder, or try to log in again to send another activation mail.\u003c/p\u003e","user_id":2}
You shouldn’t be getting a redirect to login though, is your forum private?
I believe that this error is being returned due to custom fields that need to be passed in, but I don’t know how to pass those to the API. The documentation is silent on how to deal with custom parameters.
The status custom field is a dropdown and is required upon signup, the enrollment date is a string but is not required on startup. Could it be that the dropdown is causing issues?
Even though I have added these fields it still is returning the same response as earlier. And you asked if my forum is private, does that mean no one can signup for it publicly? If so, then partially. A user has to be approved before they can start using the forums.
I only asked if your forum was private because you were being redirected to /login earlier. So thats not the issue anymore.
I’m really note sure what your issue is because (this might be a “bug”) I added some required custom fields to my local discourse and they still aren’t being required by the api.
Looks like you are missing a -F before enrollment_date
I would try removing all your custom fields for now and see if you can get it to work. Then add them back in one by one.
I would also suggest using postman for testing out your API requests instead of curl.
So I was able to get it to work by using user_fields[1] as shown below. This was made known to me by watching the network traffic while signing up on our domain and zoning in on the /users POST request.