# You have not completed all the user fields API error

**URL:** https://meta.discourse.org/t/you-have-not-completed-all-the-user-fields-api-error/56983
**Category:** Support
**Created:** [February 6, 2017, 3:55pm UTC](https://meta.discourse.org/t/you-have-not-completed-all-the-user-fields-api-error/56983 "2017-02-06T15:55:30Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![nathanhamilton](https://avatars.discourse-cdn.com/v4/letter/n/6a8cbe/32.png) [@nathanhamilton](https://meta.discourse.org/u/nathanhamilton)
#### Post date: [February 6, 2017, 3:55pm UTC](https://meta.discourse.org/t/you-have-not-completed-all-the-user-fields-api-error/56983/1 "2017-02-06T15:55:30Z")

</div>

Hello,

I am trying to create a user with the api and here is the curl request that I used:

`curl -X POST "Content-Type: multipart/form-data;" -F "api_key=my_api_key" -F "api_username=my_api_username" -F "name=My Name" -F "email=email@test.com" -F "password=password" -F "username=username" "https://forums.lumerit.com/users"`

The response that I receive is this:

```plaintext
<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.

---

<div class="post-metadata">

### Author: ![blake](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/blake/32/157322_2.png) [@blake](https://meta.discourse.org/u/blake)
#### Post date: [February 6, 2017, 4:24pm UTC](https://meta.discourse.org/t/you-have-not-completed-all-the-user-fields-api-error/56983/2 "2017-02-06T16:24:51Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![blake](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/blake/32/157322_2.png) [@blake](https://meta.discourse.org/u/blake)
#### Post date: [February 6, 2017, 4:34pm UTC](https://meta.discourse.org/t/you-have-not-completed-all-the-user-fields-api-error/56983/3 "2017-02-06T16:34:56Z")

</div>

also use `-H` for setting the content type:

```
curl -X POST -H "Content-Type: multipart/form-data;"

```

---

<div class="post-metadata">

### Author: ![nathanhamilton](https://avatars.discourse-cdn.com/v4/letter/n/6a8cbe/32.png) [@nathanhamilton](https://meta.discourse.org/u/nathanhamilton)
#### Post date: [February 6, 2017, 4:44pm UTC](https://meta.discourse.org/t/you-have-not-completed-all-the-user-fields-api-error/56983/4 "2017-02-06T16:44:24Z")

</div>

Great catch, I forgot to add the `-H` for the header. So now it is returning simply:

`{"success":false,"message":"You have not completed all the user fields"}`

---

<div class="post-metadata">

### Author: ![nathanhamilton](https://avatars.discourse-cdn.com/v4/letter/n/6a8cbe/32.png) [@nathanhamilton](https://meta.discourse.org/u/nathanhamilton)
#### Post date: [February 6, 2017, 4:45pm UTC](https://meta.discourse.org/t/you-have-not-completed-all-the-user-fields-api-error/56983/5 "2017-02-06T16:45:51Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![blake](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/blake/32/157322_2.png) [@blake](https://meta.discourse.org/u/blake)
#### Post date: [February 6, 2017, 4:49pm UTC](https://meta.discourse.org/t/you-have-not-completed-all-the-user-fields-api-error/56983/6 "2017-02-06T16:49:04Z")

</div>

Do you know what the custom fields are? I would try passing them in just like the other user fields:

```
-F "custom_field=value"

```

and see where that gets you.

---

<div class="post-metadata">

### Author: ![nathanhamilton](https://avatars.discourse-cdn.com/v4/letter/n/6a8cbe/32.png) [@nathanhamilton](https://meta.discourse.org/u/nathanhamilton)
#### Post date: [February 6, 2017, 7:16pm UTC](https://meta.discourse.org/t/you-have-not-completed-all-the-user-fields-api-error/56983/7 "2017-02-06T19:16:43Z")

</div>

So here are the fields:

`curl -X POST -H "Content-Type: multipart/form-data;" -F "api_key=myapikey" -F "api_username=myapiusername" -F "name=Some Name" -F "email=email@test.com" -F "password=forum2017" -F "status=Freshman" "enrollment_date=Jan2017" -F "username=esquireofthelord" "https://forums.lumerit.com/users"`

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.

Thanks for your help Blake.

---

<div class="post-metadata">

### Author: ![blake](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/blake/32/157322_2.png) [@blake](https://meta.discourse.org/u/blake)
#### Post date: [February 7, 2017, 3:37pm UTC](https://meta.discourse.org/t/you-have-not-completed-all-the-user-fields-api-error/56983/8 "2017-02-07T15:37:35Z")

</div>

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](https://www.getpostman.com/) for testing out your API requests instead of curl.

---

<div class="post-metadata">

### Author: ![nathanhamilton](https://avatars.discourse-cdn.com/v4/letter/n/6a8cbe/32.png) [@nathanhamilton](https://meta.discourse.org/u/nathanhamilton)
#### Post date: [February 7, 2017, 5:19pm UTC](https://meta.discourse.org/t/you-have-not-completed-all-the-user-fields-api-error/56983/9 "2017-02-07T17:19:26Z")

</div>

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.

`curl -X POST -H "Content-Type: multipart/form-data;" -F "api_key=myapikey" -F "api_username=discourse1" -F "name=full name" -F "email=myemail@test.com" -F "password=newpass" -F "user_fields[1]=Freshman" -F "user_fields[5]=Jan2017" -F "username=myusername" -F "active=true" "https://forums.lumerit.com/users"`

I have seen this issue being addressed here: [https://meta.discourse.org/t/getting-you-have-not-completed-all-the-user-fields-error-while-creating-user-using-php-api/52043/19](https://meta.discourse.org/t/getting-you-have-not-completed-all-the-user-fields-error-while-creating-user-using-php-api/52043/19)

However, I would like to ask that the documentation for the API be updated as it says nothing about custom fields: [Discourse API Docs](https://discourse.github.io/discourse_api_docs/#tag/Users%2Fpaths%2F~1users%2Fpost)

Thanks for your help Blake!

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [April 30, 2019, 2:30am UTC](https://meta.discourse.org/t/you-have-not-completed-all-the-user-fields-api-error/56983/10 "2019-04-30T02:30:43Z")

</div>



---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [April 30, 2019, 8:15am UTC](https://meta.discourse.org/t/you-have-not-completed-all-the-user-fields-api-error/56983/11 "2019-04-30T08:15:03Z")

</div>


