File tree Expand file tree Collapse file tree 3 files changed +54
-4
lines changed Expand file tree Collapse file tree 3 files changed +54
-4
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,53 @@ APIs for the HTTP Archive Technology Report
17
17
18
18
### Endpoitns
19
19
20
- ` GET /technologies `
20
+ GitHub Copilot: Sure, here's an updated documentation for the ` /list_data ` endpoint that includes all possible parameters:
21
+
22
+ # List Data Endpoint
23
+
24
+ This endpoint returns a list of data from the ` adoption ` collection in Firestore.
25
+
26
+ ## Edndpointd
27
+
28
+ ### ` GET /adoption `
29
+
30
+ #### Parameters
31
+
32
+ The following parameters can be used to filter the data:
33
+
34
+ - ` geo ` (` required ` ): A string representing the geographic location.
35
+ - ` technology ` (` required ` ): A comma-separated string representing the technology name(s).
36
+ - ` rank ` (` required ` ): An string representing the rank.
37
+ - ` start ` (optional): A string representing the start date in the format ` YYYY-MM-DD ` .
38
+ - ` end ` (optional): A string representing the end date in the format ` YYYY-MM-DD ` .
39
+
40
+ #### Response
41
+
42
+ ``` bash
43
+ curl --request GET \
44
+ --url ' https://{{HOST}}/v1/adoption?start=2023-01-01&end=2023-09-01&geo=Mexico&technology=GoCache&rank=ALL'
45
+ ```
46
+
47
+ Returns a JSON object with the following schema:
48
+
49
+ ``` json
50
+ [
51
+ {
52
+ "technology" : " GoCache" ,
53
+ "geo" : " Mexico" ,
54
+ "date" : " 2023-06-01" ,
55
+ "rank" : " ALL" ,
56
+ "adoption" : {
57
+ "mobile" : 19 ,
58
+ "desktop" : 11
59
+ }
60
+ },
61
+ ...
62
+ ]
63
+ ```
64
+
65
+
66
+ ### ` GET /technologies `
21
67
22
68
#### Parameters
23
69
@@ -34,10 +80,9 @@ The following parameters can be used to filter the data:
34
80
35
81
``` bash
36
82
curl --request GET \
37
- --url ' https://{HOST}/v1/technologies?start=2022-02-01&end=2022-04-01&technology=Smartsupp&client=mobile'
83
+ --url ' https://{{ HOST}} /v1/technologies?start=2022-02-01&end=2022-04-01&category=Live%20chat%2C%20blog &technology=Smartsupp&client=mobile'
38
84
```
39
85
40
-
41
86
Returns a JSON object with the following schema:
42
87
43
88
``` json
Original file line number Diff line number Diff line change 2
2
import json
3
3
from google .cloud import firestore
4
4
from .result import Result
5
+ from .utils import convert_to_array
5
6
6
7
DB = firestore .Client (project = os .environ .get ('PROJECT' ))
7
8
@@ -17,7 +18,7 @@ def list_data(params):
17
18
if 'geo' in params :
18
19
query = query .where ('geo' , '==' , params ['geo' ])
19
20
if 'technology' in params :
20
- params_array = json . loads (params ['technology' ])
21
+ params_array = convert_to_array (params ['technology' ])
21
22
query = query .where ('technology' , 'in' , params_array )
22
23
if 'rank' in params :
23
24
query = query .where ('rank' , '==' , params ['rank' ])
Original file line number Diff line number Diff line change @@ -11,3 +11,7 @@ def convert_to_hashes(arr):
11
11
hash_dict = {inner_arr [0 ]: inner_arr [1 ]}
12
12
hashes_arr .append (hash_dict )
13
13
return hashes_arr
14
+
15
+ def convert_to_array (data_string ):
16
+ list = data_string .split (',' )
17
+ return list
You can’t perform that action at this time.
0 commit comments