<commit_before>---
layout: page
categories: ["API"]
title: User
---

# User

## Create a new user

Creates a new user object. A _public key_ is required.

```sh
$ curl {{ site.parku.api }}/user \
    -u 6f1ed002ab5595859014ebf0951522d9:parku \
    -d email=<EMAIL> \
    -d password=<PASSWORD> \
    -d country=DE \
    -d firstname=Test \
    -d lastname=Name \
    -d gender=female \
    -d facebook_id=xxx
```

> Response

```nginx
Status: 201 Created
Location: {{ site.parku.api }}/user
```
```json
{
  "gender": "female",
  "email": "<EMAIL>",
  "firstname": "Test",
  "lastname": "Name",
  "credit": 0,
  "currency": "EUR",
  "country": "DE",
  "facebook_id": null,
  "token": "0<PASSWORD>"
}
```

### HTTP Request

`POST {{ site.parku.api }}/user`

### Parameters

Parameter    | Description
---          | ---
`email`      | __Required.__
`password`   | __Required.__
`country`    | _DE_ or _CH_ __Required.__
`firstname`  | __Required.__
`lastname`   | __Required.__
`gender`     | _male_ or _female_. _Optional._
`facebook_id`| _Optional._

## Retrieve a user

Returns the user object for the private key. A _private key_ is required.

```sh
$ curl {{ site.parku.api }}/user \
    -u <PASSWORD>:parku
```

> Response

```nginx
Status: 200 OK
```
```json<commit_msg>changed password and country parameter to optional when creating User<commit_after>---
layout: page
categories: ["API"]
title: User
---

# User

## Create a new user

Creates a new user object. A _public key_ is required.

```sh
$ curl {{ site.parku.api }}/user \
    -u 6f1ed002ab5595859014ebf0951522d9:parku \
    -d email=<EMAIL> \
    -d password=<PASSWORD> \
    -d country=DE \
    -d firstname=Test \
    -d lastname=Name \
    -d gender=female \
    -d facebook_id=xxx
```

> Response

```nginx
Status: 201 Created
Location: {{ site.parku.api }}/user
```
```json
{
  "gender": "female",
  "email": "<EMAIL>",
  "firstname": "Test",
  "lastname": "Name",
  "credit": 0,
  "currency": "EUR",
  "country": "DE",
  "facebook_id": null,
  "token": "<PASSWORD>"
}
```

### HTTP Request

`POST {{ site.parku.api }}/user`

### Parameters

Parameter    | Description
---          | ---
`email`      | __Required.__
`password`   | __Optional.__
`country`    | _DE_ or _CH_ __Optional.__
`firstname`  | __Required.__
`lastname`   | __Required.__
`gender`     | _male_ or _female_. _Optional._
`facebook_id`| _Optional._

## Retrieve a user

Returns the user object for the private key. A _private key_ is required.

```sh
$ curl {{ site.parku.api }}/user \
    -u <PASSWORD>:parku
```

> Response

```nginx
Status: 200 OK
```
```json
{'fraction_non_alphanumeric': 0.17351247600767755, 'fraction_numerical': 0.023416506717850286, 'mean_word_length': 3.059190031152648, 'pattern_counts': {'":': 18, '<': 13, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '166210', 'n_tokens_mistral': 1022, 'n_tokens_neox': 947, 'n_words': 258}