Sending Data Requests
When sending a data request, although you will
be sending it as a text via HTTP, the request will be interpreted by
us as XML. You are not sending a ".XML" file.
To be interpreted properly, the request must be
well-formed and use the following format:
-
The first tag
must be the XML declaration: <?XML version = "1.0"?>
- This is just industry standard specifying the document as using
XML version 1.0 standards.
-
The second tag must be
"<primaterequest>". This is the opening root
tag. XML documents can only have one root element and all
other elements must be nested inside of it.
-
After the
opening root tag, all other tags specific to the service
requested can be nested within the root. The last tag in the XML request
will be the closing </primaterequest> tag
Click here
to see an example of the standard XML request format.
XML vs. TAB
When you are choosing to
send a request in Tab format, you are still sending XML. The
only difference between the XML format and the Tab format is within the
<request_parameters> tag, where the actual data information requested is
located. The rest of the request is the same in either format.
-
In XML format, each data request parameter is
contained in it's own tag set.
-
In Tab format, you must use the
<CDATA> tag to tell the XML parser where to stop
looking for XML tags and treat it as text.
-
Again, don't worry about the parser stuff. All you
need to know is that the request should look like the
examples provided.
-
When requesting services in the XML format, the
request data will be contained between the element tags.
-
Element tags are the actual data
elements that are requested (such as 'symbol' and are
nested
within the <request_parameters> tag.
-
For example, the <request_parameters>
section of the Get Quotes service in XML format would
look like:
<?xml version="1.0"?>
<primaterequest>
<user_firstname>YourUserFirstNameHere</user_firstname>
<user_lastname>YourUserLastNameHere</user_lastname>
<password>YourPasswordHere</password>
<operating_system>YourOpSysHere</operating_system>
<software_used>YourSoftwareHere</software_used>
<software_version>YourVersionHere</software_version>
<response_compression>YourValidChoiceHere</response_compression>
<response_format>YourValidChoiceHere</response_format>
<field_list>YourValidFieldListHere</field_list>
<request_name>YourValidChoiceHere</request_name>
<requestparam_format>YourValidChoiceHere</requestparam_format>
<request_parameters>
<exchange>0e</exchange>
<symbol>IBM</symbol>
<startdate>2001-06-05</startdate>
<enddate>2001-06-06</enddate>
<clientmarker>2</clientmarker>
</request_parameters>
The "<request_parameters>" tag is standard for
all data requests, while the individual elements (parameters) nested within it will vary depending on
the actual data request. This is exactly how a well-formed GetQuotes
request would look
Remember, the Tab format
is still an XML string (plain XML text, not an .XML file).
It is just within the <request_parameters> tag that is
being sent in Tab format.
-
When using the Tab format, you must also
use the <request_parameters> tag.
-
The next tag must be <![CDATA[
followed by the data, delimited by Tabs.
-
At the end of the data, you must close
the <CDATA> tag with the ending brackets
]]>.
-
For
example, the <request_parameters> portion of the GetQuotes service in Tab format would look like this:
<?xml version="1.0"?>
<primaterequest>
<user_firstname>YourUserFirstNameHere</user_firstname>
<user_lastname>YourUserLastNameHere</user_lastname>
<password>YourPasswordHere</password>
<operating_system>YourOpSysHere</operating_system>
<software_used>YourSoftwareHere</software_used>
<software_version>YourVersionHere</software_version>
<response_compression>YourValidChoiceHere</response_compression>
<response_format>YourValidChoiceHere</response_format>
<field_list>YourValidFieldListHere</field_list>
<request_name>YourValidChoiceHere</request_name>
<requestparam_format>YourValidChoiceHere</requestparam_format>
<request_parameters>
<![CDATA[
0D IBM
2001-06-04 2001-06-08 1
0D T 2001-06-04 2001-06-08 2
0D XON 2001-06-04 2001-06-08 3
]]>
</request_parameters>
This is exactly how the
GetQuotes request would look in Tab format. You can see
that the first half is the same as the XML request format.
Both requests must send the identifying information in proper
XML format. Again, the only difference is within the
<requestparameters> tag.
Either format is
acceptable. It is our experience, however, that the
all-XML format is easier to work with for both sides
Examples
When you click on the Request link from the main menu, you will
see an example of the request in XML format. From there, you can link to a
Tab format example and a detailed description of the request format.
These examples are interactive. You can click the submit
button and receive a test response. They are designed to further help you
in designing your application.
|