Destination

Destination objects are the expected end locations for Tasks. Destinations can belong to Customers.

The Destination object

Property Type Description
id uuid string Unique identifier for the object
customer_id uuid string The id of the customer to which this destination belongs
neighborhood_id uuid string The id of neighborhood to which this destination belongs
address string Street address of the object
landmark string Landmark near the object
zip_code string Zip or postal code of the object
city string City of the object
state string State of the object
country string Country of the object
location GeoJSON point Location in GeoJSON format
created_at ISO datetime string Timestamp of when customer was created
modified_at ISO datetime string Timestamp of when customer was modified

[warning] Locations use the GeoJSON format

In GeoJSON, the coordinates are represented as [longitude, latitude]. This is different from what you will have used in the Google Maps APIs ([latitude, longitude]). To know more GeoJSON, read their spec.

Create a Destination

Creates a new destination object.

HTTP Request

POST https://app.hypertrack.io/api/v1/destinations/

Returns

Returns a destination object if the call succeeded.

Parameters

Parameter Required Description
customer_id No The id of the customer to which this destination belongs
address No Street address of the object
landmark No Landmark near the object
zip_code No Zip or postal code of the object
city No City of the object
state No State of the object
country No Country of the object
location No Location in GeoJSON format

[info] Geocoding

When the latitude-longitude is specified in location field, it is assumed to be the exact location. If it is not specified, then the address field is used to geocode the destination, and the geocoded latitude-longitude is saved as the location property. Although most of the data is optional, the estimated latitude-longitude improves when more data is provided.

curl -H "Authorization: token YOUR_SK_TOKEN" \
     -H "Content-Type: application/json" \
     -X POST \
     -d "{\"address\": \"270 Linden Street\", \"city\": \"San Francisco\"}" \
     https://app.hypertrack.io/api/v1/destinations/

% sample lang="python" %}

destination = hypertrack.Destination.create(address='270 Linden Street', city='San Francisco')

Example response

{
  "id":"15ce9cdc-1409-4976-a260-dc0e5b2445ac",
  "customer_id":null,
  "address":"270 Linden Street",
  "landmark":"",
  "zip_code":"94102",
  "city":"San Francisco",
  "state":"California",
  "country":"US",
  "location":{
    "type":"Point",
    "coordinates":[
      -122.4224045,
      37.7766968
    ]
  },
  "created_at":"2016-03-09T05:36:42.500905Z",
  "modified_at":"2016-03-09T05:36:42.500941Z"
}

Retrieve a Destination

Retrieves the details of an existing destination.

HTTP Request

GET https://app.hypertrack.io/api/v1/destinations/<id>/

Returns

Returns a destination object if a valid identifier was provided.

curl -H "Authorization: token YOUR_PK_TOKEN" \
     https://app.hypertrack.io/api/v1/destinations/15ce9cdc-1409-4976-a260-dc0e5b2445ac/

% sample lang="python" %}

destination = hypertrack.Destination.retrieve('15ce9cdc-1409-4976-a260-dc0e5b2445ac')

Example response

{
  "id":"15ce9cdc-1409-4976-a260-dc0e5b2445ac",
  "customer_id":null,
  "address":"270 Linden Street",
  "landmark":"",
  "zip_code":"94102",
  "city":"San Francisco",
  "state":"California",
  "country":"US",
  "location":{
    "type":"Point",
    "coordinates":[
      -122.4224045,
      37.7766968
    ]
  },
  "created_at":"2016-03-09T05:36:42.500905Z",
  "modified_at":"2016-03-09T05:36:42.500941Z"
}

Update a Destination

Edit an existing destination object.

HTTP Request

PATCH https://app.hypertrack.io/api/v1/destinations/<id>/

Returns

Returns the updated destination object.

Parameters

Parameter Required Description
customer_id No The id of the customer to which this destination belongs
address No Street address of the object
landmark No Landmark near the object
zip_code No Zip or postal code of the object
city No City of the object
state No State of the object
country No Country of the object
location No Location in GeoJSON format

[warning] Live tasks

Updating the destination will affect all live tasks that are expected to end at this destination.

curl -H "Authorization: token YOUR_SK_TOKEN" \
     -H "Content-Type: application/json" \
     -X PATCH \
     -d "{\"customer_id\": \"98241a3b-82bf-46c5-8dea-61377c546c5e\"}" \
     https://app.hypertrack.io/api/v1/destinations/15ce9cdc-1409-4976-a260-dc0e5b2445ac/

% sample lang="python" %}

destination = hypertrack.Destination.retrieve('15ce9cdc-1409-4976-a260-dc0e5b2445ac')
destination.customer_id = '98241a3b-82bf-46c5-8dea-61377c546c5e'
destination.save()

Example response

{
  "id":"15ce9cdc-1409-4976-a260-dc0e5b2445ac",
  "customer_id":"98241a3b-82bf-46c5-8dea-61377c546c5e",
  "address":"270 Linden Street",
  "landmark":"",
  "zip_code":"94102",
  "city":"San Francisco",
  "state":"California",
  "country":"US",
  "location":{
    "type":"Point",
    "coordinates":[
      -122.4224045,
      37.7766968
    ]
  },
  "created_at":"2016-03-09T05:36:42.500905Z",
  "modified_at":"2016-03-09T05:36:42.500941Z"
}

Delete a Destination

Delete an existing destination object.

HTTP Request

DELETE https://app.hypertrack.io/api/v1/destinations/<id>/

Returns

Empty response if the object is deleted.

curl -H "Authorization: token YOUR_SK_TOKEN" \
     -H "Content-Type: application/json" \
     -X DELETE \
     https://app.hypertrack.io/api/v1/destinations/15ce9cdc-1409-4976-a260-dc0e5b2445ac/

% sample lang="python" %}

destination = hypertrack.Destination.retrieve('15ce9cdc-1409-4976-a260-dc0e5b2445ac')
destination.delete()

Example response

{}

List all Destinations

Returns a list of your destinations. The destinations are returned sorted by updated date, with the most recently updated destinations appearing first.

HTTP Request

GET https://app.hypertrack.io/api/v1/destinations/

Returns

Returns a list of destinations.

Parameters

Parameter Required Description
page_size No Maximum number of objects to return, default is 50
customer_id No Filter destination objects by customer
min_date No Filter objects by minimum created at date
max_date No Filter objects by maximum created at date
curl -H "Authorization: token YOUR_SK_TOKEN" \
     https://app.hypertrack.io/api/v1/destinations/

% sample lang="python" %}

destinations = hypertrack.Destination.list()

Example response

{
  "count":1,
  "next":null,
  "previous":null,
  "results":[
    {
      "id":"15ce9cdc-1409-4976-a260-dc0e5b2445ac",
      "customer_id":"f3ead2ae-dc0a-4a7e-85be-74ee51d9d70a",
      "neighborhood_id": "65b126f3-71e2-4717-903d-6a8ca52d26c3",
      "address":"270 Linden Street",
      "landmark":"",
      "zip_code":"94102",
      "city":"San Francisco",
      "state":"California",
      "country":"US",
      "location":{
        "type":"Point",
        "coordinates":[
          -122.4224045,
          37.7766968
        ]
      },
      "created_at":"2016-03-09T05:36:42.500905Z",
      "modified_at":"2016-03-09T05:36:42.500941Z"
    }
  ]
}

Was this helpful? Yes, thanks! Not really

results matching ""

    No results matching ""