Compare commits

..
5 Commits
Author SHA1 Message Date
Loki_lucky 7a5acbc8c0 style and spelling corrections 2026-03-19 21:01:02 -05:00
opoolad1 e37da62c61 Merge branch 'master' of https://gittea.dev/Walshk4/Assignment-3---2600
tes
2026-03-19 12:47:14 -05:00
Loki_lucky 61e5915e64 test commit 2026-03-19 12:46:32 -05:00
Loki_lucky beffb80b79 test commit 2026-03-19 12:45:55 -05:00
opoolad1 89ee6e5566 Added intro and description 2026-03-19 12:41:09 -05:00
8 changed files with 159 additions and 11 deletions
BIN
View File
Binary file not shown.
+5
View File
@@ -0,0 +1,5 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
+9
View File
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="ms-17" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>
+8
View File
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/Assignment-3---2600.iml" filepath="$PROJECT_DIR$/.idea/Assignment-3---2600.iml" />
</modules>
</component>
</project>
Generated
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>
+19 -11
View File
@@ -1,9 +1,17 @@
# Foomatic Routing and Distance API
## Overview
Foomatic utilizes a REST API to calculate the shortest road distance between two sets of geographic coordinates. You can recieve a link to foomatic page with route details, or a simple kilometer calculation.
To use this API, you must first request an API key here: [Get your Key](https://foomatic.ca/requestkey). Once you have your key, you can make a `GET` request to the endpoint.
Foomatic is a route planning company that provides services for businesses that need to optimize product delivery routes in big cities and rural areas or complex, multi-week long trips for traveling salespeople.
This is the API Reference guide for Foomatic which provides detailed information on how to interact with Foomatic Platform through its API.
To make Foomatic's route optimization one of the best, we must have a fully optimized API which allows our customers to identify the best possible route without requiring hefty computing power or risking long wait times. This will allow for on-the-fly redirecting drivers from problematic areas increasing their safety and reliability.
Foomatic utilizes a REST API to calculate the shortest road distance between two sets of geographic coordinates, which can be presented as a link to Foomatic page with route details, or a simple distance prediction in kilometers.
To make use of this API, you must first request an API key here: [Get your Key](https://foomatic.ca/requestkey), after which you can make a `GET` request to the endpoint provided below.
**Endpoint:**
`foomatic.ca/route/request_route`
@@ -12,21 +20,21 @@ To use this API, you must first request an API key here: [Get your Key](https://
## Request Parameters
Add the following parameters to your URL string:
The following parameters need to be sent with the GET request to retrieve data.
* **`start_lat`** (float): Starting latitude in decimal degrees.
* **`start_long`** (float): Starting longitude in decimal degrees.
* **`end_lat`** (float): End latitude in decimal degrees.
* **`end_long`** (float): End longitude in decimal degrees.
* **`api_key`** (string): Your super secret key.
* **`map_link`** (boolean):**Optional** If included (ie., `&map_link=true`), the API will return a URL link to the Foomatic route visualizer page. If omitted, the API defaults to returning the raw total distance.
* **`map_link`** (boolean): **Optional** If included (i.e., `&map_link=true`), the API will return a URL link to the Foomatic route visualizer page, otherwise, the API defaults to returning the raw total distance.
---
## Example Requests & Responses
### 1. Requesting a Map Route URL
Use this request when you want to redirect a user to a visual map of their route. Note the addition of `&map_link=true` at the end of the URL.
Using this request will redirected the user to a visual map of their route. (Note the addition of `&map_link=true` at the end of the URL)
**Sample Request:**
```
@@ -45,7 +53,7 @@ foomatic.ca/route/request_route?start_lat=44.6488&start_long=-63.5752&end_lat=46
```
### 2. Requesting Raw Distance Data
Use this standard request when you only need the mathematical distance to use within your own application.
Using this request will yield the travel distance between points, recommended for use within your own applications for simplicity of processing.
**Sample Request:**
```
@@ -72,7 +80,7 @@ foomatic.ca/route/request_route?start_lat=44.6488&start_long=-63.5752&end_lat=46
}
```
### 3. **Sample Error repsonse:**
### 3. **Sample Error Response:**
```json
{
"status": "error",
@@ -95,9 +103,9 @@ foomatic.ca/route/request_route?start_lat=44.6488&start_long=-63.5752&end_lat=46
```
### 4. **Status/Error codes:**
* **"success":** no errors indicated.
* **"error":** error indicated look at error code for description.
* **"MISSING_PARAMETER":** One of the 4 required parameters is missing or invalid. Verify coordinates and re-request.
* **"INVALID_AUTH":** Your super secret key is invalid or not authorized, verify correct key or request new.
* **"error":** error indicated, look at error code for description.
* **"MISSING_PARAMETER":** One of the 4 required parameters is missing or invalid. Verify that all coordinates are input properly and re-request.
* **"INVALID_AUTH":** Your API key is invalid or not authorized, verify that the key you used is correct and if you are still having this problem contact our support to check if your key wasn't deactivated or expired or request a new key.
### 5. Usage limits
Free accounts may use this service 5 times a day. If API key is registered to corporate or paid-access usage is unlimited, time-gated 480 seconds between requests.
Free keys are limited to 5 requests per day, while keys registered to corporate or paid-access users have no daily limit. All keys have 480 second waiting period between requests to prevent DDOS style attacks.
+106
View File
@@ -0,0 +1,106 @@
# Foomatic Routing and Distance API
## Overview
This is the API Reference for Foomatic. This guide provides detailed information on the API you can use to interact with the Foomatic Platform.
Foomatic utilizes a REST API to calculate the shortest road distance between two sets of geographic coordinates. You can recieve a link to foomatic page with route details, or a simple kilometer calculation.
To use this API, you must first request an API key here: [Get your Key](https://foomatic.ca/requestkey). Once you have your key, you can make a `GET` request to the endpoint.
**Endpoint:**
`foomatic.ca/route/request_route`
---
## Request Parameters
Add the following parameters to your URL string:
* **`start_lat`** (float): Starting latitude in decimal degrees.
* **`start_long`** (float): Starting longitude in decimal degrees.
* **`end_lat`** (float): End latitude in decimal degrees.
* **`end_long`** (float): End longitude in decimal degrees.
* **`api_key`** (string): Your super secret key.
* **`map_link`** (boolean):**Optional** If included (ie., `&map_link=true`), the API will return a URL link to the Foomatic route visualizer page. If omitted, the API defaults to returning the raw total distance.
---
## Example Requests & Responses
### 1. Requesting a Map Route URL
Use this request when you want to redirect a user to a visual map of their route. Note the addition of `&map_link=true` at the end of the URL.
**Sample Request:**
```
foomatic.ca/route/request_route?start_lat=44.6488&start_long=-63.5752&end_lat=46.0878&end_long=-64.7782&api_key=YOUR_SUPER_SECRET_KEY&map_link=true
```
**Sample Response:**
```json
{
"status": "success",
"data": {
"route_url": "[https://foomatic.ca/app/view-map?origin=44.6488,-63.5752&dest=46.0878,-64.7782](https://foomatic.ca/app/view-map?origin=44.6488,-63.5752&dest=46.0878,-64.7782)",
"description": "Click this link to view your route on the map."
}
}
```
### 2. Requesting Raw Distance Data
Use this standard request when you only need the mathematical distance to use within your own application.
**Sample Request:**
```
foomatic.ca/route/request_route?start_lat=44.6488&start_long=-63.5752&end_lat=46.0878&end_long=-64.7782&api_key=YOUR_SUPER_SECRET_KEY
```
**Sample Response:**
```json
{
"status": "success",
"message": "Distance calculated successfully.",
"data": {
"distance": 186.24,
"unit": "km",
"origin": {
"latitude": 44.6488,
"longitude": -63.5752
},
"destination": {
"latitude": 46.0878,
"longitude": -64.7782
}
}
}
```
### 3. **Sample Error repsonse:**
```json
{
"status": "error",
"message": "Missing coordinate parameter",
"error_code": "MISSING_PARAMETER",
"requirements":{
"origin": [
"start_lat",
"start_long"
],
"destination": [
"end_lat",
"end_long"
],
"API_key":[
"SUPER_SECRET_KEY"
]
}
}
```
### 4. **Status/Error codes:**
* **"success":** no errors indicated.
* **"error":** error indicated look at error code for description.
* **"MISSING_PARAMETER":** One of the 4 required parameters is missing or invalid. Verify coordinates and re-request.
* **"INVALID_AUTH":** Your super secret key is invalid or not authorized, verify correct key or request new.
### 5. Usage limits
Free accounts may use this service 5 times a day. If API key is registered to corporate or paid-access usage is unlimited, time-gated 480 seconds between requests.