Admin

Use the API to managing users, keys, and access as PDAP staff

Base URL

https://data-sources.pdap.io

Login & API keys

Creates a new user.

POST [base-url]/user

Users can sign up for an account through the post function in resources/User.py. The user's password is hashed using werkzeug.security’s generate_pasword_hash function. The user's email and hashed password is stored in the users table in the Data Sources database.

Request Body

NameTypeDescription

email*

String

User's email - must be unique

password*

String

User's password

message string

Updates user password.

PUT [base-url]/user

Users can update their password through the put function in resources/User.py. The user's password is hashed using werkzeug.security’s generate_pasword_hash function. The user's email and hashed password is stored in the users table in the Data Sources database.

Request Body

NameTypeDescription

email*

String

User's email - must be unique

password*

String

User's password

message string

Logs in the user.

POST [base-url]/login

The login function can be found through the get function in resources/Login.py. If the email and password match a row in the database, "Successfully logged in" will be returned.

Request Body

NameTypeDescription

email*

String

Matches exactly with the "email" property in user's table

password*

String

Checked against the password_digest for the user with the matching "email" property using werkzeug.security’s check_password_hash function

message string
data string

Refreshes the user's session token.

POST [base-url]/refresh-session

The logic can be found in the post function in resources/RefreshSession.py. If the old session token matches a row in the database, "Successfully refreshed session token" will be returned.

Request Body

NameTypeDescription

email*

String

Matches exactly with the "email" property in user's table

password*

String

Checked against the password_digest for the user with the matching "email" property using werkzeug.security’s check_password_hash function

message string
data string

POST [base-url]/request-reset-password

This functionality can be found in the get function in resources/RequestResetPassword.py. If the email and password match a row in the database, "Successfully logged in" will be returned.

Request Body

NameTypeDescription

email*

String

Matches exactly with the "email" property in user's table

POST [base-url]/request-reset-password

This functionality can be found in the get function in resources/RequestResetPassword.py. If the email and password match a row in the database, "Successfully logged in" will be returned.

Request Body

NameTypeDescription

email*

String

Matches exactly with the "email" property in user's table

message string

Reset password token check.

POST [base-url]/reset-token-validation

This functionality can be found in the get function in resources/ResetTokenValidation.py. If the token matches a row in the database, "Token is valid" will be returned.

Path Parameters

NameTypeDescription

token*

String

Reset password token

message string

Returns an API key for a valid user and password.

GET [base-url]/api_key

The key generation function can be found through the get function in resources/ApiKey. If the email and password match a row in the database, a new API key is created using uuid.uuid4().hex, updated in for the matching user in the users table, and the API key is sent to the user.

Request Body

NameTypeDescription

email*

String

Matches exactly with the "email" property in user's table

password*

String

Checked against the password_digest for the user with the matching "email" property using werkzeug.security’s check_password_hash function

api_key string

Last updated