BIPM Time Department API Web Service
Overview
To answer the need of providing machine readable data, the BIPM Time Department started providing access to machine readable data through automatized process.
Results are still available using FTP protocol, this remains unchanged. In addition to the historical FTP access, it is proposed an application programming interface (API) using GET method which gives access to machine readable data regarding various time scales. The method to access these data is using HTTP/HTTPS protocol: This can be done using utilities to transfer data from a server (such as cURL, wget or any programming languages supporting HTTP protocol). Data are provided in standard exchange format, such as JSON, CSV and text.
Custom requests arguments
The API using GET method uses URL general syntax below :
https://webtai.bipm.org/api/v0.1/get-data.html?arg1=xxxx&arg2=yyyy
...
Using as many arguments as needed by your query.
-
customized period
To get only a subset of available data between given two MJDs, following URLs should be completed with:
&mjd1=59000&mjd2=59200
(example for request between MJD 59000 and 59200) -
customized output file format
Ouput format can be JSON (default, if not specified), Comma-Separated Values (CSV) or Text.
To define output format of the request, use following arguments in the URL:
&outfile=json
&outfile=csv
&outfile=txt
(In fixed format :%6d %10s %10s\r\n
for a 2-scales request and%6d %10s \r\n
for a single scale request) -
laboratory name selection
In this document labo refers to the laboratory acronym as used in Circular T (up to 4-characters).
&lab=labo
-
time scale selection Results from several time scales are available, the examples in the following section.
Get values [Scale-local realizations of UTC]
URL to get [UTC-UTC(lab)] |
---|
https://webtai.bipm.org/api/v0.1/get-data.html?scale=utc&lab=labo |
URL to get [UTCr-UTC(lab)] |
---|
https://webtai.bipm.org/api/v0.1/get-data.html?scale=utcr&lab=labo |
URL to get both [UTC-UTC(lab)] and [UTCr-UTC(lab)] |
---|
https://webtai.bipm.org/api/v0.1/get-data.html?scale=utc+utcr&lab=labo |
Get values [UTC-GNSS time scales]
URL to get [UTC-GPS Time] |
---|
https://webtai.bipm.org/api/v0.1/get-data.html?scale=gps |
URL to get [UTC-GLONASS Time] |
---|
https://webtai.bipm.org/api/v0.1/get-data.html?scale=glonass |
URL to get both [UTC-GPS Time] and [UTC-GLONASS Time] |
---|
https://webtai.bipm.org/api/v0.1/get-data.html?scale=gnss |
Note that the content of the JSON file produces is likely to evolve depending on new GNSS Time scales availability.
HTTP utilities / examples
It is required to use utilities supporting HTTP protocol to get the data, such as cURL (https://curl.se/) , wget (https://www.gnu.org/software/wget/) or other programming languages such as Python, Perl,â¦
Below you can find examples of commands:
Using wget |
---|
wget -O utc-utc_aos.json "https://webtai.bipm.org/api/v0.1/get-data.html?scale=utc&lab=AOS" |
Using cURL |
---|
curl -k --url "https://webtai.bipm.org/api/v0.1/get-data.html?scale=utc&lab=AOS" > utc-utc_aos.json |
Using Perl |
---|
#!/usr/bin/perl
use LWP::UserAgent;
my $ua = LWP::UserAgent->new;
my $response = $ua->get("https://webtai.bipm.org/api/v0.1/get-data.html?scale=utc&lab=AOS") ;
if ($response->is_success) { print $response->decoded_content; }
Using Python |
---|
import requests
r = requests.get("https://webtai.bipm.org/api/v0.1/get-data.html?scale=utc&lab=AOS")
print(r.text)
Version
version 0.1 - testing version (16/12/2021)