=pod =head1 The Virtual Solar Observatory API =head2 Purpose This document will attempt to provide the necessary information for a programmer to write applications that interact with the Virtual Solar Observatory (VSO). We will explain the Application Program Interface (API), and attempt to provide insight into the design of the VSO in an attempt for programmers to understand the logic that resulted in the interface. Programmers should ensure that they are reading the most current version of this document. They will also need the corresponding WSDL document to describe the structure of the messages exchanged between clients and the VSO. =head2 Version This document describes VSO 0.8, and was last updated 2004/Nov/16. This document describes the inner communications with VSO, and it is possible that there may be alternative APIs available that provide translation sevices or otherwise are less strict in their requirements on interaction. =head2 VSO Overview The VSO is an interconnected system of software to permit consumers to easily find and request data products of interest. As of this writing, there are two main functions of the VSO -- finding data products (acting as an Access Aid), and negotiating for the delivery of data products (acting as an Ordering Aid). The architecture of the VSO attempts to place a minimal burden on Data Providers, by proving abstraction layers to tie into functionality they already have. This permits Data Providers to continue to use their existing delivery mechanisms and data catalogs, without the need for them to recatalog their data according to a new data model, or supporting a data transfer mechanism that might not be ideal for their organization. Although there many goals and objectives for this project, the API and general architecture of the VSO is primarily driven by the following requirements: =over 4 =item * The system should be able to adapt to changes in the data model. =item * The system should require a minimum of maintenance. =item * The system should not place an undue burden on Data Providers who wish to join the project. =item * The system should be extensible by data providers who wish to provide additional services beyond those supported by VSO. =item * The system should allow solar researchers to do their job more efficiently and effectively. =back =head2 Design of the VSO The VSO has been designed in such a way as to make it possible for there to be any number of User Interfaces which may serve the wide community, or be specifically tailored to serve a niche group. For sake of discussing the API, we will consider User Interfaces and other autonomous clients to be outside of the VSO. We will look at a common user driven search scenario, from the standpoint of the User Interface: Please note that the platform does not matter, as the User Interface may be web based, command line, a desktop application, or some other platform that has yet to be realized at this time. =over 4 =item 1 The User Interface (UI) presents search options to the User. =item 2 The User enters their search preferences into the User Interface. =item 3 The UI asks VSO for the records that match the search request. (Query) =item 4 The VSO returns to the UI a list of appropriate records. (Query Response) =item 5 The UI presents the list of records to the User. =item 6 The User informs the UI which Data Products they would like to retrieve from the list. =item 7 The UI asks VSO for the Data Products, along with specifying the acceptable transfer methods. (GetData) =item 8 The VSO responds to the UI appropriately based on the data transfer method (GetData Response) =item 9 The UI contacts the individual Data Providers to obtain the Data Products. =back Although this particular example does not show all of the complexities that may occur, such as error handling at the various levels, it provides a representative example to describe the intentional decoupling of the searching for data products of interest, and the out-of-band retrieval of those products. In some cases, it may make sense for each each data product to have a one-to-one relationship with URLs to retrieve that product. The GetData function exists to provide for Data Providers who may package their data in compressed archives to reduce network bandwidth, or for them to provide alternative handling of excessive requests. It has the additional benefit of permitting to Data Providers to reorganize their data archives without the need to contact the maintainers of various UIs with the new procedures for requesting data, and enables new data transfer methods to be added in the future. As explained in the above example, there is a need for two distinct functions to be available in the VSO API: =over 4 =item Query A method to discover Data Products of interest. =item GetData A method to determine how to obtain Data Products of interest. =back The intricacies of the two methods are described in more detail in later sections. =head2 Query The current Query API functionality is particularly simplistic, to reduce the amount of code required by each of the Data Providers. More complex query formats are currently in various stages of planning, and will be available sometime in the future, along with the current simple format. Please see the VSO WSDL for the basic structure of a B request, which is available from the VSO website: http://www.virtualsolar.org/ =head3 Input Queries are C SOAP with the following provisions: The first and only argument is a B object, which contains a B object, containing two elements: =over 4 =item Version The B element should be a =item QueryRequestBlock An array of Bs may be sent to VSO. Each query will be individually searched, and returned. Returned values will not be returned in a manner that can associate each record to the individual query that it matched. If the User Interface requires this level of granularity in the returned values, it should issue multiple calls to B, rather than a single invocation with an array of Bs. Each parameter may contain only one value, and a Data Provider will attempt to limit responses to those that match all parameters. Please note that if a Data Provider cannot provide matching on a particular parameter, as they do not have that particular level of granularity in their system, they will return all probable or possible matches, rather than being overly restrictive in their returned values. If a User Interface is attempting to query for multiple values for given parameters, it should break the query down into all possible permutations. If you wish to ask for something similar to the following: (A1 or A2) and (B1 or B2) You should instead organize the query like the following: (A1 and B1) or (A1 and B2) or (A2 and B1) or (A2 and B2) A translation service with the ability to handle requests in a more permissive manner will be coming in the near future. The following elements may occur within a B: =over 4 =item Time A B