Skip to content
Pirmin Mattmann edited this page Mar 3, 2013 · 9 revisions

DRAFT

In einem erster Schritt werden wir eine API zur Verfügung stellen, welche ausschliesslich zum lesen von Daten dienen wird. Erweiterungen sind natürlich denkbar, geniessen jedoch im Moment nicht die entsprechende Priorität.

Die API wird unter der URL http://api.ecamp3.ch erreichbar sein. Grundsätzlich werden wir mit der API den Grundsätzen eines REST-Interfaces folgen. Dabei gibt es für jede Entität eine eigene Route (URL). Weitere Filter werden als GET-Parameter übergeben.

Für die einzelnen Entitäten können die gültigen URL's hier gefunden werden:
Wichtig - sämtliche Daten werden entsprechend des authentifizierten Users gefiltert

User

GET http://api.ecamp3.ch/v1/users.json?offset=0&limit=10
Liefert alle (für den authentifizierten User sichtbaren) User

[  
  {  
    "id": "1a2b",  
    "href": "http://api.ecamp3.ch/v1/users/1a2b.json",  
    "firstname": "MyFirstname",  
    "surname": "MySurname",  
    "scoutname": "MyScoutname"  
  },
  {
    "id": "3c4d",  
    "href": "http://api.ecamp3.ch/v1/users/3c4d.json",  
    "firstname": "Firstname",  
    "surname": "Surname",  
    "scoutname": "Scoutname"
  }   
]

GET http://api.ecamp3.ch/v1/users/1a2b.json
Liefert den User mit der ID = '1a2b'

{  
  "id": "1a2b",  
  "href": "http://api.ecamp3.ch/v1/users/1a2b.json",  
  "firstname": "MyFirstname",  
  "surname": "MySurname",  
  "scoutname": "MyScoutname",
  
  "camps": {
    "href": "http://api.ecamp3.ch/v1/users/1a2b/camps.json"
  }

  "contributors": {
    "href": "http://api.ecamp3.ch/v1/users/1a2b/contributors.json"
  }
}

PUT http://api.ecamp3.ch/v1/users/1a2b.json
Update des Users mit der ID = '1a2b'

{
  "firstname": "NewFirstname",  
  "surname": "NewSurname",  
  "scoutname": "NewScoutname"  
}

Contributors

GET http://api.ecamp3.ch/v1/contributors.json
Liefert alle Verknüpfungen zwischen User und Lager.

[
  {
    "id": "ucid1",
    "href": "http://api.ecamp3.ch/v1/contributors/ucid1.json",
    "user": {
      "href": "http://api.ecamp3.ch/v1/users/1a2b.json"
    },
    "camp": {
      "href": "http://api.ecamp3.ch/v1/camps/cid1.json"
    },
    "role": "leader"
  },
  {
    "id": "ucid2",
    "href": "http://api.ecamp3.ch/v1/contributors/ucid2.json",
    "user": {
      "href": "http://api.ecamp3.ch/v1/users/3c4d.json"
    },
    "camp": {
      "href": "http://api.ecamp3.ch/v1/camps/cid1.json"
    },
    "role": "guest"
  },
]

GET http://api.ecamp3.ch/v1/camps/cid1/contributors.json Liefert alle Verknüpfungen vom Lager mit der ID = 'cid1'

GET http://api.ecamp3.ch/v1/users/1a2b/contributors.json Liefert alle Verknüpfungen vom User mit der Id = '1a2b'

GET http://api.ecamp3.ch/v1/contributors/ucid1.json
Liefert die User-Lager Verknüpfung mit der ID = 'ucid1'

{
  "id": "ucid1",
  "href": "http://api.ecamp3.ch/v1/contributors/ucid1.json",
  "user": {
    "href": "http://api.ecamp3.ch/v1/users/1a2b.json"
  },
  "camp": {
    "href": "http://api.ecamp3.ch/v1/camps/cid1.json"
  },
  "role": "leader"
}

PUT http://api.ecamp3.ch/v1/contributors/ucid1.json Update einer User-Lager Verknüpfung

{
  "role": "guest"
}

Camp

GET http://api.ecamp3.ch/v1/camps.json?offset=0&limit=10&search=likeFilterForNameAndTitle&past=true
Liefert alle Lager

[
  {
    "id": "camp1",
    "href": "http://api.ecamp3.ch/v1/camps/camp1.json",
    "name": "CampName1"
  },
  {
    "id": "camp2",
    "href": "http://api.ecamp3.ch/v1/camps/camp2.json",
    "name": "CampName2"
  }
]

GET http://api.ecamp3.ch/v1/users/1a2b/camps.json
Liefert alle Lager, bei welchen der User mit der ID = '1a2b' mitarbeitet

GET http://api.ecamp3.ch/v1/users/1a2b/camps.json?owner=true
Liefert alle Lager bei welchen der User mit der ID = '1a2b' der Owner ist

GET http://api.ecamp3.ch/v1/groups/g1/camps.json
Liefert alle Lager, der Gruppe mit der ID = 'g1'

GET http://api.ecamp3.ch/v1/camps/cid1.json
Liefert das Lager mit der ID = 'cid1'

{
  "id": "cid1",
  "href": "http://api.ecamp3.ch/v1/camps/cid1.json",
  "name": "CampName1",

  "periods": {
    "href": "http://api.ecamp3.ch/v1/camps/cid1/periods.json"
  },
  
  "events": {
    "href": "http://api.ecamp3.ch/v1/camps/cid1/events.json"
  },
  
  "contributors": {
    "href": "http://api.ecamp3.ch/v1/camps/cid1/contributors.json"
  }
}

PUT http://api.ecamp3.ch/v1/camp/cid1.json
Update des Lagers mit der ID = 'cid1'

{
  "name": "CampName1"
}

Period

GET http://api.ecamp3.ch/v1/periods.json
Liefert alle Perioden

[
  {
    "id": "pid1",
    "href": "http://api.ecamp3.ch/v1/periods/pid1.json",
    "startDate": 1234567890,
    "name": "Vortrupp"
  },
  {
    "id": "pid3",
    "href": "http://api.ecamp3.ch/v1/periods/pid3.json",
    "startDate": 1234567891,
    "name": "Lager"
  }
]

GET http://api.ecamp3.ch/v1/camps/cid1/periods.json
Liefert alle Perioden vom Lager mit der ID = 'cid1'

GET http://api.ecamp3.ch/v1/periods/pid1.json
Liefert die Periode mit der ID = 'pid1'

{
  "id": "pid1",
  "href": "http://api.ecamp3.ch/v1/periods/pid1.json",
  "startDate": 1234567890,
  "name": "Vortrupp",

  "camp": {
    "href": "http://api.ecamp3.ch/v1/camps/cid1.json"
  },

  "days": {
    "href": "http://api.ecamp3.ch/v1/periods/pid1/days"
  }
}

Day

GET http://api.ecamp3.ch/v1/days.json
Liefert alle Tage

[
  {
    "id": "did1,
    "href": "http://api.ecamp3.ch/v1/days/did1.json",
    "offset": 0
  },
  {
    "id": "did2,
    "href": "http://api.ecamp3.ch/v1/days/did2.json",
    "offset": 1
  }
]

GET http://api.ecamp3.ch/v1/periods/pid1/days.json
Liefert alle Tage der Periode mit der ID = 'pid1'

GET http://api.ecamp3.ch/v1/days/did1.json
Liefert den Tag mit der ID = 'did1'

{
  "id": "did1,
  "href": "http://api.ecamp3.ch/v1/days/did1.json",
  "offset": 0,

  "period": {
    "href": "http://api.ecamp3.ch/v1/periods/pid1.json"
  },

  "eventInstances": {
    "href": "http://api.ecamp3.ch/v1/days/did1/event_instancess.json"
  }
}

Event

GET http://api.ecamp3.ch/v1/events.json
Liefert alle Events

[
  {
    "id": "eid1",
    "href": "http://api.ecamp3.ch/v1/events/eid1.json",
    "title": "EventTitle"
  },
  {
    "id": "eid2",
    "href": "http://api.ecamp3.ch/v1/events/eid2.json",
    "name": "Block-Titel"
  }
]

GET http://api.ecamp3.ch/v1/camps/cid1/events.json
Liefert alle Blöcke von Lager mit der ID = 'cid1'

GET http://api.ecamp3.ch/v1/events/eid1.json
Liefert das Event mit der ID = 'eid1'

{
  "id": "eid1",
  "href": "http://api.ecamp3.ch/v1/events/eid1.json",
  "title": "EventTitle",

  "eventCategory": {
    "href": "http://api.ecamp3.ch/v1/event_categories/ecid1.json"
  },

  "camp": {
    "href": "http://api.ecamp3.ch/v1/camps/cid1.json"
  },

  "eventInstances": {
    "href": "http://api.ecamp3.ch/v1/events/eid1/event_instances.json"
  }
}

Programmblock Planung (Zeit)

GET http://api.ecamp3.ch/v1/event_instances.json
Liefert alle Programmblock planungen

[
  {
    "id": "eiid1",
    "href": "http://api.ecamp3.ch/v1/event_instances/eiid1.json",
    "start": 12342,
    "end": 12464,

    "event": {
      "href": "http://api.ecamp3.ch/v1/events/eid1.json"
    },

    "period": {
      "href": "http://api.ecamp3.ch/v1/periods/pid1.json"
    }
  },
  {
    "id": "eiid2",
    "href": "http://api.ecamp3.ch/v1/event_instances/eiid2.json",
    "start": 22342,
    "end": 22464,

    "event": {
      "href": "http://api.ecamp3.ch/v1/events/eid2.json"
    },

    "period": {
      "href": "http://api.ecamp3.ch/v1/periods/pid1.json"
    }
  }
]

GET http://api.ecamp3.ch/v1/events/eid1/event_instances.json
Liefert alle Planungen des Programmblocks mit der ID = 'eid1'

GET http://api.ecamp3.ch/v1/camps/cid1/event_instances.json
Liefert alle Programmblock Planungen vom Lager mit der ID = 'pid1'

GET http://api.ecamp3.ch/v1/periods/pid1/event_instances.json
Liefert alle Programmblock Planungen der Periode mit der ID = 'pid1'

GET http://api.ecamp3.ch/v1/days/did1/event_instances.json
Liefert alle Programmblock Planungen vom Tag mit der ID = 'did1'

GET http://api.ecamp3.ch/v1/event_instances/eiid1.json
Liefert die Programmblock-Planung mit der ID = 'eiid1'

{
  "id": "eiid1",
  "href": "http://api.ecamp3.ch/v1/event_instances/eiid1.json",
  "start": 12342,
  "end": 12464,

  "event": {
    "href": "http://api.ecamp3.ch/v1/events/eid1.json"
  },

  "period": {
    "href": "http://api.ecamp3.ch/v1/periods/pid1.json"
  }
}

Programmblock Verantwortliche

GET http://api.ecamp3.ch/v1/event_resps.json
Liefert alle Block-Verantwortungen

[
  {
    "id": "erid1",
    "href": "http://api.ecamp3.ch/v1/event_resps/erid1.json",
    "name": null,
    "role": "main",
    
    "event": {
      "href": "http://api.ecamp3.ch/v1/events/eid1.json"
    },

    "contributor": {
      "href": "http://api.ecamp3.ch/v1/user_camps/ucid1.json"
    }
  },
  {
    "id": "erid2",
    "href": "http://api.ecamp3.ch/v1/event_resps/erid2.json",
    "name": "2 Köche",
    "role": "helper",
    
    "event": {
      "href": "http://api.ecamp3.ch/v1/events/eid1.json"
    },

    "contributor": null
  }
]

GET http://api.ecamp3.ch/v1/events/eid1/event_resps.json
Liefert alle Block-Verantwortungen von Block mit der ID = 'eid1'

GET http://api.ecamp3.ch/v1/contributors/cid1/event_resps.json
Liefert alle Block-Verantwortungen vom Contributors mit der ID = 'cid1'

GET http://api.ecamp3.ch/v1/event_resps/erid1.json
Liefert die Block-Verantwortung mit der ID = 'erid1'

{
  "id": "erid1",
  "href": "http://api.ecamp3.ch/v1/event_resps/erid1.json",
  "name": null,
  "role": "main",
    
  "event": {
    "href": "http://api.ecamp3.ch/v1/events/eid1.json"
  },

  "contributor": {
    "href": "http://api.ecamp3.ch/v1/user_camps/ucid1.json"
  }
}

Programmblock Kategorie

GET http://api.ecamp3.ch/v1/event_categories.json
Liefer alle Block-Kathegorien

[
  {
    "id": "ecid1",
    "href": "http://api.ecamp3.ch/v1/event_categories/ecid1.json",
    "name": "Lagersport",
    "prefix": "LS",
    "style": "A"
  },
  {
    "id": "ecid2",
    "href": "http://api.ecamp3.ch/v1/event_categories/ecid2.json",
    "name": "Lageraktivität",
    "prefix": "LA",
    "style": "1"
  }
]

GET http://api.ecamp3.ch/v1/camps/cid1/event_categories.json
Liefert die Block-Kathegorien vom Lager mit der ID = 'cid1'

GET http://api.ecamp3.ch/v1/event_categories/ecid1.json
Liefert die Block-Kathegorie mit der ID = 'ecid1'

{
  "id": "ecid1",
  "href": "http://api.ecamp3.ch/v1/event_categories/ecid1.json",
  "name": "Lagersport",
  "prefix": "LS",
  "style": "A"
}