Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Help getting HttpRequest working with Parse.com

Author
Message
JohnnyMeek
11
Years of Service
User Offline
Joined: 23rd Apr 2013
Location: Slovenia
Posted: 25th Sep 2015 09:19 Edited at: 25th Sep 2015 09:22
I've been struggling for a couple of days now to implement a solution for Parse using the REST API.

Cold someone suggest how I code the following in AppGameKit?

curl -X POST \
-H "Content-Type: application/json" \
-H "X-Parse-Application-Id: xxxxxxxxxxxx" \
-H "X-Parse-REST-API-Key: xxxxxxxxxxx" \
-d "{\"name\":\"Tester\"}" \
https://api.parse.com/1/classes/GameLevel

Thanks.
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 25th Sep 2015 09:59 Edited at: 25th Sep 2015 10:04
if this is a http header it should end with 2x cr lf.
the rows are split by line break. GetStringToken
if u need a value from i would make a function
GetValue(line$,"Content-Type:")
after the header there should come the data part.
data looks like JSON.
normal the http header told you the data length.
often you need to collect the tcp packages until u have the full
data.
then u give this JSON a parser.
on this site are some examples with source.
http://json.org/

the example you showed looks like you want generate and send to server. so it just add strings together.

AGK (Steam) V2 Beta .. : Windows 10 Pro 64 Bit : AMD (15.7.1) Radeon R7 265 : Mac mini OS X 10.10 (Yosemite)
JohnnyMeek
11
Years of Service
User Offline
Joined: 23rd Apr 2013
Location: Slovenia
Posted: 25th Sep 2015 11:10
I have the json part already from the interation I did with Piwik analytics.

The thing I'm struggling with here is the correct way to encode the Http headers and pass them.
JohnnyMeek
11
Years of Service
User Offline
Joined: 23rd Apr 2013
Location: Slovenia
Posted: 25th Sep 2015 16:37
OK, I got this working by using a different method that doesn't involve sending headers to authenticate, but uses the username and password option in SetHTTPHost.
JLM
9
Years of Service
User Offline
Joined: 21st Jul 2015
Location:
Posted: 30th Sep 2015 02:10
You actually managed to get JSON parsing to work in AppGameKit? I tried and tried, eventually gave up and wrote it in PHP and had my app query said PHP files...

Mind posting some code that got it working for you?

J
-Writing programs for years, new to AGK2

Login to post a reply

Server time is: 2024-11-25 17:38:38
Your offset time is: 2024-11-25 17:38:38