-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathendpoints.txt
151 lines (132 loc) · 3.42 KB
/
endpoints.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
Endpoints:
- /api/v1/pricing/current ['GET'] - gets price for a charger id and time
- /api/v1/pricing/<int:schedule_id> ['PATCH'] - updates the price of only one time bin of a certain schedule
- /api/v1/schedules/<string:charger_id> ['PUT'] - updates the schedule for a charger id to a new schedule id
- /api/v1/schedules/<int:schedule_id> ['DELETE'] - deletes a schedule, its relations and time bins
- /api/v1/schedules ['POST'] - adds a new schedule with respective time bins
Response/ Request Contracts:
------------------------------------------------------------
Gets price for a charger id and time, ignoring schedule active column for now
------------------------------------------------------------
- /api/v1/pricing/current ['GET']
Request:
Query Parameters:
charger_id (required): Integer
time (required): String (format: "HH:MM")
Response:
Status Code: 200 OK
Body:
[
{
"charger_id": Integer,
"start_time": String,
"end_time": String,
"price_per_kwh": Float
}
]
Error Code 400:
{
"error": "Missing required parameters"
}
------------------------------------------------------------
Updates the price of only one time bin of a certain schedule
------------------------------------------------------------
- /api/v1/pricing/<int:schedule_id> ['PATCH']
Path Parameter:
schedule_id: Integer
Body:
{
"start_time": String,
"end_time": String,
"price_per_kwh": Float
}
Respone:
Status Code: 200 OK
{
"message": "Price updated successfully."
}
Error Response 400:
{
"error": "Missing required fields"
}
Error Response 404:
{
"error": "No matching time slot found."
}
Error Response 500:
{
"error": "internal server error"
}
------------------------------------------------------------
Updates the schedule for a charger id to a new schedule id, ignoring times for now
------------------------------------------------------------
- /api/v1/schedules/<int:charger_id> ['PUT']
Request:
Path Parameter:
charger_id: int
Body:
{
"schedule_id": int
}
Responee:
Status Code: 200 OK
Body:
{
"message": "Schedule updated successfully."
}
Error Response (400 Bad Request):
{
"error": "Missing schedule ID"
}
------------------------------------------------------------
Deletes a schedule, its relations and time bins
------------------------------------------------------------
- /api/v1/schedules/<int:schedule_id> ['DELETE']
Request:
Path Parameter:
schedule_id: Integer
Response:
Status Code: 200 OK
{
"message": "Schedule deleted successfully."
}
Error Response (404 Not Found):
{
"error": "No schedule found to delete."
}
Error Response (500 Internal Server Error):
{
"error": "internal server error"
}
------------------------------------------------------------
Adds a new schedule with respective time bins
------------------------------------------------------------
- /api/v1/schedules ['POST']
Request:
Body:
{
"schedule_name": String,
"effective_from": String,
"effective_to": String,
"time_slots": [
{
"start_time": String,
"end_time": String,
"price_per_kwh": Float
}
]
}
Response:
Status Code: 201 Created
{
"message": "Schedule and time slots created successfully.",
"schedule_id": Integer
}
Error Response (400 Bad Request):
{
"error": "Missing required fields"
}
Error Response (500 Internal Server Error):
{
"error": "internal server error"
}