1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "url": "https://jsonplaceholder.typicode.com/todos/1",
12 "method": "GET",
13 "params": {},
14 "data": {},
15 "rowId": "",
16 "requests": [],
17 "urls": [],
18 "urlTemplate": "",
19 "templateValues": [],
20 "paginationMode": "none",
21 "maxPages": 1,
22 "pageParam": "",
23 "pageSize": 100,
24 "nextPagePath": "",
25 "stopWhenEmptyPath": "",
26 "maxConcurrency": 10,
27 "requestsPerSecond": 0,
28 "dedupeRequests": false,
29 "timeoutSecs": 30,
30 "maxRetries": 2,
31 "retryOnStatusCodes": [
32 408,
33 425,
34 429,
35 500,
36 502,
37 503,
38 504
39 ],
40 "retryUnsafeMethods": false,
41 "followRedirects": true,
42 "maxRedirects": 5,
43 "ignoreTlsErrors": false,
44 "parseJson": true,
45 "extract": {},
46 "bodyMode": "auto",
47 "maxResponseBytes": 1000000,
48 "saveOversizedBodyToKeyValueStore": true,
49 "includeResponseHeaders": true,
50 "failOnErrorStatus": false,
51 "expectedStatusCodes": [],
52 "expectedBodyContains": "",
53 "authType": "none",
54 "proxyConfiguration": {
55 "useApifyProxy": false
56 },
57 "proxyRouting": "always",
58 "proxyRotation": "perRequest",
59 "clientProfile": "auto",
60 "callbackUrl": ""
61};
62
63
64const run = await client.actor("getascraper/http-request-runner").call(input);
65
66
67console.log('Results from dataset');
68console.log(`๐พ Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
69const { items } = await client.dataset(run.defaultDatasetId).listItems();
70items.forEach((item) => {
71 console.dir(item);
72});
73
74