# Enterprise API

# Interface

  • GET /users?timestamp={long} @returns Response<User>

  • GET /depts?timestamp={long} @returns Response<Dept>

  • GET /posts?timestamp={long} @returns Response<Post>

  • GET /occupies?timestamp={long} @returns Response<Occupy>

    NOTICE: the 4 URIs could be in any other forms but "users"/"depts"/"posts"/"occupies" must exist and be the only difference.

    • eg. http://example.com/get_users_since (and /get_depts_since, etc.)

# Parameters

  • timestamp: optional.
    • unix timestamp(seconds from 1970/01/01), only return entities that last update >= timestamp
    • each interface could be incremental or not
    • if implementation can't return incremental results, just bypass the parameter, and please make sure all returned entities[i].timestamp is null

# Data struct

  • Response<T>:
{
    "errno": {int},          // 0 for success, else for failed
    "error": {string},       // if failed, user friendly error message
    "entities": List<T>,     
    "total": {int}           // nullable, total entity count for pagination. 
}
1
2
3
4
5
6
  • User:
{ 
    "account": {string},    // not null 
    "name": {string},       // not null 
    "email": {string},
    "phone": {string},
    "timestamp": {long},
    "disabled": {boolean}
}
1
2
3
4
5
6
7
8
  • Dept:
{ 
    "organizeId": {string},       // not null 
    "organizeName": {string},     // not null 
    "parentOrganizeId": {string}, // nullable    
    "independent": {boolean}, // true for top-level depts. sometimes parent=null is only adequate
    "timestamp": {long},
    "disabled": {boolean}
}
1
2
3
4
5
6
7
8
  • Post:
{ 
    "postCode": {string},   // not null 
    "postName": {string},   // not null 
    "formal": {boolean},    // true for triple of this post to mark a user's "official" dept  
    "bizTypes": [{          // business types(refer to code.name) that related to this posts 
       "bizType": {string}
     }], 
    "timestamp": {long},
    "disabled": {boolean}
}
1
2
3
4
5
6
7
8
9
10
  • Occupy:
{ 
    "account": {string},    // not null
    "postCode": {string},   // not null
    "deptCode": {string},   // not null 
    "userCode": {string},   // nullable, student number or any other numbers that corresponding to his/her post.
    "timestamp": {long}, 
    "disabled": {boolean},
    // the 4th dimension for triple, added since 2020/03/02 
    "bizes": [{            // not required. NOTICE "null" is not acceptable for "Array"(see http://json.org/)
      "bizType": {string},     // business type, better pairs with a code.name
      "bizCode": {string}      // business code, better pairs with a code item.code
    }]
    
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14