Most Popular API
GET
Most Emailed by Section & Time Period
{{baseUrl}}/mostemailed/:section/:time-period.json
QUERY PARAMS
api-key
{{apiKey}}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/mostemailed/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/mostemailed/:section/:time-period.json" {:query-params {:api-key "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/mostemailed/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/mostemailed/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/mostemailed/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/mostemailed/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/mostemailed/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/mostemailed/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/mostemailed/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/mostemailed/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/mostemailed/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/mostemailed/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/mostemailed/:section/:time-period.json',
params: {'api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/mostemailed/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/mostemailed/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/mostemailed/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/mostemailed/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/mostemailed/:section/:time-period.json',
qs: {'api-key': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/mostemailed/:section/:time-period.json');
req.query({
'api-key': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/mostemailed/:section/:time-period.json',
params: {'api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/mostemailed/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/mostemailed/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/mostemailed/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/mostemailed/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/mostemailed/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D');
echo $response->getBody();
setUrl('{{baseUrl}}/mostemailed/:section/:time-period.json');
$request->setMethod(HTTP_METH_GET);
$request->setQueryData([
'api-key' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/mostemailed/:section/:time-period.json');
$request->setRequestMethod('GET');
$request->setQuery(new http\QueryString([
'api-key' => '{{apiKey}}'
]));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/mostemailed/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/mostemailed/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/mostemailed/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/mostemailed/:section/:time-period.json"
querystring = {"api-key":"{{apiKey}}"}
response = requests.get(url, params=querystring)
print(response.json())
library(httr)
url <- "{{baseUrl}}/mostemailed/:section/:time-period.json"
queryString <- list(api-key = "{{apiKey}}")
response <- VERB("GET", url, query = queryString, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/mostemailed/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/mostemailed/:section/:time-period.json') do |req|
req.params['api-key'] = '{{apiKey}}'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/mostemailed/:section/:time-period.json";
let querystring = [
("api-key", "{{apiKey}}"),
];
let client = reqwest::Client::new();
let response = client.get(url)
.query(&querystring)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url '{{baseUrl}}/mostemailed/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D'
http GET '{{baseUrl}}/mostemailed/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D'
wget --quiet \
--method GET \
--output-document \
- '{{baseUrl}}/mostemailed/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D'
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/mostemailed/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"copyright": "Copyright (c) 2016 The New York Times Company. All Rights Reserved.",
"errors": [
"Param 'period' is invalid."
],
"results": [],
"status": "ERROR"
}
RESPONSE HEADERS
Content-Type
application/xml
RESPONSE BODY xml
Developer Over Qps
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/mostshared/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/mostshared/:section/:time-period.json" {:query-params {:api-key "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/mostshared/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/mostshared/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/mostshared/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/mostshared/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/mostshared/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/mostshared/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/mostshared/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/mostshared/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/mostshared/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/mostshared/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/mostshared/:section/:time-period.json',
params: {'api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/mostshared/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/mostshared/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/mostshared/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/mostshared/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/mostshared/:section/:time-period.json',
qs: {'api-key': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/mostshared/:section/:time-period.json');
req.query({
'api-key': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/mostshared/:section/:time-period.json',
params: {'api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/mostshared/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/mostshared/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/mostshared/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/mostshared/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/mostshared/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D');
echo $response->getBody();
setUrl('{{baseUrl}}/mostshared/:section/:time-period.json');
$request->setMethod(HTTP_METH_GET);
$request->setQueryData([
'api-key' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/mostshared/:section/:time-period.json');
$request->setRequestMethod('GET');
$request->setQuery(new http\QueryString([
'api-key' => '{{apiKey}}'
]));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/mostshared/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/mostshared/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/mostshared/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/mostshared/:section/:time-period.json"
querystring = {"api-key":"{{apiKey}}"}
response = requests.get(url, params=querystring)
print(response.json())
library(httr)
url <- "{{baseUrl}}/mostshared/:section/:time-period.json"
queryString <- list(api-key = "{{apiKey}}")
response <- VERB("GET", url, query = queryString, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/mostshared/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/mostshared/:section/:time-period.json') do |req|
req.params['api-key'] = '{{apiKey}}'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/mostshared/:section/:time-period.json";
let querystring = [
("api-key", "{{apiKey}}"),
];
let client = reqwest::Client::new();
let response = client.get(url)
.query(&querystring)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url '{{baseUrl}}/mostshared/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D'
http GET '{{baseUrl}}/mostshared/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D'
wget --quiet \
--method GET \
--output-document \
- '{{baseUrl}}/mostshared/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D'
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/mostshared/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"copyright": "Copyright (c) 2016 The New York Times Company. All Rights Reserved.",
"num_results": 24,
"results": [
{
"abstract": "Timothy D. Cook, Apple’s chief, said the government’s request to bypass security on the phone used by Syed Rizwan Farook had “chilling” implications.",
"asset_id": 100000004214575,
"byline": "By ERIC LICHTBLAU and KATIE BENNER",
"column": "",
"des_facet": [
"IPHONE"
],
"geo_facet": "",
"media": [
{
"caption": "Timothy D. Cook, the chief executive of Apple, released a letter to customers several hours after a California judge ordered the company to unlock an iPhone used by one of the shooters in a recent attack that killed 14 people in San Bernardino.",
"copyright": "Jeff Chiu/Associated Press",
"media-metadata": [
{
"format": "Standard Thumbnail",
"height": 75,
"url": "http://static01.nyt.com/images/2016/02/18/world/18Appleletter-web/18Appleletter-web-thumbStandard.jpg",
"width": 75
}
],
"subtype": "photo",
"type": "image"
}
],
"org_facet": [
"APPLE INC"
],
"per_facet": [
"COOK, TIMOTHY D"
],
"published_date": "2016-02-18",
"section": "Technology",
"source": "The New York Times",
"title": "Apple Fights Order to Unlock San Bernardino Gunman’s iPhone",
"total_shares": 1,
"url": "http://www.nytimes.com/2016/02/18/technology/apple-timothy-cook-fbi-san-bernardino.html"
}
],
"status": "OK"
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"copyright": "Copyright (c) 2016 The New York Times Company. All Rights Reserved.",
"errors": [
"Please specify a supported period, options are: 1,7,30"
],
"results": [],
"status": "ERROR"
}
GET
Most Viewed by Section & Time Period
{{baseUrl}}/mostviewed/:section/:time-period.json
QUERY PARAMS
api-key
{{apiKey}}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/mostviewed/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/mostviewed/:section/:time-period.json" {:query-params {:api-key "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/mostviewed/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/mostviewed/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/mostviewed/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/mostviewed/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/mostviewed/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/mostviewed/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/mostviewed/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/mostviewed/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/mostviewed/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/mostviewed/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/mostviewed/:section/:time-period.json',
params: {'api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/mostviewed/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/mostviewed/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/mostviewed/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/mostviewed/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/mostviewed/:section/:time-period.json',
qs: {'api-key': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/mostviewed/:section/:time-period.json');
req.query({
'api-key': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/mostviewed/:section/:time-period.json',
params: {'api-key': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/mostviewed/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/mostviewed/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/mostviewed/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/mostviewed/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/mostviewed/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D');
echo $response->getBody();
setUrl('{{baseUrl}}/mostviewed/:section/:time-period.json');
$request->setMethod(HTTP_METH_GET);
$request->setQueryData([
'api-key' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/mostviewed/:section/:time-period.json');
$request->setRequestMethod('GET');
$request->setQuery(new http\QueryString([
'api-key' => '{{apiKey}}'
]));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/mostviewed/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/mostviewed/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/mostviewed/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/mostviewed/:section/:time-period.json"
querystring = {"api-key":"{{apiKey}}"}
response = requests.get(url, params=querystring)
print(response.json())
library(httr)
url <- "{{baseUrl}}/mostviewed/:section/:time-period.json"
queryString <- list(api-key = "{{apiKey}}")
response <- VERB("GET", url, query = queryString, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/mostviewed/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/mostviewed/:section/:time-period.json') do |req|
req.params['api-key'] = '{{apiKey}}'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/mostviewed/:section/:time-period.json";
let querystring = [
("api-key", "{{apiKey}}"),
];
let client = reqwest::Client::new();
let response = client.get(url)
.query(&querystring)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url '{{baseUrl}}/mostviewed/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D'
http GET '{{baseUrl}}/mostviewed/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D'
wget --quiet \
--method GET \
--output-document \
- '{{baseUrl}}/mostviewed/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D'
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/mostviewed/:section/:time-period.json?api-key=%7B%7BapiKey%7D%7D")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"copyright": "Copyright (c) 2016 The New York Times Company. All Rights Reserved.",
"num_results": 121,
"results": [
{
"abstract": "Republicans have parked themselves so far to the right for so many years that it’s not clear if they can hear how deranged they sound.",
"adx_keywords": "Supreme Court (US);McConnell, Mitch;Scalia, Antonin;Obama, Barack;Kirk, Mark Steven;Republican Party;Senate;Cornyn, John;Collins, Susan M",
"asset_id": 100000004229487,
"byline": "By THE EDITORIAL BOARD",
"column": "Editorial",
"des_facet": "",
"geo_facet": "",
"id": 100000004229487,
"media": "",
"org_facet": [
"SUPREME COURT (US)"
],
"per_facet": [
"MCCONNELL, MITCH"
],
"published_date": "2016-02-25",
"section": "Opinion",
"source": "The New York Times",
"title": "Senate Republicans Lose Their Minds on a Supreme Court Seat",
"type": "Article",
"url": "http://www.nytimes.com/2016/02/25/opinion/senate-republicans-lose-their-minds-on-a-supreme-court-seat.html",
"views": 1
}
],
"status": "OK"
}