WebAPI Administrator Specifications - STUDY-GRP/am-server GitHub Wiki

WebAPI Specifications - Administrator

Administrator Side


ログインAPI

概要

クライアント側は管理ユーザーIDとパスワード「:」で繋ぎBase64エンコードしたものをAuthorizationヘッダに付加してリクエストを送信する。
サーバー側は認証を行いレスポンスとしてCookieにセッションIDを設定して返す。
Request URL https://[hostname]/admin/api/1.0/login
HTTP Method POST

Request

サンプルリクエスト

POST /admin/api/1.0/login HTTP/1.1
Host: [hostname]
Authorization:Basic bXlfdXNlcmlkOnBhc3N3b3Jk
Cache-Control:no-cache
Connection:keep-alive。

Response

サンプルレスポンス

HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Cache-Control: no-store
Set-Cookie:sessionid=7f2723289705...5d5b08d9f4;
Pragma: no-cache

{
    "header": {
        "errorcode": "",
        "message": ""
    },
    "body": {username: "テスト太郎"}
}

ログアウトAPI

概要

管理機能からログアウトする。
この時、セッションIDはCookieとしてリクエストヘッダに含んで送信する。

Request

Request URL https://[hostname]/admin/api/1.0/logout
HTTP Method GET
サンプルリクエスト

GET /admin/api/1.0/logout HTTP/1.1
Host: [hostname]
Cookie: sessionid=cf589e7020964d961c...48f8f1a86a55930a9f4;
Response

サンプルレスポンス

HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Cache-Control: no-store
Pragma: no-cache

{
    "header": {
        "errorcode": "",
        "message": ""
    },
    "body": null
}

ユーザー検索API

概要

ユーザー情報を検索する。
この時、セッションIDはCookieとしてリクエストヘッダに含んで送信する。
Request URL https://[hostname]/admin/api/1.0/user/search?limit=<取得上限>&offset=<開始位置>
HTTP Method GET

Request

サンプルリクエスト

GET /admin/api/1.0/user/search HTTP/1.1
Host: [hostname]
Cookie: sessionid=cf589e7020964d961c...48f8f1a86a55930a9f4;

Response

サンプルレスポンス

HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Cache-Control: no-store
Pragma: no-cache

{
    "header": {
        "errorcode": "",
        "message": ""
    },
    "body": {
        "count": "31",
        "result": [
            {
                "userid": "user01",
                "username": "テストユーザー01",
                "adminflg": "0"
            },
:
:
            {
                "userid": "user10",
                "username": "テストユーザー10",
                "adminflg": "0"
            }
        ]
    }
}

ユーザー登録API

概要

一般ユーザーを登録する。
この時、セッションIDはCookieとしてリクエストヘッダに含んで送信する。
Request URL https://[hostname]/admin/api/1.0/user
HTTP Method POST

Request

サンプルリクエスト

POST /admin/api/1.0/user HTTP/1.1
Host: [hostname]
Cookie:sessionid=7f2723289705...5d5b08d9f4;

{
  "userid": "user31"
  , "username": "テストユーザー31"
  , "password": "password"
  , "repassword": "password"
}
  • userid
    • ユーザーID。必須項目、半角英数字、6文字。
  • username
    • ユーザー名。必須項目、20文字。
  • password
    • パスワード。必須項目、半角英数字、8文字〜16文字。
  • repassword
    • パスワード(再入力)。必須項目、半角英数字、8文字〜16文字。
Response

サンプルレスポンス

HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Cache-Control: no-store
Pragma: no-cache

{
    "header": {
        "errorcode": "",
        "message": ""
    },
    "body": null
}

勤怠取得API

概要

ユーザーと年月を入力して勤怠情報を取得する
この時、セッションIDはCookieとしてリクエストヘッダに含んで送信する。

Request

Request URL https://[hostname]/admin/api/1.0/attendance///
HTTP Method GET
サンプルリクエスト

POST /admin/api/1.0/attendance/user01/2014/11 HTTP/1.1
Host: [hostname]
Cookie:sessionid=7f2723289705...5d5b08d9f4;
Response

サンプルレスポンス

HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Cache-Control: no-store
Pragma: no-cache

{
    "header": {
        "errorcode": "",
        "message": ""
    },
    "body": {
        "year": 2014,
        "month": 11,
        "list": [
            {
                "workday": "2014-11-04",
                "starttime": "09:00",
                "endtime": "18:00"
            },
:
:
            {
                "workday": "2014-11-28",
                "starttime": "09:00",
                "endtime": "18:00"
            }
        ]
    }
}
⚠️ **GitHub.com Fallback** ⚠️