origo
origo copied to clipboard
Extend layerSpecificExport for APIs
Fixes #2040.
The PR includes several improvements to the layerSpecificExport handling to make the configuration more flexible and adaptable to more different types of APIs. It does not include authentication in any way, but that would be a useful next addition.
- Allow setting
exportedFileName
andbutton
per layer or specific URL- The handling of export options was not entirely consistent, but now these options (and all the others except
url
) can be set as defaults per layer, or overriden for specific export URLs.
- The handling of export options was not entirely consistent, but now these options (and all the others except
- New export option:
urlParameters
- Add URL parameters as key-value pairs
- Fill parameter values with values from selected objects' attributes by specifying an object with an
attribute
property:{ "attribute": "objekt_id", "separator": ";"}
. The separator character can be customized but uses semicolon by default. - Set a parameter's value to
{{no_value}}
to add the parameter without the equals sign or value. - The example config below will result in e g the following url: https://my.api.se/postSomething?param1=value1&featureid=1;3;12&silent
{ "url": "https://my.api.se/postSomething", "urlParameters": { "param1": "value1", "featureid": { "attribute": "id", "separator": ";"}, "silent": "{{no_value}}" }, "attributesToSendToExport": ["id","comment"], "button": { "buttonText": "Post IDs" } }
- New export options
requestMethod
(POST_JSON
|OPEN
|GET
) anddisplayExportResponse
(true
|false
) added-
POST_JSON
is the default option and posts JSON the usual way as the layerSpecificExport works. -
OPEN
opens the URL in a new window. -
GET
makes a GET request- Includes any
urlParameters
specified (but notattributesToSendToExport
of course) - If
displayExportResponse
is set totrue
(for the layer or the specific url) the request's response will be displayed in the infowindow. Supports images and text (if from the same domain or otherwise allowed by CORS restrictions). Defaults to false.
- Includes any
-
- Added a material design icon
article
because it looks nice for opening reports etc.