Closed giohappy closed 5 months ago
/resources
(in catalogue), /maps
(in dashboard) - Works fine with catalog_list
preset
@giohappy Kindly clarify
catalog_list
or create a separate preset or add as include
params?
/datasets
(layers) in map - we need to include ['alternate', 'links', 'featureinfo_custom_template', 'has_time', 'default_style', 'ptype', 'extent']
the props to form a layer/documents
(in geostory to fetch images, videos) - we need to include ['href', 'attribution', 'alternate']
to preview it@dsuren1 presets were added to simplify called URLs.
I'd suggest using a preset for the dataset query, since 7 include[]
are quite a lot, and then I'd use a preset for documents as well for coherence with the other calls, but in this case it's up to your personal easthetic.
@dsuren1 I can create the presets in a branch and let you test them before merging.
@giohappy
Presets
settings.REST_API_PRESETS["catalog_list"] = {
"exclude[]": ["*"],
"include[]": [
"advertised",
"detail_url",
"is_approved",
"is_copyable",
"is_published",
"owner",
"perms",
"pk",
"raw_abstract",
"resource_type",
"subtype",
"title",
"data",
"executions",
"thumbnail_url"
],
}
settings.REST_API_PRESETS["datasets"] = {
"exclude[]": ["*"],
"include[]": [
"advertised",
"detail_url",
"owner",
"perms",
"pk",
"raw_abstract",
"resource_type",
"subtype",
"title",
"data",
"executions",
"thumbnail_url",
"alternate",
"links",
"featureinfo_custom_template",
"has_time",
"default_style",
"ptype",
"extent"
],
}
settings.REST_API_PRESETS["documents"] = {
"exclude[]": ["*"],
"include[]": [
"pk",
"raw_abstract",
"resource_type",
"subtype",
"title",
"data",
"executions",
"thumbnail_url",
"alternate",
"attribution",
"href"
],
}
@dsuren1 you can add the presets yourself.
Take into account that maps already do a request to datasets when the onload completes. @allyoucanmap says that it's done to retrieve the perms for the maplayers. For this case we can simply use the include
if we only need permissions and a few more attributes. Probably something like this could be enough exclude[]=*&include[]=perms&include[]=pk&include[]=alternate
@giohappy Yes, a separate datasets call to get perms by dataset names alone is made for which we can use the param you have suggested :thumbsup: I intend to add preset for datasets catalog which requires the above mentioned props to form a layer.
The client will add a new
api_preset=catalog_list
parameter to the GET requests for listing resources. This will limit the retrieved fields to the ones listed here, reducing the load on the server and the I/O.Notice that
executions
are already included in the preset, so no need to include them again as a parameter.@dsuren1 I suppose the same can be done for the requests performed inside the viewer's GeoNode catalogs (
Add Layer
inside maps, etc.).