SDK contains 4 method groups:
- FAPI.init - SDK initialization. Must be called before calling any method (both when launching applications for the first time and when doing internal transitions across the frame).
- FAPI.Util.getRequestParameters - getting parameters when addressing the application
- FAPI.UI.getPageInfo - information about the page (height, width, scrolling position, position of the application iframe)
- FAPI.UI.postMediatopic - posting media topic with the user’s confirmation
- FAPI.UI.scrollToTop - scrolls the page to the top
- FAPI.UI.setWindowSize - changing the size of application container
- FAPI.UI.showConfirmation - confirmation dialog for the actions that require it (e.g. for posting in the news feed)
- FAPI.UI.showInvite - dialog for inviting friends to the application
- FAPI.UI.showNotification - dialog for sending notifications (unlike invitations, notifications can be sent to friends that are already using the application)
- FAPI.UI.showPayment - dialog for buying game currency or game items
- FAPI.UI.showPaymentPromo - window informing about a current payment system promotion
- FAPI.UI.showPermissions - dialog for requesting permissions (e.g. to change the user status)
- FAPI.UI.showPortalPayment - dialog for buying OKs (Odnoklassniki’s internal currency)
Connecting a library:
When using js + flash in a flash application, the “wmode=opaque” parameter must be set.
After every transition inside an iframe it is necessary to perform an initialization again with the FAPI.init method, as well as pass the following parameters:
Methods from the FAPI.UI group don’t require the callback function to be passed. After the method is executed, a global function will be called, and the developer must realize it. The function must have the signature:
- method - the name of the method called
- result - the result of the execution (“ok” if successful, “cancel” if the user canceled the action)
- data - additional information, for example, for showInvite() – a list of IDs of invited friends, separated by commas, in the string format.