-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuber-api.html
36 lines (29 loc) · 1.13 KB
/
uber-api.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title></title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
//reference documentation: https://developer.uber.com/docs/riders/references/api/v1.2/estimates-price-get
var corsURL = 'https://cors-anywhere.herokuapp.com/';
var queryURL = 'https://api.uber.com/v1.2/estimates/price?start_latitude=37.7752315&start_longitude=-122.418075&end_latitude=37.7752415&end_longitude=-122.518075';
var finalURL = corsURL + queryURL;
$.ajax({
url: finalURL,
method: 'GET',
beforeSend: function(xhr) {
xhr.setRequestHeader('Authorization', 'Token <YOUR API KEY>');
xhr.setRequestHeader('Accept-Language', 'en_US');
xhr.setRequestHeader('Content-Type', 'application/json');
},
success: function(data) {
console.log('success');
console.log(data);
}
});
</script>
</head>
<body>
</body>
</html>