Skip to content

Commit

Permalink
Get REST API parameters from HTTP GET of POST. (#751)
Browse files Browse the repository at this point in the history
Co-authored-by: wlorenzetti <[email protected]>
  • Loading branch information
wlorenzetti and wlorenzetti committed Feb 12, 2024
1 parent 02cee91 commit 705f471
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions g3w-admin/core/api/base/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,8 @@ def response_data_mode(self, request, export_features=False):
# --------------------------------------
# IDEA: for big data it'll be iterate over features to get unique
# c++ iteration is fast. Instead memory layer with too many features can be a problem.
if 'unique' in request.query_params:
if 'unique' in self.request_data:


vl = QgsVectorLayer(QgsWkbTypes.displayString(self.metadata_layer.qgis_layer.wkbType()),
"temporary_vector", "memory")
Expand All @@ -498,7 +499,7 @@ def response_data_mode(self, request, export_features=False):

uniques = vl.uniqueValues(
self.metadata_layer.qgis_layer.fields().indexOf(
request.query_params.get('unique'))
self.request_data.get('unique'))
)

values = []
Expand Down Expand Up @@ -642,6 +643,9 @@ def get_response(self, request, mode_call=None, project_type=None, layer_id=None
# set reprojecting status
self.set_reprojecting_status()

# Get request data by GET or POST method
self.request_data = request.query_params if request.method == 'GET' else request.data

# get results
response = self.get_response_data(request)

Expand Down

0 comments on commit 705f471

Please sign in to comment.