Skip to content

Commit c0068c3

Browse files
committed
Add example of a POST request
1 parent c57ff3c commit c0068c3

File tree

1 file changed

+125
-2
lines changed

1 file changed

+125
-2
lines changed

examples/parse-json-from-api/parse-json-from-api.json

Lines changed: 125 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"sizeOnStartupMode": "",
2020
"templateSlug": "",
2121
"version": "1.0.0",
22-
"name": "Parse JSON from API",
22+
"name": "Network Requests to an API and using JSON",
2323
"description": "",
2424
"author": "gametemplates.itch.io",
2525
"windowWidth": 800,
@@ -28,7 +28,35 @@
2828
"maxFPS": 60,
2929
"minFPS": 10,
3030
"verticalSync": false,
31-
"platformSpecificAssets": {},
31+
"platformSpecificAssets": {
32+
"android-icon-144": "",
33+
"android-icon-192": "",
34+
"android-icon-36": "",
35+
"android-icon-48": "",
36+
"android-icon-72": "",
37+
"android-icon-96": "",
38+
"android-windowSplashScreenAnimatedIcon": "",
39+
"desktop-icon-512": "",
40+
"ios-icon-100": "",
41+
"ios-icon-1024": "",
42+
"ios-icon-114": "",
43+
"ios-icon-120": "",
44+
"ios-icon-144": "",
45+
"ios-icon-152": "",
46+
"ios-icon-167": "",
47+
"ios-icon-180": "",
48+
"ios-icon-20": "",
49+
"ios-icon-29": "",
50+
"ios-icon-40": "",
51+
"ios-icon-50": "",
52+
"ios-icon-57": "",
53+
"ios-icon-58": "",
54+
"ios-icon-60": "",
55+
"ios-icon-72": "",
56+
"ios-icon-76": "",
57+
"ios-icon-80": "",
58+
"ios-icon-87": ""
59+
},
3260
"loadingScreen": {
3361
"backgroundColor": 0,
3462
"backgroundFadeInDuration": 0.2,
@@ -298,6 +326,22 @@
298326
"numberProperties": [],
299327
"stringProperties": [],
300328
"initialVariables": []
329+
},
330+
{
331+
"angle": 0,
332+
"customSize": false,
333+
"height": 0,
334+
"keepRatio": true,
335+
"layer": "",
336+
"name": "NewText",
337+
"persistentUuid": "a45272ab-d358-44b5-a33e-bedcfc207a9d",
338+
"width": 0,
339+
"x": 16,
340+
"y": 11,
341+
"zOrder": 9,
342+
"numberProperties": [],
343+
"stringProperties": [],
344+
"initialVariables": []
301345
}
302346
],
303347
"objects": [
@@ -521,6 +565,49 @@
521565
"PressedLabelOffsetY": 2,
522566
"LabelText": "Request with custom action"
523567
}
568+
},
569+
{
570+
"assetStoreId": "",
571+
"bold": false,
572+
"italic": false,
573+
"name": "NewText",
574+
"smoothed": true,
575+
"type": "TextObject::Text",
576+
"underlined": false,
577+
"variables": [],
578+
"effects": [],
579+
"behaviors": [],
580+
"string": "This is an example of doing network requests in a GDevelop game.",
581+
"font": "",
582+
"textAlignment": "left",
583+
"characterSize": 20,
584+
"color": {
585+
"b": 255,
586+
"g": 255,
587+
"r": 255
588+
},
589+
"content": {
590+
"bold": false,
591+
"isOutlineEnabled": false,
592+
"isShadowEnabled": false,
593+
"italic": false,
594+
"outlineColor": "255;255;255",
595+
"outlineThickness": 2,
596+
"shadowAngle": 90,
597+
"shadowBlurRadius": 2,
598+
"shadowColor": "0;0;0",
599+
"shadowDistance": 4,
600+
"shadowOpacity": 127,
601+
"smoothed": true,
602+
"underlined": false,
603+
"text": "This is an example of doing network requests in a GDevelop game.",
604+
"font": "",
605+
"textAlignment": "left",
606+
"verticalTextAlignment": "top",
607+
"characterSize": 20,
608+
"lineHeight": 0,
609+
"color": "255;255;255"
610+
}
524611
}
525612
],
526613
"objectsFolderStructure": {
@@ -546,6 +633,9 @@
546633
},
547634
{
548635
"objectName": "LoadingText"
636+
},
637+
{
638+
"objectName": "NewText"
549639
}
550640
]
551641
},
@@ -649,6 +739,39 @@
649739
}
650740
]
651741
},
742+
{
743+
"type": "BuiltinCommonInstructions::Comment",
744+
"color": {
745+
"b": 109,
746+
"g": 230,
747+
"r": 255,
748+
"textB": 0,
749+
"textG": 0,
750+
"textR": 0
751+
},
752+
"comment": "Side note: this disabled action shows an example of sending another type of request (\"POST\") using the content of a variable that is converted to JSON"
753+
},
754+
{
755+
"disabled": true,
756+
"type": "BuiltinCommonInstructions::Standard",
757+
"conditions": [],
758+
"actions": [
759+
{
760+
"type": {
761+
"await": true,
762+
"value": "SendAsyncRequest"
763+
},
764+
"parameters": [
765+
"\"https://api.restful-api.dev/objects\"",
766+
"ToJSON(Person)",
767+
"\"POST\"",
768+
"\"application/json\"",
769+
"ResultVariable",
770+
"ErrorVariable"
771+
]
772+
}
773+
]
774+
},
652775
{
653776
"type": "BuiltinCommonInstructions::Comment",
654777
"color": {

0 commit comments

Comments
 (0)