Showing Posts For Heimdall.4510:

The response serializations are insane

in API Development

Posted by: Heimdall.4510

Heimdall.4510

Morhyn.8032

Yes, in JavaScript this isn’t so much of a problem. You can mostly just shrug it off and move on. But when you start importing this data into a language with proper types (e.g. Java in my case or C# in a previous poster’s), it adds unnecessary complications. The API could be simpler and better if it just didn’t include the method name as a key.

I really don’t get your problem with that, just parse the JSON-Object and put the result into the format you need.
I personally would also prefer raw binary data which could be simply put into a c struct but that’s not possible in all languages. I guess that’s why the GW2-Team decided to put the queryresults into a format which can be handled by all languages

~ Heimdall
Die Vollenstrecker [VS] – Elona Reach [DE]
https://gw2apicpp.codeplex.com – Gw2API C/C++ Project

Starting an API

in API Development

Posted by: Heimdall.4510

Heimdall.4510

sorenrye.7238

I don’t think MSVC supports C++11 fully yet

In fact MSVC was the first compiler featuring full C++11 Support it has even some of the fixes coming with C++14.
With my example code you’re absolutely right this snipped is not meant to be used like I presented it. I took it out of an application I build for personal purpose. This section and some more are handled by an observer which handles all trouble occurances. Just the bitwise read operation is really intended because the benefit of gained performance if you use larger buffers is negligible here (especially in cobination with some inline asm I dropped off here).

~ Heimdall
Die Vollenstrecker [VS] – Elona Reach [DE]
https://gw2apicpp.codeplex.com – Gw2API C/C++ Project

Starting an API

in API Development

Posted by: Heimdall.4510

Heimdall.4510

This is just a little example using the wininet-lib to save some binary data into a file.
There’s no need to save the data within a file if you save it in a buffer in your memory from there you can access it directly.


open = InternetOpen(TEXT(APP_AGENT), INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 1);
request = InternetOpenUrl(open, convertToWideChar(loadURLFromDB()), NULL, NULL, 
INTERNET_FLAG_SECURE, 1);
ofstream out("image.png", ios::out|ios::binary);
char buffer;
DWORD size;
while(InternetReadFile(request, &buffer, 1, &size)){
                                 if(size != 1)
                                 break;
                                 out.write((char*)&buffer, sizeof(char));
}
out.close();
InternetCloseHandle(request);
InternetCloseHandle(open);
~ Heimdall
Die Vollenstrecker [VS] – Elona Reach [DE]
https://gw2apicpp.codeplex.com – Gw2API C/C++ Project

Starting an API

in API Development

Posted by: Heimdall.4510

Heimdall.4510

If you access the link via the wininet Library for example you get the img data as response. This means you could either save the Data in a file or use it directly from your memory to display it.

~ Heimdall
Die Vollenstrecker [VS] – Elona Reach [DE]
https://gw2apicpp.codeplex.com – Gw2API C/C++ Project

Starting an API

in API Development

Posted by: Heimdall.4510

Heimdall.4510

You could use the one I created for my API project there’s one written in C++ and one in pure C. If you care about Efficiency you might be more interested in the C Version but it’s also the more trickier one.

~ Heimdall
Die Vollenstrecker [VS] – Elona Reach [DE]
https://gw2apicpp.codeplex.com – Gw2API C/C++ Project

Starting an API

in API Development

Posted by: Heimdall.4510

Heimdall.4510

If you’re coding on a windows machine there is either the winhttp Lib (more useful for server implementations) or the wininet Lib which i would recommend you.
Another Option would simply be to connect a Socket with the server (Port 443) and Set up the http headers by yourself. If you do so make sure you didn’t forget the ssl handshake

~ Heimdall
Die Vollenstrecker [VS] – Elona Reach [DE]
https://gw2apicpp.codeplex.com – Gw2API C/C++ Project

Starting an API

in API Development

Posted by: Heimdall.4510

Heimdall.4510

If you want to see some example code in C/C++ for the Gw2-API have a look at my codeplex repo: https://gw2apicpp.codeplex.com
The API-part is currently not rly managed since I don’t have much time atm.
I would suggest you to start with the official APIs first before implementing the tp-API because for that you need session keys from a login

~ Heimdall
Die Vollenstrecker [VS] – Elona Reach [DE]
https://gw2apicpp.codeplex.com – Gw2API C/C++ Project

[API Suggestion] Guilds

in API Development

Posted by: Heimdall.4510

Heimdall.4510

rodadams.5963

I’d actually prefer a slightly different approach.

Be able to generate any number of keys, each with a different set of permissions, perhaps, and then be able to deactivate them individually.

That way, you could experiment with site XYZ, decide you don’t trust them, and cut them off without interfering with your guild site (or whatever).

all in all this is a rly good idea but why do you want to generate multiple keys? In my oppinion it’s much easier to provide a public and a private Version of the API. Within the public Version i would let the user choose which data he wants to share. The private Version could then contain the administrative stuff.

~ Heimdall
Die Vollenstrecker [VS] – Elona Reach [DE]
https://gw2apicpp.codeplex.com – Gw2API C/C++ Project

Authenticator Questions/Concerns [merged]

in Account & Technical Support

Posted by: Heimdall.4510

Heimdall.4510

Hey,
the last days I got some heavy troubles with google’s authenticator and the forum login. Every time I try to login, using the authenticator I get the error wrong password/username. Atm I can only get access by login via the game client first and saving the network i’m currently in.

~ Heimdall
Die Vollenstrecker [VS] – Elona Reach [DE]
https://gw2apicpp.codeplex.com – Gw2API C/C++ Project

Gw2 Location Tracker

in API Development

Posted by: Heimdall.4510

Heimdall.4510

I’ve just fixed the bug which caused the crash when the api is off.
You can either download the new version from the GW2API C/C++ Project site or simply run the updater to get the latest version.

~ Heimdall
Die Vollenstrecker [VS] – Elona Reach [DE]
https://gw2apicpp.codeplex.com – Gw2API C/C++ Project

Gw2 Location Tracker

in API Development

Posted by: Heimdall.4510

Heimdall.4510

this may happen if the guild-api doesnt’t respond the way it should. I’ll handle this issue asap and let you know when it’s fixed.

~ Heimdall
Die Vollenstrecker [VS] – Elona Reach [DE]
https://gw2apicpp.codeplex.com – Gw2API C/C++ Project

(edited by Heimdall.4510)

Using api on an excel spreadsheet?

in API Development

Posted by: Heimdall.4510

Heimdall.4510

I think MS Query is the thing you’re looking for:
http://office.microsoft.com/en-us/excel-help/use-microsoft-query-to-retrieve-external-data-HA010099664.aspx

Hope this helps you solving your problem

~ Heimdall
Die Vollenstrecker [VS] – Elona Reach [DE]
https://gw2apicpp.codeplex.com – Gw2API C/C++ Project

Gw2 Location Tracker

in API Development

Posted by: Heimdall.4510

Heimdall.4510

We’re still using IRC I just had 2 hard days and didn’t manage to join

~ Heimdall
Die Vollenstrecker [VS] – Elona Reach [DE]
https://gw2apicpp.codeplex.com – Gw2API C/C++ Project

Gw2 Location Tracker

in API Development

Posted by: Heimdall.4510

Heimdall.4510

We’re again up on IRC at
irc.eu.gamesurge.net
#Gw2Maps
Since the channel now is permanently it’s not only meant for our app but for API discussion in general.
We would be pleased if anyone wants to join for a talk

~ Heimdall
Die Vollenstrecker [VS] – Elona Reach [DE]
https://gw2apicpp.codeplex.com – Gw2API C/C++ Project

Gw2 Location Tracker

in API Development

Posted by: Heimdall.4510

Heimdall.4510

I’ve just created an IRC channel (#Gw2Maps) on irc.eu.gamesurge.net
I should be there more or less the whole day so if you have any questions feel free to post them here or ask me in the chat for live-support.

~ Heimdall
Die Vollenstrecker [VS] – Elona Reach [DE]
https://gw2apicpp.codeplex.com – Gw2API C/C++ Project

Gw2 Location Tracker

in API Development

Posted by: Heimdall.4510

Heimdall.4510

nope it’s just these dlls
the error you get could possibly result by starting the application as 64bit (it’s 32 bit/x86 only atm, we’re testing x64). If you compiled the source code make sure to set the compiler to x86 and add the x86(not the x64) dlls to your dir.

~ Heimdall
Die Vollenstrecker [VS] – Elona Reach [DE]
https://gw2apicpp.codeplex.com – Gw2API C/C++ Project

Gw2 Location Tracker

in API Development

Posted by: Heimdall.4510

Heimdall.4510

Yep I’ve forgotten to update the library with the guild part – sry my fault. It should now include all necessary data.

~ Heimdall
Die Vollenstrecker [VS] – Elona Reach [DE]
https://gw2apicpp.codeplex.com – Gw2API C/C++ Project

Gw2 Location Tracker

in API Development

Posted by: Heimdall.4510

Heimdall.4510

As I mentioned in my previous post guildPtr is defined in my GW2API C/C++ Project as
typedef struct guild *guildPtr;
So if you want to compile the Project by yourself make sure you link against the GW2API-Lib, too.

~ Heimdall
Die Vollenstrecker [VS] – Elona Reach [DE]
https://gw2apicpp.codeplex.com – Gw2API C/C++ Project

Gw2 Location Tracker

in API Development

Posted by: Heimdall.4510

Heimdall.4510

guildPtr is defined in the GW2API C/C++ Project in the api_cstructs.h file (C Part of my Library)

~ Heimdall
Die Vollenstrecker [VS] – Elona Reach [DE]
https://gw2apicpp.codeplex.com – Gw2API C/C++ Project

Gw2 Location Tracker

in API Development

Posted by: Heimdall.4510

Heimdall.4510

I’ve just updated the location-sender (Gw2Maps) for cli-mode and uploaded it into my repo. If you want to have a try use -h to display the info.

~ Heimdall
Die Vollenstrecker [VS] – Elona Reach [DE]
https://gw2apicpp.codeplex.com – Gw2API C/C++ Project

Gw2 Location Tracker

in API Development

Posted by: Heimdall.4510

Heimdall.4510

@AdelphiA
Well there was a console mode once…
I removed it because Smiley thought this could be a bit confusing to people who aren’t familiar with it (specify port, ip, http-header needed? etc.). But it isn’t hard to support the console again.

~ Heimdall
Die Vollenstrecker [VS] – Elona Reach [DE]
https://gw2apicpp.codeplex.com – Gw2API C/C++ Project

Gw2 Location Tracker

in API Development

Posted by: Heimdall.4510

Heimdall.4510

Well I haven’t updated the locator yet because I want to add some special feature to it. But rest assured that the next verison will get pretty cool

~ Heimdall
Die Vollenstrecker [VS] – Elona Reach [DE]
https://gw2apicpp.codeplex.com – Gw2API C/C++ Project

Mumble Link for Java using JNA?

in API Development

Posted by: Heimdall.4510

Heimdall.4510

Have you already tried to create the shared Memory section with just “MumbleLink” instead of “/MumbleLink”? – ah not fast enough…

~ Heimdall
Die Vollenstrecker [VS] – Elona Reach [DE]
https://gw2apicpp.codeplex.com – Gw2API C/C++ Project

How to deserialize "event_details" in C#?

in API Development

Posted by: Heimdall.4510

Heimdall.4510

Well the benefit of unions is that you can save memory space. And to make the whole thing more efficient you should organize the memory by yourself (…not really necessary in C# I know), and don’t forget the hash-function if you consider not to use containers like dictionaries or maps. But how I mentioned before this is the way you would do it in C/C++. In C# this should be a lot easier.

~ Heimdall
Die Vollenstrecker [VS] – Elona Reach [DE]
https://gw2apicpp.codeplex.com – Gw2API C/C++ Project

(edited by Heimdall.4510)

How to deserialize "event_details" in C#?

in API Development

Posted by: Heimdall.4510

Heimdall.4510

Well I mean something like this. If you want to see a working example in C or C++ visit my codeplex repo.

Attachments:

~ Heimdall
Die Vollenstrecker [VS] – Elona Reach [DE]
https://gw2apicpp.codeplex.com – Gw2API C/C++ Project

How to deserialize "event_details" in C#?

in API Development

Posted by: Heimdall.4510

Heimdall.4510

Well if you are talking of JSON deserialization in general you should keep the structure of the JSON you are trying to parse. So make sure you are familiar with the JSON specification. A simple way to parse JSON-Data is to use structs and unions by combining them cleverly within an array(this is like you would do it in C and it should work the same in C#). To improve the lookup speed for e.g the events_json (i suppose you don’t want to iterate through the array all the time) you should create a hash-function which organizes the events.
This is also possible with C++ Containers in combination with either classes or the above mentioned structs/unions.

~ Heimdall
Die Vollenstrecker [VS] – Elona Reach [DE]
https://gw2apicpp.codeplex.com – Gw2API C/C++ Project

Gw2 Location Tracker

in API Development

Posted by: Heimdall.4510

Heimdall.4510

Hey guys I’ve developed a little tool to collect some positional data from the game in cooperation with smiley.1438. Some parts of it are based on my Gw2ApiCpp-Project. To download the required files or to checkout the source click here. The collected data can be send to a server specified in the app (using the JSON-format). The first server which uses data collected by my program is smiley’s gw2location-service.
To send data to his server use this link: http://gw2.chillerlan.net/examples/gw2location-receiver.php
Please note that the program is in the beta state and some errors may occur.

Have Fun – Heimdall

~ Heimdall
Die Vollenstrecker [VS] – Elona Reach [DE]
https://gw2apicpp.codeplex.com – Gw2API C/C++ Project

(edited by Heimdall.4510)

Access to API with http instead of https?

in API Development

Posted by: Heimdall.4510

Heimdall.4510

Yeah I do know that but I also know that it is possible to mix c/c++ libraries with windows rt you just have to recompile it against c++11/cli and link it to your project

~ Heimdall
Die Vollenstrecker [VS] – Elona Reach [DE]
https://gw2apicpp.codeplex.com – Gw2API C/C++ Project

Access to API with http instead of https?

in API Development

Posted by: Heimdall.4510

Heimdall.4510

have you tried to handle the https via the wininet.h? I think this should solve your issues. In case you don’t want to implement any new functions you could use the dll I’ve already created to handle https for my haskell functions. You can get the dll from the GW2API C/C++ project. If this doesn’t help either i would suggest to write your own tls dll which handles the tls handshake and communication.

~ Heimdall
Die Vollenstrecker [VS] – Elona Reach [DE]
https://gw2apicpp.codeplex.com – Gw2API C/C++ Project

API implementation library "master list"

in API Development

Posted by: Heimdall.4510

Heimdall.4510

Hey there I’ve written a C/C++ library for the Guild Wars 2 API! Hope you enjoy it though it’s not totally complete yet.

GW2API C/C++ Library Project

~ Heimdall
Die Vollenstrecker [VS] – Elona Reach [DE]
https://gw2apicpp.codeplex.com – Gw2API C/C++ Project

(edited by Heimdall.4510)