| Route | Verb | Description |
|---|---|---|
| /health | GET | Health check |
| /query | POST | Returns result of all sub-queries |
| /query/boundary | POST | Specify whether point is in client boundary |
| /query/location | POST | Determine what boundary the location falls in |
| /query/zone | POST | Determine what client zone the location falls in |
| /query/maintenance | POST | Determine nearest eligible or ineligible road |
| /query/disposalDistance | POST,GET | Get straight-line distance (miles) between pile and disposal site. Provide pileX (lon for pile), pileY (lat for pile), disposalX(lon for disposal site), and disposalY (lat for disposal site) in request body. |
| /query/status | POST | Discover available services for a given project. Provide projectid and token |
| /query/geojson | POST | Provides preconfigured endpoint URLs to retrieve boundary and road geojson. Provide a projectid and a token to return roadGeoJsonUrl and boundaryGeoJsonUrl |
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
| x | number | yes | longitude | -87.309014 |
| y | number | yes | latitude | 30.552461 |
| projectid | string | yes | id of project to query | 29043795-D22D-4BA2-B496-689198E0130F |
| token | string | yes | portal secure access token | bQqbQvEmV1DIFoUZW5iwMq1Phet7XQw9... |
const params = {
'x': '-87.309014',
'y': '30.552461',
'token': '[INSERT-VALID-TOKEN-HERE]',
'projectid': '29043795-D22D-4BA2-B496-689198E0130F'
}
const searchParams = Object.keys(params).map((key) => {
return encodeURIComponent(key) + '=' + encodeURIComponent(params[key])
}).join('&')
const response = await fetch('https://[INSERT-APP-URL-HERE]/query', {
method: 'POST',
headers:{
'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
},
body: searchParams
}).then(res => res.json())
{
"boundary": {
"query": "Boundary",
"description": "Specify whether point is in client boundary",
"result": "inside"
},
"location": {
"query": "Location",
"description": "Determine what boundary the location falls in",
"result": "Escambia County"
},
"zone": {
"query": "Zone",
"description": "Determine what client zone the location falls in",
"result": "Zone 3"
},
"maintenance": {
"query": "Maintenance",
"description": "Determine nearest eligible or ineligible road",
"result": {
"entity": "Escambia County",
"street": "GREEN HILLS RD",
"distance_ft": 62.06399576725591,
"near_far": "near",
"eligible_entity": true
}
}
}
const getToken = async () => {
// get token before test suite runs
const params = {
username: [USERNAME],
password: [PASSWORD],
referer: 'tests'
}
const searchParams = Object.keys(params).map((key) => {
return encodeURIComponent(key) + '=' + encodeURIComponent(params[key])
}).join('&')
const response = await fetch('https://gis.thompsoncs.net/arcgis/sharing/rest/generateToken?f=json&expiration=20160', {
method: 'POST',
headers:{
'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
},
body: searchParams
}).then(res => res.json())
token = response.token
return Promise.resolve()
}