1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "stringTextfield": "prefilled value",
12 "stringTextfieldWithPattern": "abc123",
13 "stringJavascript":
14 function hello() {
15 return 'Hello World!';
16 },
17 "stringPython": `# Python code
18 def hello():
19 return 'Hello World!'`,
20 "stringSelectSuggested": "suggested1",
21 "stringDateAbsolute": "2024-01-15",
22 "stringDateRelative": "7 days ago",
23 "stringDateAbsoluteOrRelative": "2024-01-01",
24 "stringSecret": "secret-value-123",
25 "arrayRequestListSources": [
26 {
27 "url": "https://example.com"
28 },
29 {
30 "url": "https://example.org",
31 "method": "POST"
32 }
33 ],
34 "arrayPseudoUrls": [
35 {
36 "purl": "https://example.com/[.*]"
37 }
38 ],
39 "arrayGlobs": [
40 {
41 "glob": "https://example.com/**/*.html"
42 }
43 ],
44 "arrayKeyValue": [
45 {
46 "key": "Content-Type",
47 "value": "application/json"
48 }
49 ],
50 "arrayStringList": [
51 "value1",
52 "value2"
53 ],
54 "arraySelectSuggested": [
55 "tag1"
56 ],
57 "schemaBasedStringArray": [
58 "string1",
59 "string2"
60 ],
61 "schemaBasedIntegerArray": [
62 1,
63 2,
64 3
65 ],
66 "schemaBasedBooleanArray": [
67 true,
68 false,
69 true
70 ],
71 "schemaBasedObjectArray": [
72 {
73 "firstName": "John",
74 "lastName": "Doe",
75 "age": 30
76 }
77 ],
78 "schemaBasedObjectArrayComplex": [
79 {
80 "name": "Item 1",
81 "itemDescription": "First item description",
82 "count": 10,
83 "ratio": 0.5,
84 "enabled": true,
85 "category": "typeA"
86 }
87 ],
88 "nullableString": "optional value",
89 "fieldWithErrorMessage": "ABC",
90 "requiredField": "required value"
91};
92
93
94const run = await client.actor("gokdeniz_kaymak/integrations-input-test-actor").call(input);
95
96
97console.log('Results from dataset');
98console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
99const { items } = await client.dataset(run.defaultDatasetId).listItems();
100items.forEach((item) => {
101 console.dir(item);
102});
103
104