Jump to content

Non-phpVMS integration with vaCentral


CXA001

Recommended Posts

Hi all,

We have been looking at vaCentral for quite sometime and finally opened an account and setup our VA.

On the home page of vaCentral it says "you can implement your code to talk to vaCentral through XML."

When registering, there was a link to a user guide, but it was a dead link and we have a couple of questions:

1. As we are not using phpVMS, but another automated system our pilots use for sending flight reports (currently FSAcars, but will be updating to our own inhouse system later this year), where do we need to place the XML code?

2. We do not have fixed routes. We have what is called a Free Flying Policy where pilots can fly any route that they like. How will this affect our ranking within vaCentral?

We did search all the pages on the web site to try and find some documentation regarding all this, but didn't seem to find much.

Any assistance would be appreciated.

Thanks in advance,

Link to comment
Share on other sites

  • Moderators

Hi all,

We have been looking at vaCentral for quite sometime and finally opened an account and setup our VA.

On the home page of vaCentral it says "you can implement your code to talk to vaCentral through XML."

When registering, there was a link to a user guide, but it was a dead link and we have a couple of questions:

1. As we are not using phpVMS, but another automated system our pilots use for sending flight reports (currently FSAcars, but will be updating to our own inhouse system later this year), where do we need to place the XML code?

2. We do not have fixed routes. We have what is called a Free Flying Policy where pilots can fly any route that they like. How will this affect our ranking within vaCentral?

We did search all the pages on the web site to try and find some documentation regarding all this, but didn't seem to find much.

Any assistance would be appreciated.

Thanks in advance,

-hello sir i think you will need this info

http://forum.phpvms.net/page/index.html?record=29

there you can download e nxml for your site to work with vacentral.

-this won't affect your rating to mush i belive for the moment the majority is calculated on flying hous/pireps.

hope this info is all you need

gr joeri

Link to comment
Share on other sites

Hi Joeri,

So if we understand this correctly. In our case, we would just need to trigger the update_vainfo to send our total pilot count, total hours, total fights, etc. to send that data to vaCentral up to 3 times a day? Are these totals for the day or total to date?

As we don't have any fixed routes, we do not need to use the update_schedules?

What is the Receive URL that I need to send this data to?

Sorry for all the questions, but as there doesn't seem to be any documentation available, we need to rely on your knowledge. :)

Link to comment
Share on other sites

  • Administrators

Hi Joeri,

So if we understand this correctly. In our case, we would just need to trigger the update_vainfo to send our total pilot count, total hours, total fights, etc. to send that data to vaCentral up to 3 times a day? Are these totals for the day or total to date?

As we don't have any fixed routes, we do not need to use the update_schedules?

What is the Receive URL that I need to send this data to?

Sorry for all the questions, but as there doesn't seem to be any documentation available, we need to rely on your knowledge. :)

If you look at the PHP file on that page, it's a little clearer. And it would be overall totals, to date. You have to fill int he parameters, it's in the documentation in the PHP file.

Also, where was the dead link?

Link to comment
Share on other sites

We need a little more information on how vaCentral receives this information.

The home page of va Central says "or if you're using a custom system, you can implement your code to talk to vaCentral through XML."

Does this mean the xml should be placed on our home page and vaCentral will query it once a week or do we need to send this information via an http query string or when visiting the api site and populate the web page with the XML file in order for vaCentral to read it?

Our web site is written in asp.net and not php therefore I need to understand the process, so that we can write the code accordingly.

Thanks in advance,

Link to comment
Share on other sites

  • Administrators

If you look at the PHP example file, you send the XML as POST data to:

http://api.vacentral.net/update

And you'd send XML:

<?xml version="1.0"?> <vacentral>  <siteurl> </siteurl>  <apikey> </apikey>  <version> </version>  <debug> </debug>  <method>update_vainfo</method>  <pilotcount> </pilotcount>  <totalhours>5.39</totalhours>  <totalflights>2</totalflights>  <totalschedules></totalschedules>  <expenses>0</expenses>  <expensescost></expensescost>  <livefuel>1</livefuel> </vacentral>

So that all filled in.

A huge chunk of the XML docs are missing.. let me find them

And the time you send them it up to you... a cron job or integrated into your existing system. For instance, I'd send VA info every 3/4 hours and schedule updates once a day (2am or something), and send pirep info updates every time a PIREP comes in

edit: that doc is updated

http://forum.phpvms.net/page/index.html/_/developers-guides/vacentral-documentation-r29

Link to comment
Share on other sites

Thanks for your help. By understanding the logic, I was able to successfully create the necessary code to send our basic stats to vaCentral.

For anyone else that is using ASP.NET here is the code that we used to successfully update our VA info. It is written in VB.net but you can easily convert it to C# with the following converter: http://www.developerfusion.com/tools/convert/vb-to-csharp/

How you want to trigger the event is up to you. We simply created a page with a Send Stats button that we will use to send the updated stats, a couple times a day.

At the top of your page, you will to define the following imports:

Imports System
Imports System.IO
Imports System.Net
Imports System.Text

In the sub that triggers the Send Stats event whether it be a button.click or whatever else:

' Stats that you need to retreive from your database and populate into these variables.
Dim stringTotalHours as integer 'Total VA hours.
Dim stringTotalFlights as integer 'Total VA flights.
Dim stringTotalPilots As integer 'Total VA pilots.

' Create a request using a URL that can receive a post. 
Dim SendVAStats As WebRequest = WebRequest.Create("http://api.vacentral.net/update")
SendVAStats.Proxy = WebRequest.GetSystemWebProxy()
SendVAStats.Proxy.Credentials = CredentialCache.DefaultCredentials

' Set the Method property of the request to POST.
SendVAStats.Method = "POST"

' Create POST data and convert it to a byte array.
Dim stringVAStats As String = "<?xml version=""1.0""?> <vacentral>  <siteurl>Your VA URL</siteurl>  <apikey>Your API Key</apikey>  <version> </version>  <debug> </debug>  <method>update_vainfo</method>  <pilotcount>" & stringTotalPilots & "</pilotcount>  <totalhours>" & stringTotalHours & "</totalhours>  <totalflights>" & stringTotalFlights & "</totalflights>  <totalschedules> </totalschedules>  <expenses>0</expenses> <expensescost> </expensescost>  <livefuel>0</livefuel> </vacentral>"
Dim byteArray As Byte() = Encoding.UTF8.GetBytes(stringVAStats)

' Set the ContentType property of the WebRequest.
SendVAStats.ContentType = "text/xml"

' Set the ContentLength property of the WebRequest.
SendVAStats.ContentLength = byteArray.Length

' Get the request stream.
Dim dataStream As Stream = SendVAStats.GetRequestStream()

' Write the data to the request stream.
dataStream.Write(byteArray, 0, byteArray.Length)

' Close the Stream object.
dataStream.Close()

' Get the response.
Dim response As WebResponse = SendVAStats.GetResponse()

' Display the status.
Console.WriteLine(CType(response, HttpWebResponse).StatusDescription)

' Get the stream containing content returned by the server.
dataStream = response.GetResponseStream()

' Open the stream using a StreamReader for easy access.
Dim reader As New StreamReader(dataStream)

' Read the content.
Dim responseFromServer As String = reader.ReadToEnd()

' Display status in a label that is on your aspx page.
LabelSendStatsStatus.Visible = True
LabelSendStatsStatus.Text = (responseFromServer)

' Clean up the streams.
reader.Close()
dataStream.Close()
response.Close()

Hopefully, this will be of assistance to someone out there. :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...