Feedback API - Beta

The feedback API is currently in beta, and you should expect breaking changes to the interface before it is finalised

Introduction

When using the Naurt final destination API you might find that locations or addresses could be improved. The feedback API allows you to suggest changes to Naurt addresses, parking locations, or door locations via a simple API. In addition, this API can be used to provide addresses Naurt does not yet have parking spot and building entrance data for. All data will be quality assessed and verified before becoming live data in the final-destination API.

Endpoint

All feedback requests should be sent to Naurt's final-destination-feedback endpoint.

POST
https://api.naurt.net/final-destination-feedback/v1

Key things to know

  • A valid API key is required to call the endpoint.
  • No usage will be tallied against your API key.
  • Address strings will not be matched with current data. To update an existing address please use the relevant Naurt ID.

Request

Feedback can be submitted via a POST request to the final-destination feedback endpoint. Again, data should be provided as a JSON in the body of the request and not in the url.

JSON
POST  https://api.naurt.net/final-destination-feedback/v1
Content-Type: application/json
Authorization: <API_KEY_HERE>
{
    "id": Optional<String>,
    "address_string": Optional<String>,
    "parking_latitude": Optional<float>,
    "parking_longitude": Optional<float>,
    "door_latitude": Optional<float>,
    "door_longitude": Optional<float>
}

Parameters

ParameterTypeOptionalDefaultDescription
idstring (UUID)YesNoneA valid Naurt ID for an address.
address_stringstringYesNoneAn address string with correct spelling and formatting.
parking_latitudefloatYesNoneA valid parking latitude in WGS84 degrees. Range: -90 <= lat <= 90.
parking_longitudefloatYesNoneA valid parking longitude in WGS84 degrees. Range: -180 <= lon <= 180.
door_latitudefloatYesNoneA valid door latitude in WGS84 degrees. Range: -90 <= lat <= 90.
door_longitudefloatYesNoneA valid door longitude in WGS84 degrees. Range: -180 <= lon <= 180.

Example

CURL
curl -XPOST \
-H "Content-type: application/json" \
-H "Authorization: <API_KEY_HERE>"  \
-d '{"address_string": "167 Wiggly Road, Longtown, Kentucky, USA", "parking_latitude": 52.0, "parking_longitude":-0.12}' \
'https://api.naurt.net/final-destination-feedback/v1'

Response

Success

A 200 response code indicates a successful response with the format as follows.

JSON
{ "success": true }

This confirms that Naurt has received the suggested correction. This does not confirm that the suggestion will be used within Naurt's data.

Failure

A response code other than 200 indicates a failure to retrieve the requested destination.

JSON
401 Unauthorized
{"error": "Please ensure the request contains a valid API key."}

If not enough data was provided to make a correction, Naurt will respond with a 400.

JSON
400 Bad Request
{ "error": "When providing an address with no Naurt ID. Please provide an accompanying location." }

Code Examples

Below are some basic coded templates showing how to use the final-destination API from different languages.

Python
import requests
import json

url = "https://api.naurt.net/final-destination-feedback/v1"

payload = json.dumps({
  "id": "97cc25c6-7988-9491-c837-076058f867f3",
  "parking_latitude": 51.52203917,
  "parking_longitude": -0.11381551,
  "door_latitude": 51.52196565,
  "door_longitude": -0.11381619,
})
headers = {'Content-Type': 'application/json', 'Authorization':'<API_KEY_HERE>'}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
Javascript
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", "<API_KEY_HERE>");
var raw = JSON.stringify({
  id: "97cc25c6-7988-9491-c837-076058f867f3",
  parking_latitude: 51.52203917,
  parking_longitude: -0.11381551,
  door_latitude: 51.52196565,
  door_longitude: -0.11381619,
});

var requestOptions = {
  method: "POST",
  headers: myHeaders,
  body: raw,
  redirect: "follow",
};

fetch("https://api.naurt.net/final-destination-feedback/v1", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.log("error", error));
Rust
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = reqwest::Client::builder()
        .build()?;

    let mut headers = reqwest::header::HeaderMap::new();
    headers.insert("Content-Type", "application/json".parse()?);
    headers.insert("Authorization", "<API_KEY_HERE>".parse()?);
    let data = r#"{
        "id": "97cc25c6-7988-9491-c837-076058f867f3",
        "parking_latitude": 51.52203917,
        "parking_longitude": -0.11381551,
        "door_latitude": 51.52196565,
        "door_longitude": -0.11381619,
    }"#;

    let json: serde_json::Value = serde_json::from_str(&data)?;

    let request = client.request(reqwest::Method::POST, "https://api.naurt.net/final-destination-feedback/v1")
        .headers(headers)
        .json(&json);

    let response = request.send().await?;
    let body = response.text().await?;

    println!("{}", body);

    Ok(())
}
PHP

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.naurt.net/final-destination-feedback/v1',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS =>'{
    "id": "97cc25c6-7988-9491-c837-076058f867f3",
    "parking_latitude": 51.52203917,
    "parking_longitude": -0.11381551,
    "door_latitude": 51.52196565,
    "door_longitude": -0.11381619,
}',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'Authorization: <API_KEY_HERE>'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
Ruby
  require "uri"
  require "json"
  require "net/http"

  url = URI("https://api.naurt.net/final-destination-feedback/v1")

  https = Net::HTTP.new(url.host, url.port)
  https.use_ssl = true

  request = Net::HTTP::Post.new(url)
  request["Content-Type"] = "application/json"
  request["Authorization"] = "<API_KEY_HERE>"
  request.body = JSON.dump({
    "id": "97cc25c6-7988-9491-c837-076058f867f3",
    "parking_latitude": 51.52203917,
    "parking_longitude": -0.11381551,
    "door_latitude": 51.52196565,
    "door_longitude": -0.11381619,
  })

  response = https.request(request)
  puts response.read_body

Request Examples

Request
POST  https://api.naurt.net/final-destination-feedback/v1
Content-Type: application/json
Authorization: <API_KEY_HERE>
{
    "id": "97cc25c6-7988-9491-c837-076058f867f3",
    "parking_latitude": 51.52203917,
    "parking_longitude": -0.11381551,
    "door_latitude": 51.52196565,
    "door_longitude": -0.11381619,
}
Response
{
    "success": true
}