Skip to content

Commit 8470eb3

Browse files
committed
add distance filter section
1 parent b53857c commit 8470eb3

File tree

6 files changed

+36
-2
lines changed

6 files changed

+36
-2
lines changed

pages/api.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ info_sections:
1616
title: Creating/Updating Users
1717
id: creating-updating-users
1818
layout: /creating-updating-users/creating-updating-users.yml
19+
-
20+
title: Distance Filter on User Lists
21+
id: distance-filter
22+
layout: /distance-filter/distance-filter.yml
1923
-
2024
title: Custom Fields
2125
id: custom-fields

pages/contractors/contractor-object.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,11 +229,11 @@ filters:
229229
type: string
230230
description: Filter by the Contractor's status.
231231
-
232-
name: address
232+
name: distance_address
233233
type: string
234234
description: Filter by the address.
235235
-
236-
name: radius
236+
name: distance_radius
237237
type: integer
238238
description: Filter by the radius of the address. This is used in conjunction with the `address` filter.
239239
-
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
attributes:
2+
-
3+
name: distance
4+
type: string
5+
description: A URL-encoded string representing the starting location for the search. This must be specific (e.g., including city, postal code, and country) for accurate results. Ensure the address is properly encoded, where spaces are replaced with `%20`, commas with `%2C`, and other special characters are handled accordingly.
6+
-
7+
name: radius
8+
type: integer
9+
description: The radius in kilometers around the distance_address to filter users. Users outside this radius will not be included.
10+
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[Agents](#agents), [Clients](#clients), [Contractors](#contractors), [Recipients](#recipients) can be filtered based on their proximity
2+
to a specific location using the distance_address and distance_radius parameters.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import pprint
2+
import requests
3+
4+
headers = {'Authorization': 'token <API KEY>'}
5+
url = (
6+
'https://secure.tutorcruncher.com/api/contractors/'
7+
'?distance_address=The%20Food%20Exchange%2C%20New%20Covent%20Garden%20Market%2C%20Nine%20Elms%2C%20London%20SW8%205EL%2C%20ENGLAND'
8+
'&distance_radius=1'
9+
)
10+
response = requests.get(url, headers=headers)
11+
pprint.pprint(response.json())
12+
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
sections:
2+
-
3+
description: /distance-filter/distance-filter.md
4+
code: /distance-filter/distance-filter.py
5+
attributes: /distance-filter/distance-filter-object.yml
6+
code_type: POST

0 commit comments

Comments
 (0)