forked from technologiestiftung/giessdenkiez-de-postgres-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapi.http
More file actions
248 lines (162 loc) · 6.51 KB
/
api.http
File metadata and controls
248 lines (162 loc) · 6.51 KB
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
@SUPABASE_URL = http://localhost:54321
@SUPABASE_ANON_KEY = eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0
@SUPABASE_SERVICE_ROLE_KEY = eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImV4cCI6MTk4MzgxMjk5Nn0.EGIM96RAZx35lJzdJsyH-qQwv8Hdp7fsn3W0YpN81IU
# --------------------------------------------------
@protocol = http
@host = localhost
@port = 8080
@API_HOST = {{protocol}}://{{host}}:{{port}}
@TREE_ID = _2100186a5c
@USER_ID = auth0|abc
@USER_NAME = foo
#SUPABASE VARS
@SUPABASE_USER_EMAIL = someone@email.com
@SUPABASE_USER_PASSWORD = 1234567890
@SUPABASE_USER_UUID = db640d6c-1ac9-4a4d-accc-0adacbf6d9ad
@SUPABASE_USER_NAME = someone
@SUPABASE_USER_ACCESS_TOKEN = eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoZW50aWNhdGVkIiwiZXhwIjoxNjc5NDE4Mzc1LCJzdWIiOiI2NmE2ZWNjZS1hZDNhLTRkODctOTIzZS02OTFhMzFhYTMyNjMiLCJlbWFpbCI6ImZhYmlhbm1vcm9uemlyZmFzQHByb3Rvbm1haWwuY2giLCJwaG9uZSI6IiIsImFwcF9tZXRhZGF0YSI6eyJwcm92aWRlciI6ImVtYWlsIiwicHJvdmlkZXJzIjpbImVtYWlsIl19LCJ1c2VyX21ldGFkYXRhIjp7fSwicm9sZSI6ImF1dGhlbnRpY2F0ZWQiLCJhYWwiOiJhYWwxIiwiYW1yIjpbeyJtZXRob2QiOiJwYXNzd29yZCIsInRpbWVzdGFtcCI6MTY3OTQxNDc3NX1dLCJzZXNzaW9uX2lkIjoiOWYxYWM4OWItYTU4NC00Mjg5LWIxYWItY2IxNTBmYWZlMmVkIn0.QKf89g4ASbyC4txyHBWh7A_-nQyL93uY694S1Wm8TIY
# @API_HOST = https://giessdenkiez-de-postgres-api-git-dev-technologiestiftung1.vercel.app
##### ####### #######
# # # #
# # #
# #### ##### #
# # # #
# # # #
##### ####### #
### Healthcheck
GET {{API_HOST}}
### v3
GET {{API_HOST}}/v3
### GET tree by its id byid ✓
GET {{API_HOST}}/get/byid&id={{TREE_ID}}
### GET a list of all waterd trees ✓
GET {{API_HOST}}/get/watered
### GET list of trees from an list of ids ✓
GET {{API_HOST}}/get/treesbyids&tree_ids={{TREE_ID}},_21002949fc
### GET a list of trees with the properities ✓
# adopted (how many users)
# waterd how often in the last 30days
GET {{API_HOST}}/get/wateredandadopted
### GET a list of trees with the properities ✓
# adopted (how many users)
# waterd how often in the last 30days
GET {{API_HOST}}/get/wateredandadopted?limit=4&offset=5
### get all trees with id, lat, lon, radolan_sum ✓
# with pagination
GET {{API_HOST}}/get/all&limit=4&offset=5
### get all trees
GET {{API_HOST}}/get/all
### GET trees by age
GET {{API_HOST}}/get/byage&start=1800&end=2023
### GET trees by age
GET {{API_HOST}}/get/byage&start=1800&end=2023&limit=10000&offset=0
### GET count of trees by age ✓
GET {{API_HOST}}/get/countbyage&start=1800&end=2023
########################
#
# SUPABASE AUTH
#
#########################
### Signup
POST {{SUPABASE_URL}}/auth/v1/signup
apikey: {{SUPABASE_ANON_KEY}}
Content-Type: application/json
{
"email": "{{SUPABASE_USER_EMAIL}}",
"password": "{{SUPABASE_USER_PASSWORD}}"
}
### Login
POST {{SUPABASE_URL}}/auth/v1/token?grant_type=password
apikey: {{SUPABASE_ANON_KEY}}
Content-Type: application/json
{
"email": "{{SUPABASE_USER_EMAIL}}",
"password": "{{SUPABASE_USER_PASSWORD}}"
}
### Login with magic link
# look ont oinbucket of the email
# http://localhost:54324
POST {{SUPABASE_URL}}/auth/v1/magiclink
apikey: {{SUPABASE_ANON_KEY}}
Content-Type: application/json
{
"email": "{{SUPABASE_USER_EMAIL}}"
}
### Get user JSON
GET {{SUPABASE_URL}}/auth/v1/user
apikey: {{SUPABASE_ANON_KEY}}
Content-Type: application/json
Authorization: Bearer {{SUPABASE_USER_ACCESS_TOKEN}}
### Password recovery
# in local developement look into the inbuckt of the email
# http://localhost:54324
# This will send you to http://localhost:3000 ???
# with a token und the recovery url Param
POST {{SUPABASE_URL}}/auth/v1/recover
apikey: {{SUPABASE_ANON_KEY}}
Content-Type: application/json
{
"email": "{{SUPABASE_USER_EMAIL}}"
}
### Update the user data password and/or email
# data is optional
PUT {{SUPABASE_URL}}/auth/v1/user
apikey: {{SUPABASE_ANON_KEY}}
Authorization: Bearer {{SUPABASE_USER_ACCESS_TOKEN}}
Content-Type: application/json
{
"email": "{{SUPABASE_USER_EMAIL}}",
"password": "{{SUPABASE_USER_PASSWORD}}",
"data": {
"key": "value"
}
}
### Logout
POST {{SUPABASE_URL}}/auth/v1/logout
apikey {{SUPABASE_ANON_KEY}}
Authorization: Bearer {{SUPABASE_USER_ACCESS_TOKEN}}
########################
#
# SUPABASE AUTH END
#
#########################
# ██████ ██ ██ ██████ ███████
# ██ ██ ██ ██ ██ ██ ██
# ██████ ██ ██ ██████ █████
# ██ ██ ██ ██ ██ ██
# ██ ██████ ██ ██ ███████
# ███████ ██ ██ ██████ █████ ██████ █████ ███████ ███████
# ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
# ███████ ██ ██ ██████ ███████ ██████ ███████ ███████ █████
# ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
# ███████ ██████ ██ ██ ██ ██████ ██ ██ ███████ ███████
# █████ ██████ ██
# ██ ██ ██ ██ ██
# ███████ ██████ ██
# ██ ██ ██ ██
# ██ ██ ██ ██
### SUPABASE REST API (anon) (swagger)
GET {{SUPABASE_URL}}/rest/v1/
apikey: {{SUPABASE_ANON_KEY}}
### HEAD to trees_watered (anon)
# Use this to get the right amount of items returned
HEAD {{SUPABASE_URL}}/rest/v1/trees_watered
apikey: {{SUPABASE_ANON_KEY}}
Authorization: Bearer {{SUPABASE_SERVICE_ROLE_KEY}}
Range-Unit: items
Range: 33-300
Prefer: count=exact
### GET trees_watered (sudo mode since RLS is in effect)
GET {{SUPABASE_URL}}/rest/v1/trees_watered
apikey: {{SUPABASE_ANON_KEY}}
Authorization: Bearer {{SUPABASE_SERVICE_ROLE_KEY}}
### RPC get_watered_and_adopted
GET {{SUPABASE_URL}}/rest/v1/rpc/get_watered_and_adopted
apikey: {{SUPABASE_ANON_KEY}}
Range-Unit: items
Prefer: count=exact
### DELETE an account
POST {{SUPABASE_URL}}/rest/v1/rpc/remove_account
apikey: {{SUPABASE_ANON_KEY}}
Authorization: Bearer {{SUPABASE_USER_ACCESS_TOKEN}}
Content-Type: application/json