1from apify_client import ApifyClient
2
3
4
5client = ApifyClient("<YOUR_API_TOKEN>")
6
7
8run_input = {
9 "baseline_json": """{
10 \"openapi\": \"3.1.0\",
11 \"info\": {\"title\": \"Orders API\", \"version\": \"1.0.0\"},
12 \"paths\": {
13 \"/orders/{id}\": {
14 \"get\": {
15 \"parameters\": [{\"name\": \"id\", \"in\": \"path\", \"required\": true, \"schema\": {\"type\": \"string\"}}],
16 \"responses\": {\"200\": {\"content\": {\"application/json\": {\"schema\": {\"type\": \"object\", \"properties\": {\"id\": {\"type\": \"string\"}, \"total\": {\"type\": \"number\"}}}}}}}
17 }
18 }
19 }
20}
21""",
22 "candidate_json": """{
23 \"openapi\": \"3.1.0\",
24 \"info\": {\"title\": \"Orders API\", \"version\": \"1.1.0\"},
25 \"paths\": {
26 \"/orders/{id}\": {
27 \"get\": {
28 \"parameters\": [
29 {\"name\": \"id\", \"in\": \"path\", \"required\": true, \"schema\": {\"type\": \"string\"}},
30 {\"name\": \"tenant\", \"in\": \"header\", \"required\": true, \"schema\": {\"type\": \"string\"}}
31 ],
32 \"responses\": {\"200\": {\"content\": {\"application/json\": {\"schema\": {\"type\": \"object\", \"properties\": {\"id\": {\"type\": \"string\"}}}}}}}
33 }
34 }
35 }
36}
37""",
38 "consumers_json": """{
39 \"schema_version\": \"openapi-consumer-registry@1\",
40 \"consumers\": [
41 {\"consumer_id\": \"checkout\", \"criticality\": \"critical\", \"operations\": [\"GET /orders/{id}\"]},
42 {\"consumer_id\": \"reporting\", \"criticality\": \"medium\", \"operations\": [\"GET /orders/{id}\"]}
43 ]
44}
45""",
46}
47
48
49run = client.actor("biztoolsus/openapi-consumer-impact").call(run_input=run_input)
50
51
52print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
53for item in client.dataset(run.default_dataset_id).iterate_items():
54 print(item)
55
56