Skip to content

Address

List Addresses

GET https://api.stretch.com/api/v1/nav/addreses

Gets all the addresses set by the user and returns it in the same format as represented in the 'create' function.

Response

AddressOut

    [{
    "lng": 55.296249,
    "lat": 25.276,
    "zoom": 14,
    "isDefault": False,
    "name": "Name of address",
    "address": "548, floor 5, Cluster G, Tower Al mas, JLT, Dubai, UAE",
    "country": "United Arab Emirates",
    "state": "Dubai",
    "city": "Dubai",
    "line1": "Jumeirah Lake Towers",
    "line2": "1068, Tower Meadows 2",
    "zip": "string",
    "details": "string",
    "id": "40239aee-d935-419f-85f3-e250ff6f19ab"
},{
    "lng": 55.296249,
    "lat": 25.276,
    "zoom": 14,
    "isDefault": False,
    "name": "Name of address",
    "address": "548, floor 5, Cluster G, Tower Al mas, JLT, Dubai, UAE",
    "country": "United Arab Emirates",
    "state": "Dubai",
    "city": "Dubai",
    "line1": "Jumeirah Lake Towers",
    "line2": "1068, Tower Meadows 2",
    "zip": "string",
    "details": "string",
    "id": "d3c1ec07-6087-4298-b35a-466a0832bed6"
}]

AddressOut:

lng number

lat number

zoom number

isDefault boolean

name string
name

address string
Address

country string
Country

state string
state

city string
city

line1 string
line1

line2 string
line2

zip string
zip (po box)

details string
notes for address

id string (uuid)

position **

Code sample

curl "https://api.stretch.com/api/v1/nav/addreses"
stretch "https://api.stretch.com/api/v1/nav/addreses"
1
2
3
4
import requests
r = requests.get("https://api.stretch.com/api/v1/nav/addreses", data=payload)
if r.status_code == 200:
print(r.json())
$servername = "localhost";
$username = "username";
$password = "password";
$dbname = "myDB";

function test()
{
    echo "This is a test function.";
}

$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error)
{
    die("Connection failed: " . $conn->connect_error);
}

$sql = "SELECT id, firstname, lastname FROM MyGuests";
$result = $conn->query($sql);

if ($result->num_rows > 0)
{
    // output data of each row
    while ($row = $result->fetch_assoc())
    {
        echo "id: " . $row["id"] . " - Name: " . $row["firstname"] . " " . $row["lastname"] . "<br>";
    }
}
else
{
    echo "0 results";
}
$conn->close();
const axios = require('axios');
axios({
    method: 'get',
    url: 'https://api.stretch.com/api/v1/nav/addreses',
    headers: {
        'Content-Type': 'application/json'
    }
}).then(response => {
    console.log(response.data);
}).catch(error => {
    console.log(error);
});
require 'net/http'
require 'json'

uri = URI("https://api.stretch.com/api/v1/nav/addreses")

header = {
  'Content-Type': 'application/json'
}

http = Net::HTTP.new(uri.host, uri.port)

request = Net::HTTP::{
  {
    method.capitalize
  }
}::new(uri, header)

response = http.request(request)

if response.code == '200'
data = JSON.parse(response.body)
puts data
else
  puts "Request failed with code: #{response.code}"
end
const https = require('https');

const options = {
    method: 'get',
    hostname: 'api.stretch.com',
    path: '/api/v1/nav/addreses',
    headers: {
        'Content-Type': 'application/json'
    }
};

const req = https.request(options, (res) => {
    let data = '';

    res.on('data', (chunk) => {
        data += chunk;
    });

    res.on('end', () => {
        if (res.statusCode === 200) {
            console.log(JSON.parse(data));
        } else {
            console.log(Request failed with status code: $ {
                res.statusCode
            });
        }
    });
});

req.on('error', (error) => {
    console.error(An error occurred: $ {
        error
    });
});

req.end();
using System;
using System.Net.Http;

async Task Main() {
  using(var client = new HttpClient()) {
    client.DefaultRequestHeaders.Add("Content-Type", "application/json");

    var response = await client. {
      {
        method
      }
    }
    Async(new Uri("https://api.stretch.com/api/v1/nav/addreses"));

    if (response.IsSuccessStatusCode) {
      var content = await response.Content.ReadAsStringAsync();
      Console.WriteLine(content);
    } else {
      Console.WriteLine($"Request failed with status code: {(int)response.StatusCode}");
    }
  }
}
package main

import (
    "fmt"
    "net/http"
    "encoding/json"
)

func main() {
    client: = & http.Client {}
    req,
    _: = http.NewRequest("get", "https://api.stretch.com/api/v1/nav/addreses", nil)
    req.Header.Set("Content-Type", "application/json")
    res,
    _: = client.Do(req)

        defer res.Body.Close()
    if res.StatusCode == 200 {
        var data interface {}
        json.NewDecoder(res.Body).Decode( & data)
        fmt.Println(data)
    } else {
        fmt.Println("Request failed with status code:", res.StatusCode)
    }
}

Create

POST https://api.stretch.com/api/v1/nav/addreses

Creates an address corresponding to the current user and saves it as the default location if user haven't set any default location.

This function returns:

  • The unique id of the location set.
  • The position as well as the zoom factor.
  • And the default location status.
Response

AddressOut

    [{
    "lng": 55.296249,
    "lat": 25.276,
    "zoom": 14,
    "isDefault": False,
    "name": "Name of address",
    "address": "548, floor 5, Cluster G, Tower Al mas, JLT, Dubai, UAE",
    "country": "United Arab Emirates",
    "state": "Dubai",
    "city": "Dubai",
    "line1": "Jumeirah Lake Towers",
    "line2": "1068, Tower Meadows 2",
    "zip": "string",
    "details": "string",
    "id": "d40b21de-e246-488a-a895-5ef77664e235"
},{
    "lng": 55.296249,
    "lat": 25.276,
    "zoom": 14,
    "isDefault": False,
    "name": "Name of address",
    "address": "548, floor 5, Cluster G, Tower Al mas, JLT, Dubai, UAE",
    "country": "United Arab Emirates",
    "state": "Dubai",
    "city": "Dubai",
    "line1": "Jumeirah Lake Towers",
    "line2": "1068, Tower Meadows 2",
    "zip": "string",
    "details": "string",
    "id": "640b3be1-bf41-42ea-8e44-773d70851f14"
}]

AddressOut:

lng number

lat number

zoom number

isDefault boolean

name string
name

address string
Address

country string
Country

state string
state

city string
city

line1 string
line1

line2 string
line2

zip string
zip (po box)

details string
notes for address

id string (uuid)

position **

HTTPValidationError

    {
    "detail": []
}

HTTPValidationError:

detail array

Code sample

curl "https://api.stretch.com/api/v1/nav/addreses"
stretch "https://api.stretch.com/api/v1/nav/addreses"
1
2
3
4
import requests
r = requests.post("https://api.stretch.com/api/v1/nav/addreses", data=payload)
if r.status_code == 200:
print(r.json())
$servername = "localhost";
$username = "username";
$password = "password";
$dbname = "myDB";

function test()
{
    echo "This is a test function.";
}

$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error)
{
    die("Connection failed: " . $conn->connect_error);
}

$sql = "SELECT id, firstname, lastname FROM MyGuests";
$result = $conn->query($sql);

if ($result->num_rows > 0)
{
    // output data of each row
    while ($row = $result->fetch_assoc())
    {
        echo "id: " . $row["id"] . " - Name: " . $row["firstname"] . " " . $row["lastname"] . "<br>";
    }
}
else
{
    echo "0 results";
}
$conn->close();
const axios = require('axios');
axios({
    method: 'post',
    url: 'https://api.stretch.com/api/v1/nav/addreses',
    headers: {
        'Content-Type': 'application/json'
    }
}).then(response => {
    console.log(response.data);
}).catch(error => {
    console.log(error);
});
require 'net/http'
require 'json'

uri = URI("https://api.stretch.com/api/v1/nav/addreses")

header = {
  'Content-Type': 'application/json'
}

http = Net::HTTP.new(uri.host, uri.port)

request = Net::HTTP::{
  {
    method.capitalize
  }
}::new(uri, header)

response = http.request(request)

if response.code == '200'
data = JSON.parse(response.body)
puts data
else
  puts "Request failed with code: #{response.code}"
end
const https = require('https');

const options = {
    method: 'post',
    hostname: 'api.stretch.com',
    path: '/api/v1/nav/addreses',
    headers: {
        'Content-Type': 'application/json'
    }
};

const req = https.request(options, (res) => {
    let data = '';

    res.on('data', (chunk) => {
        data += chunk;
    });

    res.on('end', () => {
        if (res.statusCode === 200) {
            console.log(JSON.parse(data));
        } else {
            console.log(Request failed with status code: $ {
                res.statusCode
            });
        }
    });
});

req.on('error', (error) => {
    console.error(An error occurred: $ {
        error
    });
});

req.end();
using System;
using System.Net.Http;

async Task Main() {
  using(var client = new HttpClient()) {
    client.DefaultRequestHeaders.Add("Content-Type", "application/json");

    var response = await client. {
      {
        method
      }
    }
    Async(new Uri("https://api.stretch.com/api/v1/nav/addreses"));

    if (response.IsSuccessStatusCode) {
      var content = await response.Content.ReadAsStringAsync();
      Console.WriteLine(content);
    } else {
      Console.WriteLine($"Request failed with status code: {(int)response.StatusCode}");
    }
  }
}
package main

import (
    "fmt"
    "net/http"
    "encoding/json"
)

func main() {
    client: = & http.Client {}
    req,
    _: = http.NewRequest("post", "https://api.stretch.com/api/v1/nav/addreses", nil)
    req.Header.Set("Content-Type", "application/json")
    res,
    _: = client.Do(req)

        defer res.Body.Close()
    if res.StatusCode == 200 {
        var data interface {}
        json.NewDecoder(res.Body).Decode( & data)
        fmt.Println(data)
    } else {
        fmt.Println("Request failed with status code:", res.StatusCode)
    }
}