Places Service: Documentation

Get Started with the Places API

List all available locations for use with timeanddate.com API Services.

Install Official Libraries

To get started, use one of timeanddate.com's official API libraries for your programming language. If your language isn't supported, you can send the requests manually over HTTP. If you would like to request an official library for your language, please contact us.


    $ dotnet add package TimeAndDate.Services
            

Build Query

The API library is now installed. You can now retrieve the list of available locations to query for with our API Services. The list you get back from this service is the equivalent of what you can see on available locations overview, but with more details.

To perform the query, you will need your access key and secret key: Get them from the Access Key page on My Account. Don't have a key? Sign up for our free trial and receive an access key to try it out.


    var service = new PlacesService('accessKey', 'secretKey');
    service.IncludeCoordinates = true; 
        

Get Result

The result variable will now contain all available locations in our database.


        var result = service.GetPlaces();
    

Where to go next?

See our GitHub repository for more information on the C#/.NET Library.


    <repository>
        <id>github</id>
        <name>Time and Date API Packages</name>
        <url>https://maven.pkg.github.com/timeanddate/libtad-jvm</url>
    </repository>
    <dependency>
        <groupId>com.timeanddate</groupId>
        <artifactId>services</artifactId>
        <version>1.0.0-SNAPSHOT</version>
    </dependency>
        

Build Query

The API library is now installed. You can now retrieve the list of available locations to query for with our API Services. The list you get back from this service is the equivalent of what you can see on available locations overview, but with more details.

To perform the query, you will need your access key and secret key: Get them from the Access Key page on My Account. Don't have a key? Sign up for our free trial and receive an access key to try it out.


    PlacesService service = new PlacesService('accessKey', 'secretKey');
    service.setIncludeCoordinates(true);
    

Get Result

The result variable will now contain all available locations in our database.


    List<Place> result = service.getPlaces();        
    

Where to go next?

See our GitHub repository for more information on the Java/JVM Library.


    # Carthage
    github "TimeAndDate/TadApi"
    # CocoaPods
    pod 'libtad-swift', '~> 1.0'
        

Build Query

The API library is now installed. You can now retrieve the list of available locations to query for with our API Services. The list you get back from this service is the equivalent of what you can see on available locations overview, but with more details.

To perform the query, you will need your access key and secret key: Get them from the Access Key page on My Account. Don't have a key? Sign up for our free trial and receive an access key to try it out.


    let service = PlacesService(accessKey: accessKey, secretKey: secretKey)
    let request = PlacesRequest()
    request.geo = true
        

Get Result

The result variable will now contain all available locations in our database.


    service.getPlace(request: request, completionHandler: { (result, error) in
        print(result)
    })
        

Where to go next?

See our GitHub repository for more information on the Swift Library.


    $ pip3 install libtad
            

Build Query

The API library is now installed. You can now retrieve the list of available locations to query for with our API Services. The list you get back from this service is the equivalent of what you can see on available locations overview, but with more details.

To perform the query, you will need your access key and secret key: Get them from the Access Key page on My Account. Don't have a key? Sign up for our free trial and receive an access key to try it out.


    from libtad import PlacesService
    
    service = PlacesService("accessKey", "secretKey")
    service.include_coordinates = True
        

Get Result

The result variable will now contain all available locations in our database.


    result = service.get_places()
    

Where to go next?

See our GitHub repository for more information on the Python Library.


    gem 'libtad'
            

Build Query

The API library is now installed. You can now retrieve the list of available locations to query for with our API Services. The list you get back from this service is the equivalent of what you can see on available locations overview, but with more details.

To perform the query, you will need your access key and secret key: Get them from the Access Key page on My Account. Don't have a key? Sign up for our free trial and receive an access key to try it out.


    client = LibTAD::Client.new(access_key: 'access_key', secret_key: 'secret_key')
        

Get Result

The result variable will now contain all available locations in our database.


    result = client.get_places
    

Where to go next?

See our GitHub repository for more information on the Ruby Library.

Build Query

You will need cURL installed in order to execute the following commands. The following samples also require you to have enabled "Insecure Methods" on your access key.


    $ ACCESSKEY="<Your Access Key>"
    $ SECRETKEY="<Your Secret Key>"
    $ curl -G \
    --data-urlencode "version=3" \
    --data-urlencode "prettyprint=1" \
    --data-urlencode "accesskey=$ACCESSKEY" \
    --data-urlencode "secretkey=$SECRETKEY" \
    --data-urlencode "geo=1" \
    https://api.xmltime.com/places
        

Get results

Execute cURL with the parameters set previously and receive the resulting list as a JSON object.


{
  "version": 3,
  "billing": {
    "credits": 1
  },
  "places": [{
    "id": 1,
    "urlid": "cote-divoire/abidjan",
    "geo": {
      "name": "Abidjan",
      "country": {
        "id": "ci",
        "name": "Cote d'Ivoire"
      },
      "latitude": 5.320,
      "longitude": -4.020
    }
  },{
    "id": 2,
    "urlid": "united-arab-emirates/abu-dhabi",
    "geo": {
      "name": "Abu Dhabi",
      "state": "Abu Dhabi",
      "country": {
        "id": "ae",
        "name": "United Arab Emirates"
      },
      "latitude": 24.475,
      "longitude": 54.371
    }
  },{
    "id": 3,
    "urlid": "mexico/acapulco",
    "geo": {
      "name": "Acapulco",
      "state": "Guerrero",
      "country": {
        "id": "mx",
        "name": "Mexico"
      },
      "latitude": 16.860,
      "longitude": -99.877
    }
  },{
       ....