<commit_before>FORMAT: 1A
HOST: http://tidepool.io

# tidepool-user-api
The Tidepool User API is used to manage the user login information and pretty much nothing else.
Temporarily, it also manages sessions. That will change.

The apiary page is [here](https://app.apiary.io/tidepooluserapi).

# Group User
User related resources of the **User API**

## Status [/status]
### Retrieve status information [GET]
Returns a status health check with a list of status of its dependencies

+ Response 200

        If the server is operating properly and all dependencies are up and running.

        {
            "up" : [ "mongo" ],
            "down" : []
        }
    
+ Response 500

        If the server is *not* operating properly and one or more dependencies
        have failed to start or are no longer running.

        {
            "up" : [],
            "down" : [ "mongo" ]
        }

## Testing Status [/status/{statusvalue}]
### Retrieve status information [GET]
Returns whatever status it was sent as a parameter
+ Parameters
    + statusvalue (required, integer, `404`) ... The return code you want from the status call

+ Response 404    

## Login [/login]
### Log in an existing user [POST]
+ Request

    + Headers
    
            X-Tidepool-UserID: blipuser
            X-Tidepool-Password: <PASSWORD>
            

+ Response 200 (application/json)

    + Headers

            x-tidepool-session-token : <PASSWORD>

    + Body
    
            {
              "userid": "ebe58036a5",
              "username": "<EMAIL>,
              "emails" : [ "<EMAIL>" ]
            }
            
+ Response 401

        When the username/password combination fails.

### Refresh a session token [GET]

This call takes a token, and if the token was still valid, issues
a new (different) token; it also returns the userid in the body. This may
be a bad idea.

+ Request

    + Headers
    
            x-tidepool-session-token : <PASSWORD>
            

+ Response 200 (application/json)


    + Headers

            x-tidepool-session-token : <PASSWORD>

    + Body
    
            {
              "userid": "123123abcd",
            }

+ Response 401

        When the token is invalid.

+ Response 404

        When the token is not provided.


## Logout [/logout]
### Log out from an existing session [POST]

+ Request

    + Headers
    
            x-tidepool-session-token : <PASSWORD>

+ Response 200

+ Response 401

        When the token is invalid or not provided or has expired.


    
## User records [/user]
### Retrieve current user's info [GET]
+ Request
    + Headers
    
            x-tidepool-session-token : <PASSWORD>

+ Response 200 (application/json)

    + Body
    
            {
              "userid": "ebe58036a5",
              "username": "<EMAIL>,
              "emails" : [ "<EMAIL>" ]
            }

+ Response 401

        When the token is invalid or not provided.


### Create a user [POST]
+ Request (application/json)
    + Headers
    
            x-tidepool-session-token : <PASSWORD>

    + Body
    
            {
              "username": "<EMAIL>",
              "emails" : [ "<EMAIL>" ],
              "password" : "<PASSWORD>"
            }

+ Response 201 (application/json)
    + Headers

            x-tidepool-session-token : <PASSWORD>

    + Body
    
            {
              "userid": "ebe58036a5",
              "username": "<EMAIL>",
              "emails" : [ "<EMAIL>" ]
            }

+ Response 400

        When the body information is invalid (usually because something
        is not unique)

+ Response 401

        When the token is invalid or not provided.



## User info for another user [/user/{userid}]
### Retrieve other user's info [GET]
+ Parameters
    + userid (required, string, `123123abcd`) ... Tidepool-assigned user ID

+ Request
    + Headers
    
            x-tidepool-session-token : <PASSWORD>

+ Response 200 (application/json)

    + Body
    
            {
              "userid": userid,
              "username": "<EMAIL>",
              "emails" : [ "<EMAIL>" ]
            }

+ Response 401

        When the token is invalid or not provided.

+ Response 404

        When the userid was not found.



<commit_msg>Fix backlink to docs page<commit_after>FORMAT: 1A
HOST: http://tidepool.io

# tidepool-user-api
The Tidepool User API is used to manage the user login information and pretty much nothing else.
Temporarily, it also manages sessions. That will change.

The apiary page is [here](http://docs.tidepooluserapi.apiary.io/).

# Group User
User related resources of the **User API**

## Status [/status]
### Retrieve status information [GET]
Returns a status health check with a list of status of its dependencies

+ Response 200

        If the server is operating properly and all dependencies are up and running.

        {
            "up" : [ "mongo" ],
            "down" : []
        }
    
+ Response 500

        If the server is *not* operating properly and one or more dependencies
        have failed to start or are no longer running.

        {
            "up" : [],
            "down" : [ "mongo" ]
        }

## Testing Status [/status/{statusvalue}]
### Retrieve status information [GET]
Returns whatever status it was sent as a parameter
+ Parameters
    + statusvalue (required, integer, `404`) ... The return code you want from the status call

+ Response 404    

## Login [/login]
### Log in an existing user [POST]
+ Request

    + Headers
    
            X-Tidepool-UserID: blipuser
            X-Tidepool-Password: <PASSWORD>
            

+ Response 200 (application/json)

    + Headers

            x-tidepool-session-token : <PASSWORD>

    + Body
    
            {
              "userid": "ebe58036a5",
              "username": "<EMAIL>,
              "emails" : [ "<EMAIL>" ]
            }
            
+ Response 401

        When the username/password combination fails.

### Refresh a session token [GET]

This call takes a token, and if the token was still valid, issues
a new (different) token; it also returns the userid in the body. This may
be a bad idea.

+ Request

    + Headers
    
            x-tidepool-session-token : <PASSWORD>
            

+ Response 200 (application/json)


    + Headers

            x-tidepool-session-token : <PASSWORD>

    + Body
    
            {
              "userid": "123123abcd",
            }

+ Response 401

        When the token is invalid.

+ Response 404

        When the token is not provided.


## Logout [/logout]
### Log out from an existing session [POST]

+ Request

    + Headers
    
            x-tidepool-session-token : 2<PASSWORD>

+ Response 200

+ Response 401

        When the token is invalid or not provided or has expired.


    
## User records [/user]
### Retrieve current user's info [GET]
+ Request
    + Headers
    
            x-tidepool-session-token : <PASSWORD>

+ Response 200 (application/json)

    + Body
    
            {
              "userid": "ebe58036a5",
              "username": "<EMAIL>,
              "emails" : [ "<EMAIL>" ]
            }

+ Response 401

        When the token is invalid or not provided.


### Create a user [POST]
+ Request (application/json)
    + Headers
    
            x-tidepool-session-token : <PASSWORD>

    + Body
    
            {
              "username": "<EMAIL>",
              "emails" : [ "<EMAIL>" ],
              "password" : "<PASSWORD>"
            }

+ Response 201 (application/json)
    + Headers

            x-tidepool-session-token : <PASSWORD>

    + Body
    
            {
              "userid": "ebe58036a5",
              "username": "<EMAIL>",
              "emails" : [ "<EMAIL>" ]
            }

+ Response 400

        When the body information is invalid (usually because something
        is not unique)

+ Response 401

        When the token is invalid or not provided.



## User info for another user [/user/{userid}]
### Retrieve other user's info [GET]
+ Parameters
    + userid (required, string, `123123abcd`) ... Tidepool-assigned user ID

+ Request
    + Headers
    
            x-tidepool-session-token : <PASSWORD>

+ Response 200 (application/json)

    + Body
    
            {
              "userid": userid,
              "username": "<EMAIL>",
              "emails" : [ "<EMAIL>" ]
            }

+ Response 401

        When the token is invalid or not provided.

+ Response 404

        When the userid was not found.




{'fraction_non_alphanumeric': 0.10163274964505442, 'fraction_numerical': 0.02094178892569806, 'mean_word_length': 1.7971542025148908, 'pattern_counts': {'":': 20, '<': 43, '<?xml version=': 0, '>': 43, 'https://': 1, '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': '7336029', 'n_tokens_mistral': 2614, 'n_tokens_neox': 2376, 'n_words': 806}