addressbook-api

編輯歷史

時間 作者 版本
2017-07-03 06:23 (unknown) r2
顯示 diff
- addressbook-api
+ addressbook-api
Server: http://pgrest.io/hychen/api.addressbook/v0/collections/
server is base on PgREST 投影片
(131 行未修改)
2017-07-01 15:10 – 15:10 (unknown) r0 – r1
顯示 diff
+ addressbook-api
+ Server: 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/
+
+ *server side
+ :type is organization, person, membership
+
+ Search
+ *global search
+ */search?q="keyword"
+
+ *search on type
+ *request: /person/search?q="張"
+ *{
+ * "paging": {
+ * "count": 111,
+ * "l": 2,
+ * "sk": 0
+ * },
+ * "entries": [
+ * {s
+ *
+ * "memberships": [
+ * ...
+ * ],
+ * "name": "張建榮",
+ * "id": 1
+ * },
+ * {
+ * "memberships": [
+ * ...
+ * ],
+ * "name": "張漢東",
+ * "id": 11
+ * }
+ * ],
+ * "query": "(\\"name\\" ~* '張')"
+ *}
+
+
+ *scope search
+ */:type/:subtype/:subtype_id/:name/search?q="keyword"
+
+ *request: /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\\" ~* '張')"
+ *}
+
+
+ Resource
+ *one data with id
+ */:person/:person_id/
+ *這邊就直接寫 person 如何?
+ *讓他是個變數,這樣比較好懂 :smile:
+ *person不是固定的 string 嗎? 應該不會變了吧
+ *除了 person 外還有 organiztaion 和 membership 阿
+ *
+ *request: /person/1
+ *{
+ * name:"Foo Bar"
+ * memberships: [
+ * {
+ * id: 1,
+ * role: "議長"
+ * ...
+ * },
+ * {
+ * id: 2,
+ * role: "黨員"
+ * ...
+ * }
+ * ]
+ * ...
+ *}
+
+ *Base mapping
+ *paging:
+ *count // 總數
+ *l // 長度
+ *sk // offset 位置
+ *fo: only return entry if fo is true
+ *c: only return count if c is true
+ *entries:
+ *資料的 array
+ *query:
+ *查詢的條件
+
+ *organization:
+ /organzations/
+ *entries:
+ *popolo.organzation
+
+ *Person
+ /person/
+ *entries:
+ *popolo.person
+ *Membership:
+ /membership/