External REST API calls can be added to a NET Cloud project. These may be REST calls, but it is also possible to address any other API or even the GeoServer directly. The already configured API calls are displayed in table form and can be edited or deleted.
Quick changes to the API URL, HTTP method, and data type can also be made by clicking on the corresponding cell entry. The “System Name” cannot be changed.
The API call can be added to various project layers and is then available in the map via that layer.
Add a new API call to the project
You can create a new REST API call via “Add report”.
| System name | Unique name assigned within the system |
| URL | URL that is called when executed |
| HTTP method | POST / GET |
| Data type | Expected return type of the call |
| Name | Name that will later be displayed in the form |
| Description | A short text can be stored here describing what the REST call returns in order to inform the user. |
| Published | Whether the call is available to the user |
It is also possible to create a new API call by copying an existing one. Using placeholders, attribute-specific information can be transmitted. For example, if the FID of a feature is to be passed to the REST endpoint, the placeholder %feature.fid% must be included in the URL.
In the “Advanced” tab, it is possible to pass additional parameters to the REST call. There is also a field for a header to pass API keys, as well as a field for possible functions that should be executed after the REST call. This could, for example, be trench highlighting if the REST call returns a list of FIDs to be highlighted.
Example code for trench highlightning
async function (res) { var features = { "type": "FeatureCollection", "features": [] };
var ids = res.json(); let items = []; // Permanent tracings are removed only if a new
tracing is on the map. Non-permanent tracings are removed as soon as a new feature is selected
let zoom = false; let permanent = true; await ids.then(data => { data.forEach(item =>
{ items.push(item); map.eachLayer(function (layer) { if (layer.feature)
{ if (layer.feature.id === "tc_m_sp_segment." + item)
{ features.features.push(layer.feature); } } }); }); });
// If not all FIDs returned from the server are in the current viewport, then save the FIDs
in window if (items.length > features.features.length) { window["tracingHighlight"] = items;
} else { window["tracingHighlight"] = undefined } var style = function (feature)
{ return {"color": "orange", "weight": 10} } if (features.features.length > 0)
{ window["tracingZoom"] = zoom; window["tracingPermanent"] = permanent;
highlightFeature("searchResultTemp", features, zoom, permanent, style); } }
In the “Attributes” tab, additional parameters can be specified (and must be specified if marked as “Required”) that need to be entered when submitting the REST call. The user is prompted here, for example, to provide an OTDR measurement result, which is then additionally transmitted to the endpoint.