Skip to content

RestApi.Controller.Account

Alex Ander edited this page Apr 14, 2018 · 1 revision

Available actions

Error codes


Available actions

Authentication

Returns json data about a user authentication.

  • URL

    /api/account

  • Method:

    POST

  • Body Params

    Login=[string]&Password=[string]

  • Success Response:

    Content: { data: { token: "f5981hasdh1jas8912345" } }

  • Error Response:

    Content: { errors: [ "1001" ] }

  • Sample Call:

      var payload = {
          Login: 'username2O18',
          Password: '~$up3r_p@$$w0rd'
      };
      fetch('http://localhost:5000/api/account', {
          method: 'POST',
          body: JSON.stringify(payload),
          headers: {
              'Accept': 'application/json, text/plain, */*',
              'Content-Type': 'application/json'
          }
      })
          .then((response) => response.text())
          .then((data) => console.log(data));

CheckToken

Returns json data about a userToken validation.

  • URL

    /api/account

  • Method:

    PATCH

  • Body Params

    Token=[string]

  • Success Response:

    Content: { data: { status: 1 } }

  • Error Response:

    Content: { data: { status: 0 } }

  • Sample Call:

      var payload = {
          Token: 'f5981hasdh1jas8912345'
      };
      fetch('http://localhost:5000/api/account', {
          method: 'PATCH',
          body: JSON.stringify(payload),
          headers: {
              'Accept': 'application/json, text/plain, */*',
              'Content-Type': 'application/json'
          }
      })
          .then((response) => response.text())
          .then((data) => console.log(data));

Register

Returns json data about a user register.

  • URL

    /api/account

  • Method:

    PUT

  • Body Params

    Login=[string]&Password=[string]

  • Success Response:

    Content: { data: { token: "f5981hasdh1jas8912345" } }

  • Error Response:

    Content: { errors: [ "1000" ] }

  • Sample Call:

      var payload = {
          Login: 'username2O18',
          Password: '~$up3r_p@$$w0rd'
      };
      fetch('http://localhost:5000/api/account', {
          method: 'PUT',
          body: JSON.stringify(payload),
          headers: {
              'Accept': 'application/json, text/plain, */*',
              'Content-Type': 'application/json'
          }
      })
          .then((response) => response.text())
          .then((data) => console.log(data));

Error codes

Validation codes

  • "1" - Login is required
  • "2" - Login must be a minimum of 3 characters
  • "3" - Login must be a maximum of 12 characters
  • "4" - The Login can consist only of letters and numbers
  • "5" - Password is required
  • "6" - Password must be a minimum of 8 characters
  • "7" - Password is too long

Processing codes

  • "1000" - Login already exists
  • "1001" - Incorrect Login or Password

Clone this wiki locally