PVS API Pre-built Libraries
We have simple libraries for use with our API backend. For now, all we have is PHP but we will continue to build them in other languages as time goes on.
We have a class for each section of data and are named accordingly. Each class has methods to access smaller pieces of data or to access the data in different ways. You can see documentation on each method from the menu on the right.
PHP
The PHP libraries require PHP 5 with the SimpleXML extension and "allow_url_fopen" set to 'On' in php.ini.
Using the libraries is fairly simple. You initialize the object and then call one of the methods. The method will return a data object which is representative of the XML structure. Let's say you wanted to get information on a bill...
Now $xml_object is a data object representative of the XML structure. Here's a small cut from the XML itself.
Let's say you awnted to get the title of the bill. You could simply access it like this:
And anything with repeating rows like say, sponsors would just be treated as an array.
Python
The Python libraries requires amara.
Use of the Python libraries is much the same as PHP with only really syntatic differences. Import the relavant libraries, make the call, which also initiates the object, then deal with the data object as you need.
First, import the modules you'll need.
Now, run the call and do what you need to do with your data.
Simple as that. See amara's documentation for more detailed usage information.