Javascript client
Using the Opera XML Store from a widget
In order to lower the treshold for using the Opera XML Store, we have created a simple widget using an easy-to-use library that lightens the workload when performing common tasks like adding and deleting data. The library is included in the Hello Opera Xml Store! widget.
Next we will walk through some common tasks which you will encounter if you are to use the Opera XML Store.
Login
Before you can create any data, you will have to be authenticated. We start by logging in using My.Opera credentials. In the Hello Opera XML Store! widget, this will be the second tab from the left.
Once you are logged in you are ready to continue to the next step; storing new data.
Save data
Now that we know how we can log in, we are going to save some data. We are going to use a simple data model that is used for storing notes. The data model specification is available under Notes. To do this with the Hello Opera XML Store! widget, we flip to the third tab, 'Save data'.
Using the basic example data, taken form the example data page for the Notes data model, we have:
The data can then be saved to the Opera XML Store using the following code:
There are several thing that can go wrong but mostly the errors are related to sending invalid XML data or trying to write data to a collection which you have no write access to.
Read data
In this last example we will read back the data we stored in the previous example. This can be done flipping to the fourth tab, 'Read data'.
In the example above, most of it should be straight-forward, but pay attention to the 'q' parameter which allows you to query the data in the specified collection. This query language is plain XPath and allows you to specify exactly what data you want to be returned, reducing amount of data that needs to travel over the wire.
Summary
This was intended as a simple to use "Get-you-going" example, but there are many more features of the Opera XML Store. Use the Hello Opera Xml Store! widget as a starting point and you should on your way to writing new cool widgets using persistent data storage, allowing you to access the same data no matter where you are or what device you are on. There are several documents you can read if you would like to know more. For details about what other data operations are supported have a look at the Performing data operations. For more information about error codes, supported query parameters and specifications, see the Technical reference page.