2018-01-08 19:48:53 +01:00
|
|
|
# Create a user
|
|
|
|
|
2019-07-30 01:17:54 +02:00
|
|
|
{!api-admin-only.md!}
|
2018-01-08 19:48:53 +01:00
|
|
|
|
2020-04-28 20:00:46 +02:00
|
|
|
{generate_api_description(/users:post)}
|
2018-01-08 19:48:53 +01:00
|
|
|
|
|
|
|
## Usage examples
|
|
|
|
|
2018-09-17 16:27:32 +02:00
|
|
|
{start_tabs}
|
|
|
|
{tab|python}
|
2018-01-08 19:48:53 +01:00
|
|
|
|
2018-06-21 01:47:22 +02:00
|
|
|
{generate_code_example(python)|/users:post|example(admin_config=True)}
|
2018-01-08 19:48:53 +01:00
|
|
|
|
2018-09-17 16:27:32 +02:00
|
|
|
{tab|js}
|
2018-01-08 19:48:53 +01:00
|
|
|
|
2018-01-13 23:40:45 +01:00
|
|
|
More examples and documentation can be found [here](https://github.com/zulip/zulip-js).
|
|
|
|
```js
|
|
|
|
const zulip = require('zulip-js');
|
|
|
|
|
2019-01-07 14:27:58 +01:00
|
|
|
// The user for this zuliprc file must be an organization administrator.
|
2018-01-13 23:40:45 +01:00
|
|
|
const config = {
|
|
|
|
zuliprc: 'zuliprc-admin',
|
|
|
|
};
|
|
|
|
|
|
|
|
zulip(config).then((client) => {
|
|
|
|
// Create a user
|
|
|
|
const params = {
|
|
|
|
email: 'newbie@zulip.com',
|
|
|
|
password: 'temp',
|
|
|
|
full_name: 'New User',
|
|
|
|
short_name: 'newbie'
|
|
|
|
};
|
|
|
|
client.users.create(params).then(console.log);
|
|
|
|
});
|
|
|
|
```
|
|
|
|
|
2018-09-17 16:27:32 +02:00
|
|
|
{tab|curl}
|
|
|
|
|
2019-10-11 14:58:24 +02:00
|
|
|
{generate_code_example(curl)|/users:post|example}
|
2018-01-08 19:48:53 +01:00
|
|
|
|
2018-09-17 16:27:32 +02:00
|
|
|
{end_tabs}
|
2018-01-08 19:48:53 +01:00
|
|
|
|
2018-01-20 22:03:05 +01:00
|
|
|
## Arguments
|
|
|
|
|
2018-06-21 01:47:22 +02:00
|
|
|
{generate_api_arguments_table|zulip.yaml|/users:post}
|
2018-01-20 22:03:05 +01:00
|
|
|
|
2018-01-08 19:48:53 +01:00
|
|
|
## Response
|
|
|
|
|
|
|
|
#### Example response
|
|
|
|
|
|
|
|
A typical successful JSON response may look like:
|
|
|
|
|
2018-06-21 01:47:22 +02:00
|
|
|
{generate_code_example|/users:post|fixture(200)}
|
2018-01-08 19:48:53 +01:00
|
|
|
|
|
|
|
A typical JSON response for when another user with the same
|
|
|
|
email address already exists in the realm:
|
|
|
|
|
2018-06-21 01:47:22 +02:00
|
|
|
{generate_code_example|/users:post|fixture(400)}
|