DrayEasy API v2

DrayEasy API v2


City Search

<h2>Overview</h2> <p>This API endpoint offers a flexible way to retrieve information about cities by supporting search queries based on city names or UN/LOCODEs. It's designed to help users find detailed city data, including geographic coordinates and zip codes.</p> <h2>Request</h2> <ul> <li>Method: <strong>GET</strong></li> <li>URI: <code>/cities?query=xxx</code> or <code>/cities?unlocode=xxx</code></li> </ul> <p><strong>Warning:</strong> Either the 'query' or 'unlocode' parameter must be present. However, 'unlocode' should be the only active option when both 'query' and 'unlocode' parameters are present.</p> <h2>Code Example</h2> <pre><code>Request: curl https://api.drayeasy.com/api/v2/cities?query=Ontario,CA \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer xxxxxxxxx' Response: HTTP/1.1 200 OK Content-Type: application/json; charset=utf-8 { &amp;quot;data&amp;quot;: [ { &amp;quot;id&amp;quot;: 115, &amp;quot;country&amp;quot;: &amp;quot;USA&amp;quot;, &amp;quot;full_name&amp;quot;: &amp;quot;Ontario, CA, USA&amp;quot;, &amp;quot;full_name_zipcode&amp;quot;: &amp;quot;Ontario, CA, USA&amp;quot;, &amp;quot;zipcodes&amp;quot;: [ &amp;quot;91761&amp;quot;, &amp;quot;91762&amp;quot;, &amp;quot;91764&amp;quot; ], &amp;quot;name&amp;quot;: &amp;quot;Ontario&amp;quot;, &amp;quot;state&amp;quot;: &amp;quot;CA&amp;quot;, &amp;quot;alias&amp;quot;: null, &amp;quot;latitude&amp;quot;: 34.0631, &amp;quot;longitude&amp;quot;: -117.6197 } ] }</code></pre> <h2>Respone Fields Description</h2> <table> <thead> <tr> <th>Field</th> <th>Type</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td>id</td> <td>Integer</td> <td>A unique identifier for the city.</td> </tr> <tr> <td>country</td> <td>String</td> <td>The country where the city is located.</td> </tr> <tr> <td>full_name</td> <td>String</td> <td>The full name of the city, including state and country.</td> </tr> <tr> <td>full_name_zipcode</td> <td>String</td> <td>The city's full name, potentially intended for future use to include zip code.</td> </tr> <tr> <td>zipcodes</td> <td>String[]</td> <td>An array of zip codes associated with the city.</td> </tr> <tr> <td>name</td> <td>String</td> <td>The name of the city.</td> </tr> <tr> <td>state</td> <td>String</td> <td>The state or region where the city is located.</td> </tr> <tr> <td>alias</td> <td>String</td> <td>An alternative name or alias for the city, if any.</td> </tr> <tr> <td>latitude</td> <td>Float</td> <td>The city's geographic latitude.</td> </tr> <tr> <td>longitude</td> <td>Float</td> <td>The city's geographic longitude.</td> </tr> </tbody> </table>

页面列表

ITEM_HTML