api_docs/authentication/http.apib

Summary

Maintainability
Test Coverage
# Authentication
Reference for http authentication. `Access Key Tokens` are used to access and consume
most of POSko APIs.

## Sign In [/sign_in]

### Request an access token [POST]
Sign in using user credentials

+ Request (application/json)

  + Body

            {
              "account_name": "{{account_name}}a",
              "email": "{{email}}",
              "password": "{{password}}"
            }

  + Schema

            {
              "$schema": "http://json-schema.org/draft-04/schema#",
              "type": "object",
              "properties": {
                "account_name": {
                  "type": "string"
                },
                "email": {
                  "type": "string"
                },
                "password": {
                  "type": "string"
                }
              }
            }


+ Response 200 (application/json)

        {
          "access_key": {
            "id": 1,
            "access_key_status": 0,
            "auth_token": "Jg226wqyfxS4v4L7owfj6oQc",
            "created_at": "2019-11-23T12:25:09.412Z",
            "status": "active",
            "token": "pr7FgjkL3S39nkjMRFzgDC87",
            "updated_at": "2019-11-23T12:25:09.412Z"
          },
          "user": {
            "id": 1,
            "account_id": 1,
            "created_at": "2019-11-20T11:49:10.408Z",
            "email": "posko@example.com",
            "first_name": "Juan",
            "last_name": "Dela Cruz",
            "middle_name": null,
            "status": "active",
            "suffix": null,
            "title": null,
            "updated_at": "2019-11-20T11:49:10.408Z",
            "user_status": 0,
            "user_type": null
          }
        }

+ Response 401 (application/json)

        {
          "message": "Invalid credentials"
        }