AstroApp APIs: Getting started
Hello, World
The easiest way to get started is to see a simple example. The following
html page will display a chart cast for January 1st, 2012 at 1:00 am in
San Francisco, CA.
<html>
<head>
<script type="text/javascript"
src="https://astroapp.com/astro/astroapi?key=YOUR_ASTROAPP_API_KEY"></script>
<script>
var astroapp = new AstroApp();
astroapp.setLongitude("122W25");
astroapp.setLatitude("37N46");
astroapp.setDate("2012:01:01");
astroapp.setTime("01:00:00");
astroapp.setTimeZone("-08:00");
astroapp.needImage();
</script>
</head>
<body onLoad="javascript:astroRun(astroapp);">
<h2>Chart Example: January 1st, 2012; 1:00 am, San Francisco,
CA</h2>
<div id="astroappDiv"></div>
</body>
</html>
How it works
- First you should include the following line with your AstroApp API
Access Key in the header of your html page:
- <script type="text/javascript"
src="https://astroapp.com/astro/astroapi?key=YOUR_ASTROAPP_API_KEY"></script>
- Then, you should add the <div> tag with id="astroappDiv"
(<div id="astroappDiv"></div>) to
your html <body>. This element will hold the generated chart.
You can place it anywhere on your page.
- You should use the AstroApp() class to set chart
parameters.
- And the last step would be calling the astroRun(astroapp); function
to get the chart rendered. In this particular example, this function
will get called when your page first loads.
Almost every component can be scripted, please contact us if you want
specific features added to our APIs.
Editions:
- The AstroApp APIs are available for non-commercial use in AstroApp Pro and AstroApp Financial Gold Editions.
- Standalone commercial use (without AstroApp subscriptions) is also
available. Please contact our Support Team for details and pricing.