Can you obtain current and predicted traffic data in XML format by using a REST subscription request?

Technote (FAQ)


Question

By default, the current and predicted traffic data is displayed in the portal user interface of the solution. Can the data also be exported from the system by using a REST subscription request?

Answer

Yes. This is possible in the IBM® Traffic Information Hub version 1.0.1 Interim Feature 1 (1.0.1.1), providing you have installed the optional transportation prediction feature.

To obtain the latest current and predicted traffic data in XML format, set up a subscription to the extended LinkStatusMsg REST service.

Subscription requests are secured through WebSphere authentication. After authentication is successful, the subscription request is processed by the REST service.

The scheduler component of the solution invokes the prediction calculations at predefined intervals. When the prediction results are available, the prediction schedule triggers the publishing of traffic data.

Procedure

To send a client subscription request by using the HTTP POST REST command:

1. Ensure that the path of the POST request is set to the following directory:

 .../ibm/iss/trans/tpt/messages/rest/trans_pred/inbound/subscription HTTP/1.1

2. Set the Hostname parameter to be the host name of the IBM® Intelligent Operations Center portal server.

3. Ensure that the subscription request includes the following parameters:

Parameter Description Example
subscriptionID : string Where string is a unique ID for identifying the subscription "subscriptionID" : “subscriber1”
endpointURL : URL Where URL is the endpoint URL where the enhanced LINKSTATUSMSG XML must be output to "endpointURL" : "[http:// 9.123.45.33:90888/servlet]"
subscriptionExpires : integer Where integer must be a positive integer greater than zero, representing the subscription expiration time in minutes "subscriptionExpires" : 30

The REST service validates the request input. If the validation checks fail, an error is returned to the client. For example:
  • If you specify a URL for the endpointURL parameter that is already registered, an error is returned
  • If the subscription ID already exists, an error is returned

Note: The subscriptionID parameter is associated with the URL. A subscription ID cannot be registered to multiple URLs. A URL must be associated with a unique subscription ID.


When the validation is successful, the REST service performs a look up on the endpointURL for all registered subscribers and by using the subscriptionExpires parameter, checks to see whether the subscription expired. The latest current and predicted status of all the road links in the operational database are returned in XML Format.

Results

A resource is exposed by the REST service for publishing the XML data. This resource is not exposed to the external clients and must be triggered by the forecast job. Obtain the current and predicted status of all the road links in XML format from the specified endpoint URL.

A sample request:

POST .../ibm/iss/trans/tpt/messages/rest/trans_pred/inbound/subscription HTTP/1.1
Content-Type: application/json
User-Agent: Jakarta Commons-HttpClient/3.1
Content-Length: 106
Authorization: Basic d3BzYWRtaW46d3BzYWRtaW4=
Host: icp002:10039
{
"subscriptionID" : “subscriber1”,
"endpointURL" : "
http://9.123.45.33:90888/servlet",
"subscriptionExpires" : 30
}

A sample response:


HTTP/1.1 200 OK
Content-Type: application/xml
<?xml version="1.0" encoding="UTF-8"?>
<ns5:linkStatusMsg xmlns:ns6="
http://www.ibm.com/iss/
intelligentTransportation/
trafficPrediction" xmlns:ns5="
http://www.tmdd.org/3/messages" xmlns:ns4="http://www.ntcip.org/c2c-message-administration"
xmlns:ns3="
http://www.tmdd.org/3/dialogs" xmlns:ns2="http://www.LRMS-Adopted-02-00-00"> 149584 IBM ISL 20120504 000000 70311903 open current average speed inductive loop monitoring station actual 9.9E1 2597 2012-05-09 13:15:08 ...

What to do next

To remove the subscription to the extended LinkStatusMsg REST service, send a HTTP DELETE REST request that specifies the subscriptionID as follows:

subscriptionID : string

For example:

DELETE .../ibm/iss/trans/tpt/messages/rest/trans_pred/inbound/subscription HTTP/1.1
Content-Type: application/json
User-Agent: Jakarta Commons-HttpClient/3.1
Content-Length: 106
Authorization: Basic d3BzYWRtaW46d3BzYWRtaW4=
Host: localhost:10039

{
"subscriptionID" : “subscriber1”
}

After authentication is successful, the request is processed by the REST service and the client data associated with the specified subscriptionID is deleted. If the subscriptionID is not recognized, the REST service returns an error.

See also, Obtaining link status TMDD data in the IBM Intelligent Transportation Information Center.


Rate this page:

(0 users)Average rating

Add comments

Document information


More support for:

IBM Intelligent Transportation
IBM Traffic Information Hub

Software version:

1.0.1.1

Operating system(s):

Linux Red Hat - xSeries

Reference #:

1610300

Modified date:

2013-01-28

Translate my page

Machine Translation

Content navigation