-
Notifications
You must be signed in to change notification settings - Fork 1
Backend API Dokumentation
Deebronee edited this page Mar 20, 2022
·
6 revisions
Auf dieser Seite sind alle Endpunkte des Backends dokumentiert.
Das Git Repository des Backends finden sie hier
Details
URL | /appointments?date=YYYY-MM-DD |
Methoden | GET |
URL Parameter | Benötigt: date=[dateField]
|
-
JSON Response:
Code:
200
[{
"start": "2022-02-15T12:00:00",
"duration": 60
},
{
"start": "2022-02-15T12:00:00",
"duration": 60
},
{
"start": "2022-02-15T12:00:00",
"duration": 60
}
]
Details
URL | /appointment |
Methoden | POST |
- JSON Anfrage:
{
"start": "2022-02-15T12:00:00",
"duration": 60,
"person": {
"name": "Max Mustermann",
"birthday": "2000-01-01",
"gender": "male",
"firstDonation": true,
"telephoneNumber": "123456"
}
}
-
JSON Response:
Code:
201
{
"id": 1,
"start": "2022-02-15T12:00:00",
"duration": 60,
"person": {
"id": 1,
"name": "Max Mustermann",
"birthday": "2000-01-01",
"gender": "male",
"firstDonation": true,
"telephoneNumber": "123456"
},
"request": {
"id": 1,
"created": "2022-02-15T11:57:13.094841",
"status": "requested"
}
}
Details
URL | /appointment_status?id=0 |
Methoden | GET |
URL Parameter | Benötigt: id=[Integer] vom Termin |
-
JSON Response:
Code:
200
WARNUNG/ BUG: Der Response ist bisher noch zusätzlich in eine Liste gekapselt!
{
"id": 1,
"request": {
"id": 1,
"created": "2022-02-15T11:57:13.094841",
"status": "requested"
}
}
Details
URL | /appointment_cancel?id=0 |
Methoden | GET |
URL Parameter | Benötigt: id=[Integer]
|
-
Erfolgreiche Anfrage:
Code:
200
successful
Details
URL | /faqquestions |
Methoden | GET |
-
JOSN Response:
Code:
200
{
"faqQuestions": [
{
"id": 0,
"position": 0
},
...
],
"faqQuestionTranslations": [
{
"id": 0,
"head": "",
"body": "",
"language": "",
"faqQuestion": 0
},
...
]
}
Details
URL | /donationquestions |
Methoden | GET |
-
Erfolgreiche Anfrage:
Code:
200
{
"donationQuestions": [
{
"id": 0,
"position": 0,
"isYesCorrect": false
},
...
],
"donationQuestionTranslations": [
{
"id": 0,
"body": "",
"language": "",
"donationQuestion": 0
},
...
]
}
URL für den Websocket: /websocket
Details
action | createAppointment |
data | Appointment |
- JSON Anfrage:
{
"action":"createAppointment",
"request_id": 0,
"data":{
"start":"2022-01-11T12:00:00",
"duration":60,
"person":{
"name":"Websocket Tester",
"birthday":null,
"gender":""
}
}
}
- JSON Response:
fields | action, request_id, response_status, errors, data |
{
"id": 0,
"start": "YYYY-MM-DDTHH:mm:SS",
"duration": 15,
"person": {
"id": 0,
"name": "John Doe",
"birthday": "YYYY-MM-DD",
"gender": "male",
"firstDonation": true,
"telephoneNumber": "123456789"
},
"request": {
"id": 0,
"created": "YYYY-MM-DDTHH:mm:ss.000000",
"status": "requested"
}
}
Details
action | createCapacities |
data | Capacity |
- JSON Anfrage:
{
"action":"createCapacities",
"request_id":123,
"data":[
{
"start":"2022-01-01T12:00:00",
"duration":180,
"slots":30
},
{
"start":"2022-01-01T14:00:00",
"duration":120,
"slots":10
}
]
}
- JSON Response:
fields | action, request_id, response_status, errors, data |
{
"errors":[],
"data":[
{
"id":3,
"start":"2022-01-01T12:00:00",
"duration":180,
"slots":30
},
{
"id":4,
"start":"2022-01-01T14:00:00",
"duration":120,
"slots":10
}
],
"action":"createCapacities",
"response_status":201,
"request_id":123
}
Details
action | createDonationQuestions |
data | DonationQuestion |
- JSON Anfrage:
{
"action":"createDonationQuestions",
"request_id":123,
"data":{
"translationData":[
{
"id":1,
"body":"Test1",
"language":"de_DE",
"donationQuestion":1
},
{
"id":2,
"head":"Test2",
"body":"Test2",
"language":"fr_FR",
"donationQuestion":2
}
],
"questionData":[
{
"id":1,
"position":0,
"isYesCorrect":true
},
{
"id":2,
"position":1,
"isYesCorrect":true
}
]
}
}
- JSON Response:
fields | action, request_id, response_status, errors, data |
{
"errors":[],
"data":{
"donationQuestions":[
{
"id":1,
"position":0,
"isYesCorrect":true
},
{
"id":2,
"position":1,
"isYesCorrect":true
}
],
"donationQuestionTranslations":[
{
"id":1,
"body":"Test1",
"language":"de_DE",
"donationQuestion":1
},
{
"id":2,
"body":"Test2",
"language":"fr_FR",
"donationQuestion":2
}
]
},
"action":"createDonationQuestions",
"response_status":201,
"request_id":123
}
Details
action | createFaqQuestion |
data | FaqQuestion |
- JSON Anfrage:
{
"action":"createFaqQuestions",
"request_id":123,
"data":{
"translationData":[
{
"id":1,
"head":"Test1",
"body":"Test1",
"language":"de_DE",
"faqQuestion":1
},
{
"id":2,
"head":"Test2",
"body":"Test2",
"language":"fr_FR",
"faqQuestion":2
}
],
"questionData":[
{
"id":1,
"position":0
},
{
"id":2,
"position":1
}
]
}
}
- JSON Response:
fields | action, request_id, response_status, errors, data |
{
"errors":[],
"data":{
"faqQuestions":[
{
"id":1,
"position":0
},
{
"id":2,
"position":1
}
],
"faqQuestionTranslations":[
{
"id":1,
"head":"Test1",
"body":"Test1",
"language":"de_DE",
"faqQuestion":1
},
{
"id":2,
"head":"Test2",
"body":"Test2",
"language":"fr_FR",
"faqQuestion":2
}
]
},
"action":"createFaqQuestions",
"response_status":201,
"request_id":123
}
Details
action | getAllAppointments |
data | Appointment |
- JSON Anfrage:
{
"action":"getAllAppointments",
"request_id":123
}
- JSON Response:
fields | action, request_id, response_status, errors, data |
{
"errors":[],
"data":[
{
"id":1,
"start":"2022-02-15T12:00:00",
"duration":60,
"person":{
"id":1,
"name":"Max Mustermann",
"birthday":"2000-01-01",
"gender":"male",
"firstDonation":true,
"telephoneNumber":"123456"
},
"request":{
"id":1,
"created":"2022-02-15T11:57:13.094841",
"status":"requested"
}
}
],
"action":"getAllAppointments",
"response_status":200,
"request_id":123
}
Details
action | getAllCapacities |
data | Capacity |
- JSON Anfrage:
{
"action":"getAllCapacities",
"request_id":123
}
- JSON Response:
fields | action, request_id, response_status, errors, data |
{
"errors":[],
"data":[
{
"id":3,
"start":"2022-01-01T12:00:00",
"duration":180,
"slots":30
},
{
"id":4,
"start":"2022-01-01T14:00:00",
"duration":120,
"slots":10
}
],
"action":"getAllCapacities",
"response_status":200,
"request_id":123
}
Details
action | updateAppointment |
data | Appointment |
- JSON Anfrage:
{
"action":"updateAppointment",
"request_id":123,
"data":{
"id":1,
"request":{
"created":"2024-01-01T00:00:00",
"status":"accepted"
}
}
}
- JSON Response:
fields | action, request_id, response_status, errors, data |
{
"errors":[],
"data":{
"id":1,
"start":"2022-01-01T12:08:00",
"duration":10,
"person":{
"id":1,
"name":"Test",
"birthday":"2022-03-03",
"gender":"",
"firstDonation":true,
"telephoneNumber":""
},
"request":{
"id":1,
"created":"2024-01-01T00:00:00",
"status":"accepted"
}
},
"action":"updateAppointment",
"response_status":200,
"request_id":123
}
Details
action | deleteAppointment |
data | Appointment |
- JSON Anfrage:
{
"action":"deleteCapacity",
"request_id":123,
"id":1
}
- JSON Response:
fields | action, request_id, response_status, errors, data |
{
"errors":[],
"data":"success",
"action":"deleteAppointment",
"response_status":204,
"request_id":123
}
Details
action | newAppointments |
data | Appointment |
- JSON Anfrage:
{
"action":"newAppointments",
"request_id":123,
"data":{
"id":2
}
}
- JSON Response:
fields | action, request_id, response_status, errors, data |
-
Code: 200
Content:
{
"errors":[],
"data":[
{
"id":3,
"start":"2022-01-01T12:00:00",
"duration":60,
"person":{
"id":1,
"name":"Max Mustermann",
"birthday":"2000-01-01",
"gender":"male",
"firstDonation":true,
"telephoneNumber":"123456"
},
"request":{
"id":3,
"created":"2022-03-09T12:29:14.692562",
"status":"pending"
}
},
{
"id":4,
"start":"2022-01-01T12:00:00",
"duration":60,
"person":{
"id":1,
"name":"Max Mustermann",
"birthday":"2000-01-01",
"gender":"male",
"firstDonation":true,
"telephoneNumber":"123456"
},
"request":{
"id":4,
"created":"2022-03-09T12:29:15.176562",
"status":"pending"
}
}
],
"action":"newAppointments",
"response_status":200,
"request_id":123
}
Details
action | getAllFaqQuestions |
data | FaqQuestion |
- JSON Anfrage:
{
"action":"getAllFaqQuestions",
"request_id":123
}
- JSON Response:
fields | action, request_id, response_status, errors, data |
-
Code: 200
Content:
{
"errors":[],
"data":{
"faqQuestions":[
{
"id":1,
"position":0
},
{
"id":2,
"position":1
}
],
"faqQuestionTranslations":[
{
"id":1,
"head":"Test1",
"body":"Test1",
"language":"de_DE",
"faqQuestion":1
},
{
"id":2,
"head":"Test2",
"body":"Test2",
"language":"fr_FR",
"faqQuestion":2
}
]
},
"action":"getAllFaqQuestions",
"response_status":200,
"request_id":123
}
Details
action | getAllDonationQuestions |
data | DonationQuestion |
- JSON Anfrage:
{
"action":"getAllDonationQuestions",
"request_id":123
}
- JSON Response:
fields | action, request_id, response_status, errors, data |
-
Code: 200
Content:
{
"errors":[],
"data":{
"donationQuestions":[
{
"id":1,
"position":0,
"isYesCorrect":true
},
{
"id":2,
"position":1,
"isYesCorrect":true
}
],
"donationQuestionTranslations":[
{
"id":1,
"body":"Test1",
"language":"de_DE",
"donationQuestion":1
},
{
"id":2,
"body":"Test2",
"language":"fr_FR",
"donationQuestion":2
}
]
},
"action":"getAllDonationQuestions",
"response_status":200,
"request_id":123
}
Details
action | getStatistic |
data | Statistic |
- JSON Anfrage:
{
"action":"getStatistic",
"request_id":123
}
- JSON Response:
fields | action, request_id, response_status, errors, data |
-
Code: 200
Content:
{
"errors":[],
"data":[
{
"id":1,
"numberOfFirstTimeDonations":0,
"totalBookedAppointments":4,
"aged18to27":0,
"aged28to37":0,
"aged38to47":0,
"aged48to57":0,
"aged58to68":0,
"acceptedRequests":0,
"rejectedRequests":0,
"cancelledRequests":1
}
],
"action":"getStatistic",
"response_status":200,
"request_id":123
}
Details
Termine, die länger als zwei Wochen zurückliegen, werden jeden Tag um 0.00 Uhr gelöscht. Hierzu wird das Package django-crontab genutzt. Die Funktion cron_job() in der Datei cron in der adminApi wird durch diese Package geplant und filtert und löscht alle Termine, die der Bedingung (Startdatum älter als vierzehn Tage) entsprechen. Wichtig: Django-crontabs funktioniert nicht unter Windows.