suhaimi ss suhaimi ss -4 years ago 131
reST (reStructuredText) Question

Here map REST api jquery return error

I'm testing the Here Maps REST api, but getting error. As i try to simulate data request using here map REST api for traffic info. below is my code :

<script>
$(document).ready(function(){
$("button").click(function(){
console.log("test 1");
$.ajax({
url: 'https://traffic.cit.api.here.com/traffic/6.0/incidents.json',
type: 'GET',
dataType: 'jsonp',
jsonp: 'jsoncallback',
data: {
bbox: '52.5311,13.3644;52.5114,13.4035',
criticality: 'minor',
app_id: 'DemoAppId01082013GAL',
app_code: 'AJKnXv84fjrb0KIHawS0Tg'
},
success: function (data) {
alert(JSON.stringify(data));
},
error: function (data, errorThrown) {
console.log("error " + errorThrown);
alert("error "+ errorThrown);
}

});
});
});
</script>


tq in advance

note add error capture when run the code:
enter image description here

Answer Source

The request URL should be like this

https://traffic.cit.api.here.com/traffic/6.0/incidents.json?app_id=APP_ID&app_code=APP_CODE

in your case:

https://traffic.cit.api.here.com/traffic/6.0/incidents.json?app_id=DemoAppId01082013GAL&app_code=AJKnXv84fjrb0KIHawS0Tg

Note: Never ever reveal your app id and app code.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download