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
- request: /person/search?q="張"
- {
- "paging": {
- "count": 111,
- "l": 2,
- "sk": 0
- },
- "entries": [
- {s
-
- "memberships": [
- ...
- ],
- "name": "張建榮",
- "id": 1
- },
- {
- "memberships": [
- ...
- ],
- "name": "張漢東",
- "id": 11
- }
- ],
- "query": "(\"name\" ~* ’張’)"
- }
- /: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
- /:person/:person_id/
- 這邊就直接寫 person 如何?
- 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:
organization:
/organzations/
Person
/person/
Membership:
/membership/