Forum C# WebService Calls and Google API

WebService Calls and Google API

Postby fakersp » June 4th, 2011, 3:21 am

Hello guys,

I have a project where I planned to keep all my game's units' properties in a Google Spreadsheet, in such a way that my team could easily edit these properties without the need to change and recompile the server code (these properties/data must be kept in the server for security reasons).

Well, as i recently discovered, the Google's API is not whitelisted at the moment (something PlayerIO could consider putting in its whitelist, but that's not what this thread is about). So I wanted to know the best way to surpass this problem.

One of the ways I have considered was to create a web service, using the Google libraries, and get the data using the PlayerIO.Web.Get() call. I'm very new to the .NET platform and I'm not sure if this could really be done by a Web Service, since I have never used it before.

Anyway, I would like if you guys could give me a light (article/simple example/template) on how to create a web service to return data from a PlayerIO.Web.Get() call (or tell me that this will not work :roll: ), or if you know, a better solution to this problem.

Best regards,
Bruno.
fakersp
 
Posts: 11
Joined: March 10th, 2011, 10:00 pm

Re: WebService Calls and Google API

Postby cjcenizal » June 5th, 2011, 8:18 pm

Check out this post: post5537?hilit=spreadsheet#p5537

Initially I was doing something similar to you, where my Flash client was querying a PHP script, which would access the spreadsheet through the Google API and return the file's contents in CSV format. But querying the Google API is an unnecessary step, since it'd be a lot faster to just download a CSV file stored on a server somewhere, than to ask Google to recreate the CSV file every time. So now whenever I am done making changes to the spreadsheet, I run a PHP script to download and save the CSV file to my server. My game code then queries another PHP script to access that CSV file.
cjcenizal
Paid Member
 
Posts: 115
Joined: March 29th, 2011, 12:31 am

Re: WebService Calls and Google API

Postby fakersp » June 6th, 2011, 6:22 am

cjcenizal wrote:Check out this post: post5537?hilit=spreadsheet#p5537

Initially I was doing something similar to you, where my Flash client was querying a PHP script, which would access the spreadsheet through the Google API and return the file's contents in CSV format. But querying the Google API is an unnecessary step, since it'd be a lot faster to just download a CSV file stored on a server somewhere, than to ask Google to recreate the CSV file every time. So now whenever I am done making changes to the spreadsheet, I run a PHP script to download and save the CSV file to my server. My game code then queries another PHP script to access that CSV file.


Thanks for the reply cjcenizal! Although your method is possible, it still don't solve my main problem, witch is preventing my team mates from screwing with the project files, that's why i wanted to use Google Spreadsheets in the first place, instead of simply using excell or any other CSV editor. This data is pretty simple and will only be needed once (at the game initialization), so I'm prioritizing maintenance and extensibility in this issue.

Anyway, I solved my problem creating a blank .aspx page and using the Response.Write() method, instead of creating web services. Much simpler solution and it's working just fine :D
fakersp
 
Posts: 11
Joined: March 10th, 2011, 10:00 pm

Re: WebService Calls and Google API

Postby cjcenizal » June 6th, 2011, 6:35 am

Great! Sounds good man!
cjcenizal
Paid Member
 
Posts: 115
Joined: March 29th, 2011, 12:31 am

Re: WebService Calls and Google API

Postby Henrik » June 6th, 2011, 10:52 am

fakersp wrote:Anyway, I solved my problem creating a blank .aspx page and using the Response.Write() method, instead of creating web services. Much simpler solution and it's working just fine :D


Great! I was gonna reply to this last week saying something that web requests are very simple. You send some stuff, and you get a bytestream back. That bytestream can contain pretty much anything, it can be just the bytes you want, it can be a csv-file, it can be a webpage, or it can be a SOAP-wrapped XML blob of horror. And there's no reason for the blob of horror, the easiest solution is always to just return the stuff you need, no more. :-)
Henrik
.IO
 
Posts: 1880
Joined: January 4th, 2010, 1:53 pm


Return to C#