

"3": "3 is the number of sets needed to be won to win the whole match in volleyball.",

"2": "2 is the number of polynucleotide strands in a DNA double helix.", "1": "1 is the number of dimensions of a line.", The query parameter json may still be used to specify whether individual facts will be returned as string literals or JSON objects. The response format will always be a JSON map from numbers to facts, of at most 100 numbers. Separate multiple ranges and individual numbers with, (a comma). To get facts about multiple numbers in one request, specify ranges for number in number/ type.Ī number range (inclusive) is specified as min. "text": "2012 is the year that the century's second and last solar transit of Venus occurs on June 6.", year (sometimes): A year associated with some date facts, as a string.date (sometimes): A day of year associated with some year facts, as a string.type: String of the category of the returned fact.For a date fact, this is the 1-indexed day of a leap year (eg. number: The floating-point number that the fact pertains to.found: Boolean of whether there was a fact for the requested number.text: A string of the fact text itself.Include the query parameter `json` or set the HTTP header `Content-Type` to `application/json` to return the fact and associated meta-data as a JSON object, with the properties: Restrict the range of values returned to the inclusive range when random is given as the number.ġ3 is the number of provinces and territories in Canada. ⇒ document.write("42 is the 5th Catalan number.") Note that using this query parameter is equivalent to and just a shorthand of `?callback=document.write`. Returns the text response wrapped in a call to (). ⇒ showNumber("42 is the 5th Catalan number.") The response will be that function called on the fact text as a string literal. To use (), pass to the `callback` query the name of the JavaScript function to be invoked. The value of the `default` query field tells us what to return if we don't have a fact for the requested number. ⇒ 98 BC is the year that the Senate passes the Lex Caecilia Didia which bans omnibus bills.Ĭombine with the fragment option to produce interesting facts about, for example, the number of page shares. ceil, which is like floor but rounds up to the smallest number that has an associated fact.⇒ 35000 is the number of genes in a human being. floor to round down to the largest number that does have an associated fact, and return that fact.default to return one of our pre-written missing messages, or a message you supply with the default query field.The notfound field tells us what to do if the number is not found. ⇒ an estimated 500 million people worldwide watch Neil Armstrong take his historic first steps on the Moon ⇒ the number of times Julius Caesar was stabbed For trivia and math, a noun phrase is returned that can be used in a sentence like "We now have more users than !". This means that the first word is lowercase and ending punctuation is omitted. Return the fact as a sentence fragment that can be easily included as part of a larger sentence. Note that this may degrade page load speed. Now you can stick just a single directly where the fact should go. Var scriptTag = document.createElement('script') Īdd write to your query string to have the response text wrapped in document.write(). is supported with the query field callback: ĭocument.getElementById('number-fact').innerText = str ⇒ 2013 is the year that China will attempt its first unmanned Moon landing.ĭirect cross-origin requests like this are possible on browsers that support CORS. ⇒ February 29 is the day in 1504 that Christopher Columbus uses his knowledge of a lunar eclipse to convince Native Americans to provide him with supplies. ⇒ 42 is the result given by Google and Bing for the query "the answer to life the universe and everything". a day of year in the form month/ day (eg.the keyword random, for which we will try to return a random available fact, or.type is one of trivia, math, date, or year.Just hit number/ type to get a plain text response, where Bring meaning to your metrics and stories to your dates with our API of interesting number facts.
