1from apify_client import ApifyClient
2
3
4
5client = ApifyClient("<YOUR_API_TOKEN>")
6
7
8run_input = { "blueprintJson": {
9 "name": "Sample - order intake to CRM",
10 "flow": [
11 {
12 "id": 1,
13 "module": "google-sheets:watchRows",
14 "version": 2,
15 "parameters": {
16 "__IMTCONN__": 1000001,
17 "limit": 100,
18 },
19 "mapper": {
20 "mode": "select",
21 "spreadsheetId": "SAMPLE_SHEET_ID",
22 "sheetId": "Orders",
23 },
24 "metadata": {
25 "designer": {
26 "x": 0,
27 "y": 0,
28 },
29 "parameters": [{
30 "name": "__IMTCONN__",
31 "type": "account:google",
32 "label": "Connection",
33 }],
34 },
35 },
36 {
37 "id": 2,
38 "module": "builtin:BasicRouter",
39 "version": 1,
40 "metadata": { "designer": {
41 "x": 300,
42 "y": 0,
43 } },
44 "routes": [
45 { "flow": [{
46 "id": 3,
47 "module": "http:ActionSendData",
48 "version": 3,
49 "parameters": { "handleErrors": False },
50 "mapper": {
51 "url": "https://api.example.com/v1/orders",
52 "method": "post",
53 "headers": [{
54 "name": "Authorization",
55 "value": "Bearer sk-proj-SAMPLEONLYnotarealkey0123456789abcdefgh",
56 }],
57 "qs": [],
58 "rejectUnauthorized": True,
59 },
60 "metadata": { "designer": {
61 "x": 600,
62 "y": -150,
63 } },
64 "onerror": [{
65 "id": 6,
66 "module": "builtin:Break",
67 "version": 1,
68 "metadata": { "designer": {} },
69 }],
70 }] },
71 { "flow": [
72 {
73 "id": 4,
74 "module": "builtin:BasicFeeder",
75 "version": 1,
76 "mapper": { "array": "{{1.line_items}}" },
77 "metadata": { "designer": {
78 "x": 600,
79 "y": 150,
80 } },
81 },
82 {
83 "id": 5,
84 "module": "airtable:ActionCreateRecord",
85 "version": 3,
86 "parameters": { "__IMTCONN__": 1000002 },
87 "mapper": {
88 "baseId": "SAMPLE_BASE",
89 "table": "Line items",
90 "record": { "Name": "{{4.sku}}" },
91 },
92 "metadata": { "designer": {
93 "x": 900,
94 "y": 150,
95 } },
96 },
97 ] },
98 ],
99 },
100 ],
101 "metadata": {
102 "version": 1,
103 "scenario": {
104 "roundtrips": 1,
105 "maxErrors": 3,
106 "autoCommit": True,
107 "autoCommitTriggerLast": True,
108 "sequential": False,
109 "slots": None,
110 "confidential": False,
111 "dataloss": False,
112 "dlq": False,
113 "freshVariables": False,
114 },
115 "designer": { "orphans": [] },
116 },
117 } }
118
119
120run = client.actor("mediocre_interest/make-scenario-backup").call(run_input=run_input)
121
122
123print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
124for item in client.dataset(run.default_dataset_id).iterate_items():
125 print(item)
126
127