howtocards 0.1.3

Application library for howtocards service
docs.rs failed to build howtocards-0.1.3
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.

HowToCards

REST API

Authentication

You should create token. Send token in Authorization header.

Example:

Authorization: bearer 0dsi9fjs9dfj89s8djf

Where 0dsi9fjs9dfj89s8djf is your token.

If route requires authentication, and request not provides it:

400 Bad Request is returns.

{
  "ok": false,
  "error": "{ERROR_KIND}"
}

Where ERROR_KIND is:

  • invalid_token
  • unknown_token
  • missing_header

POST /account

Register new account.

Receives:

{
  "email": "string",
  "password": "string"
}

If account registered successfully returns 200 OK. Otherwise returns 400 Bad Request.

POST /account/session

Login with credentials.

Receieve:

{
  "email": "string",
  "password": "string"
}

Response:

{
  "token": "string"
}

Errors:

400 Bad Request

{
  "ok": false,
  "error": "{ERROR_KIND}"
}

{ERROR_KIND} can be:

  • email_not_found
  • invalid_password

GET /account/session

Get info about current session.

authentication required

Response:

{
  "email": "string"
}