One of my past posts about
home accounting has generated a lot of discussion on the topic - is it possible to keep records of finances on the Internet, or is it better to use offline applications
like Excel ?
Opinions are divided, but the fact remains - many people choose online. And we thought, is it really irreconcilable online with offline?
And now, any application for financial accounting, under any OS, can exchange data with online, using the open API from drebedengi.ru. Do you think people need it?
Statistics
It turns out you need. According to our statistics (~ 43,000 users), applications with synchronization are now the most relevant for:
- Andriod, IPhone, Windows Mobile, Symbian
- Unix / Linux
- Flash applications for vkontakte.ru, etc.
- Plugins for browsers FireFox, Chrome, Opera, IE
- Crossbrowser widgets on js, for quick input of expenses
Public
voting on reformal proof of this.
')
Cooperation
So, anyone can write their application for drebedengi.ru. At the same time,
non-buggy good applications can be posted on the official website and offered directly to our users. For this purpose, a special cooperation agreement is concluded, which is discussed individually. After that, the developer becomes a member of our
affiliate program , and immediately begins to receive revenue from sales. In other words, a successful application instantly falls into the hands of thousands of audiences.
How it all works
Everything works under the SOAP protocol. You need to start by querying directories - lists of cost categories, sources of income, places for storing money, currency led by a user, and tags. To do this, there are the following methods:
anyType getCategoryList(string $apiId, string $login, string $pass, anyType $idList)
anyType getSourceList(string $apiId, string $login, string $pass, anyType $idList)
anyType getPlaceList(string $apiId, string $login, string $pass, anyType $idList)
anyType getCurrencyList(string $apiId, string $login, string $pass, anyType $idList)
anyType getTagList(string $apiId, string $login, string $pass, anyType $idList)
It makes no sense to describe the input parameters for each method, they are described in the WSDL. And yes, while we decided in each method to transfer the login and password. There was a lot of thought on this topic, but so far they have decided how they have decided. Architecture gurus - suggest a better scheme?
Next, we get a list of all transactions made by the user: expenses, incomes, movements between accounts (storage locations) and currency exchanges. For this there is the most important method:
anyType getRecordList(string $apiId, string $login, string $pass, anyType $params, anyType $idList)
The
params
array contains a huge set of parameters according to which you can request different combinations of data. In the first step, you just need to download all transactions and save them on the client.
Synchronization algorithm
After the initial data has been downloaded and the user sees the remaining money on the client, which coincides with the online, the client application starts working in synchronization mode. The principle of operation is the same as that of version control systems like SVN, only simpler, because always need to be updated to the latest revision.
For this, the server stores the history of changes of objects over the past three months (more and not necessary and costly). Each revision has its own unique revision number and contains information about what has changed (transaction, cost category, storage location, etc.), how it changed (added, changed, deleted) and when it changed.
The client stores the server revision number, to which it was last synchronized successfully and sends it every time it decides to synchronize again. The server responds with a list of changes in chronological order, on the basis of which the client downloads changes from the server. See methods:
anyType getChangeList(string $apiId, string $login, string $pass, string $revision)
integer getCurrentRevision(string $apiId, string $login, string $pass)
After that, the client uploads its changes to the server and at the very end requests and saves the revision number that was formed on the server after its “commit”. If the client finds an unsolvable conflict, he prompts the user to download everything from the server anew, or vice versa to download everything to the server. In the latter case, you need to remember to clean everything on the server first; there is also a method for this.
Conclusion
So, if you're interested,
here you will find a link to
wsdl , a full-fledged test
client example in PHP , a low-level
XML SOAP request , using the getRecordList method as an example, and one more thing.
Yes ... for those who are afraid of intercepting data over the network - we suggest finding the soap library with SSL support, and using a
separate wsdl for this.