P2P uses the Backbone framework to organize its JavaScript code, so you should get familiar with it before going further.
The model classes and model collections are exposed via the window.P2PAdmin property.
window.P2PAdmin
The connections object in each box should allow you to programatically create/delete connections.
connections
The candidates object in each box can be used to control the search term and the current page.
candidates
Source code: https://github.com/scribu/wp-posts-to-posts/blob/master/admin/box.js
Manually trigger a refresh of the connection candidates for a given metabox:
P2PAdmin.boxes['YOUR_CONNECTION_TYPE'].candidates.sync()
Delete all the connections for a particular connection type (for the current post):
P2PAdmin.boxes['YOUR_CONNECTION_TYPE'].connections.clear()
There was an error while loading. Please reload this page.