Junction auto update
Purpose
Junction Auto-Update is a REST API endpoint designed for the streamlined and efficient update of junctions. It simplifies the junction update process by requiring minimal input parameters.
Before committing to the update of a junction, users have the option to check the Junction definition preview. This feature allows users to review and verify the generated junction based on the provided area.
The response contains the junction ID that you can use to fetch junction data via Junction definition details.
Request data
You can update the junction in an automatic way by sending a PUT request, as shown in the following example.
- Constants and parameters enclosed in curly brackets must be replaced with their values.
- Please see the following Request parameters section with the required and optional parameter tables for their values. The generic request format is as follows.
HTTPS method: PUT
https://api.tomtom.com/junction-analytics/junctions/1/{junctionId}/definition/auto?key={Your_API_Key}
POST request body example
1{2 "name": "My junction name",3 "detectionConfig": {4 "autodetectName": false5 },6 "junction": {7 "type": "Feature",8 "properties": {},9 "geometry": {10 "type": "Polygon",11 "coordinates": [12 [13 [14 19.45177674293518,15 51.77671939020735416 ],17 [18 19.45182502269745,19 51.7763941158831320 ],21 [22 19.45253312587738,23 51.7764604985887224 ],25 [26 19.45253312587738,27 51.77679241065176528 ],29 [30 19.45177674293518,31 51.77671939020735432 ]33 ]34 ]35 }36 }37}
Request parameters
The following table shows the query parameters:
- Required parameters must be used or the call will fail.
- Optional parameters may be used.
Required parameters | Description |
---|---|
| The unique junction ID that must be used in the request path. |
| An API Key valid for the requested service. Value: Your valid API Key. |
POST request body fields
name
(string) Not required by default. Name for an updated junction. Take a look at detectionConfig.autodetectName
. Maximum length is 250 characters.
detectionConfig
(object) Contains the detection configuration used in junction update.
autodetectName
(boolean) Iftrue
, the junction name will be updated based on its approaches. Iffalse
, thename
field is required. Default value:true
junction
(object) Required. A GeoJSON Feature, Polygon, or Point (with the radius
property). It contains the junction boundary that will be used in the update process.
- GeoJSON Polygon specification
- Requirements: an area size smaller then 1km2 and a boundary smaller than 3km.
- GeoJSON Point specification
- Requirements: a radius smaller than 500m.
Request headers
Header | Value |
---|---|
Content-Type | application/json |
Example request
The following is an example curl request with polygon:
1$ curl '/junction-analytics/junctions/1/5fd8da2b84510126b9d18b0d/definition/auto?key={Your_API_Key}' -i -X PUT -d '{2 "name": "My junction name",3 "detectionConfig": {4 "autodetectName": false5 },6 "junction": {7 "type": "Feature",8 "properties": {},9 "geometry": {10 "type": "Polygon",11 "coordinates": [12 [13 [14 19.45177674293518,15 51.77671939020735416 ],17 [18 19.45182502269745,19 51.7763941158831320 ],21 [22 19.45253312587738,23 51.7764604985887224 ],25 [26 19.45253312587738,27 51.77679241065176528 ],29 [30 19.45177674293518,31 51.77671939020735432 ]33 ]34 ]35 }36 }37}'
The following is an example curl request with circle:
1$ curl '/junction-analytics/junctions/1/5fd8da2b84510126b9d18b0d/definition/auto?key={Your_API_Key}' -i -X PUT -d '{2 "name": "My junction name",3 "detectionConfig": {4 "autodetectName": false5 },6 "junction": {7 "type": "Feature",8 "geometry": {9 "type": "Point",10 "coordinates": [11 13.41649420385599,12 52.5220200690915513 ]14 },15 "properties": {16 "radius": 51.3017 }18 }19}'
Response data
This response returns the junction ID and modification type.
Example response
The following JSON code block is an example response:
1{2 "modificationType": "Updated",3 "junctionId": "65268ff77cd5d952a185b9b5"4}
Response fields
The following section describes all of the fields that can appear in a response.
modificationType
(string) String that describes the modification type. In this case it has the value Updated
.
junctionId
(string) Unique ID of the updated junction.
Errors
The system generates an error response if there is an error in the supplied parameters or any other internal problem. This response is generated in the requested format.
Error response codes
The following table shows the HTTP error response codes.
Code | Description |
---|---|
401 | Unauthorized |
403 | Forbidden |
400 | Bad Request Example messages:
|
Error response field
Field | Description |
---|---|
| The problem description. |
Example error response
The following is an example error response:
1{2 "message": "Name should be provided if detectionConfig.autodetectName is set to false!"3}