addressbook-api

最後編輯:2018-08-18 建立:2014-04-05 歷史紀錄

SUPERBILServer: http://pgrest.io/hychen/api.addressbook/v0/collections/

server is base on PgREST 投影片

how to host api.addressbook at local

 

目前使用新的方案 Popit API文件在此

server: https://taiwan.popit.mysociety.org/

 

    SUPERBILserver side

SUPERBIL:type is organization, person, membership

 

Search

  • KUANG-CHE Lglobal search
  • /search?q="keyword"

 

  • SUPERBILsearch on type
  • request: /person/search?q="張"
  • {
  • "paging": {
  • "count": 111,
  • "l": 2,
  • "sk": 0
  • },
  • "entries": [
  • {s
  • HISNYI C
  • SUPERBIL "memberships": [
  • ...
  • ],
  • "name": "張建榮",
  • "id": 1
  • },
  • {
  • "memberships": [
  • ...
  • ],
  • "name": "張漢東",
  • "id": 11
  • }
  • ],
  • "query": "(\"name\" ~* '張')"
  • }

 

 

  • KUANG-CHE Lscope search
  • /:type/:subtype/:subtype_id/:name/search?q="keyword"

 

  • SUPERBILrequest: /person/memberships/2/name/search?q="張"
  • {
  • "paging": {
  • "count": 5,
  • "l": 2,
  • "sk": 0
  • },
  • "entries": [
  • {
  • "memberships": [
  • {
  • id: 2,
  • role: "黨員"
  • ...
  • }
  • ...
  • ],
  • "name": "張建榮",
  • "id": 1
  • },
  • {
  • "memberships": [
  • {
  • id: 2,
  • role: "黨員"
  • ...
  • }
  • ...
  • ],
  • "name": "張漢東",
  • "id": 11
  • }
  • ],
  • "query": "(\"name\" ~* '張')"
  • }

 

 

KUANG-CHE LResource

  • SUPERBILone data with id
  • /:person/:person_id/
  • 這邊就直接寫 person 如何?
    • Superbil讓他是個變數,這樣比較好懂 :smile:
      Superbilperson不是固定的 string 嗎? 應該不會變了吧
      Superbil除了 person 外還有 organiztaion 和 membership 阿
  • KUANG-CHE Lrequest: /person/1
  • SUPERBIL{
  • name:"Foo Bar"
  • memberships: [
  • {
  • id: 1,
  • role: "議長"
  • ...
  • },
  • {
  • id: 2,
  • role: "黨員"
  • ...
  • }
  • ]
  • ...
  • }

 

    SUPERBILBase mapping

  • SUPERBILpaging:
    • count // 總數
    • l // 長度
    • sk // offset 位置
    • HISNYI Cfo: only return entry if fo is true
    • c: only return count if c is true
  • SUPERBILentries:
  • 資料的 array
  • query:
  • 查詢的條件

 

    SUPERBILorganization:

SUPERBIL/organzations/

  • entries:

 

    SUPERBILPerson

SUPERBIL/person/

  • entries:
  • popolo.person

 

    SUPERBILMembership:

SUPERBIL/membership/