Traffic - Get Traffic Incident Viewport
Use to get legal and technical information for a viewport.
The Traffic Incident Viewport
API is an HTTP GET
request that returns legal and technical information for the viewport described in the request. It should be called by client applications whenever the viewport changes (for instance, through zooming, panning, going to a location, or displaying a route). The request should contain the bounding box and zoom level of the viewport whose information is needed. The return will contain map version information, as well as the current Traffic Model ID and copyright IDs. The Traffic Model ID returned by the Viewport Description is used by other APIs to retrieve last traffic information for further processing.
GET https://atlas.microsoft.com/traffic/incident/viewport/{format}?api-version=1.0&boundingbox={boundingbox}&boundingzoom={boundingzoom}&overviewbox={overviewbox}&overviewzoom={overviewzoom}
GET https://atlas.microsoft.com/traffic/incident/viewport/{format}?api-version=1.0&boundingbox={boundingbox}&boundingzoom={boundingzoom}&overviewbox={overviewbox}&overviewzoom={overviewzoom}©right={copyright}
Name | In | Required | Type | Description |
---|---|---|---|---|
format
|
path | True |
Desired format of the response. Value can be either json or xml. |
|
api-version
|
query | True |
string |
Version number of Azure Maps API. |
boundingbox
|
query | True |
number[] |
Bounding box of the map viewport in EPSG900913 projection. The |
boundingzoom
|
query | True |
integer int32 |
Zoom level of the map viewport. Used to determine whether the view can be zoomed in. |
overviewbox
|
query | True |
number[] |
Bounding box of the overview map in EPSG900913 projection. |
overviewzoom
|
query | True |
integer int32 |
Zoom level of the overview map. If there is no mini map, use the same zoom level as boundingZoom. |
copyright
|
query |
boolean |
Determines what copyright information to return. When true the copyright text is returned; when false only the copyright index is returned. |
Name | Required | Type | Description |
---|---|---|---|
x-ms-client-id |
string |
Specifies which account is intended for usage in conjunction with the Microsoft Entra ID security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Microsoft Entra ID security in Azure Maps see the following articles for guidance. |
Name | Type | Description |
---|---|---|
200 OK |
OK |
|
Other Status Codes |
An unexpected error occurred. |
These are the Microsoft Entra OAuth 2.0 Flows. When paired with Azure role-based access control it can be used to control access to Azure Maps REST APIs. Azure role-based access controls are used to designate access to one or more Azure Maps resource account or sub-resources. Any user, group, or service principal can be granted access via a built-in role or a custom role composed of one or more permissions to Azure Maps REST APIs.
To implement scenarios, we recommend viewing authentication concepts. In summary, this security definition provides a solution for modeling application(s) via objects capable of access control on specific APIs and scopes.
- This security definition requires the use of the
x-ms-client-id
header to indicate which Azure Maps resource the application is requesting access to. This can be acquired from the Maps management API.
The Authorization URL
is specific to the Azure public cloud instance. Sovereign clouds have unique Authorization URLs and Microsoft Entra ID configurations.
*
The Azure role-based access control is configured from the Azure management plane via Azure portal, PowerShell, CLI, Azure SDKs, or REST APIs.
*
Usage of the Azure Maps Web SDK allows for configuration based setup of an application for multiple use cases.
- For more information on Microsoft identity platform, see Microsoft identity platform overview.
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Name | Description |
---|---|
https://atlas.microsoft.com/.default | https://atlas.microsoft.com/.default |
This is a shared key that is provisioned when you Create an Azure Maps account in the Azure portal or using PowerShell, CLI, Azure SDKs, or REST API.
With this key, any application can access all REST API. In other words, this key can be used as a master key in the account that they are issued in.
For publicly exposed applications, our recommendation is to use the confidential client applications approach to access Azure Maps REST APIs so your key can be securely stored.
Type:
apiKey
In:
query
This is a shared access signature token is created from the List SAS operation on the Azure Maps resource through the Azure management plane via Azure portal, PowerShell, CLI, Azure SDKs, or REST APIs.
With this token, any application is authorized to access with Azure role-based access controls and fine-grain control to the expiration, rate, and region(s) of use for the particular token. In other words, the SAS Token can be used to allow applications to control access in a more secured way than the shared key.
For publicly exposed applications, our recommendation is to configure a specific list of allowed origins on the Map account resource to limit rendering abuse and regularly renew the SAS Token.
Type:
apiKey
In:
header
Sample request
GET https://atlas.microsoft.com/traffic/incident/viewport/json?api-version=1.0&boundingbox=-939584.4813015489,-23954526.723651607,14675583.153020501,25043442.895825107&boundingzoom=2&overviewbox=-939584.4813018347,-23954526.723651607,14675583.153020501,25043442.89582291&overviewzoom=2©right=True
Sample response
{
"viewpResp": {
"trafficState": {
"@trafficAge": 18895,
"@trafficModelId": "1504808593298"
},
"copyrightIds": "© 2017 GeoSmart^© 2017 TomTom^© 2017 Whereis",
"@version": "1.0.51-mascoma",
"@maps": "europe,taiwan,latam,northamerica,israel,middleeast,iraq,guam,australia,newzealand,india,africa,world,southeastasia"
}
}
Name | Description |
---|---|
Error |
The resource management error additional info. |
Error |
The error detail. |
Error |
Error response |
Response |
Desired format of the response. Value can be either json or xml. |
Traffic |
This object is returned from a successful Traffic Incident Viewport call |
Traffic |
Traffic State information |
Viewp |
Viewport Response object |
The resource management error additional info.
Name | Type | Description |
---|---|---|
info |
object |
The additional info. |
type |
string |
The additional info type. |
The error detail.
Name | Type | Description |
---|---|---|
additionalInfo |
The error additional info. |
|
code |
string |
The error code. |
details |
The error details. |
|
message |
string |
The error message. |
target |
string |
The error target. |
Error response
Name | Type | Description |
---|---|---|
error |
The error object. |
Desired format of the response. Value can be either json or xml.
Name | Type | Description |
---|---|---|
json |
string |
|
xml |
string |
This object is returned from a successful Traffic Incident Viewport call
Name | Type | Description |
---|---|---|
viewpResp |
Viewport Response object |
Traffic State information
Name | Type | Description |
---|---|---|
@trafficAge |
integer |
The elapsed time (in seconds) from the Traffic Model ID creation. |
@trafficModelId |
string |
The unique ID called Traffic Model ID is used in calls to Traffic Incident services. It allows to obtain information from particular traffic updates. Traffic Model ID is updated every minute, and is valid for two minutes before it times out. |
Viewport Response object
Name | Type | Description |
---|---|---|
@maps |
string |
Indicates the data provider's internal names for the map data used in the viewport. For use with support queries. |
@version |
string |
Indicates the software version used to generate the information. For use with support queries. |
copyrightIds |
string |
When the copyright parameter value is true, this contains the full text of the copyright information that must be displayed with the tiles in the viewport |
trafficState |
Traffic State information |