PyRAT Integration
PyRAT
PyRAT is a web-based animal colony management system. This integration enables you to browse and filter PyRAT, and to import records from PyRAT as tables into your RSpace notebook.
deployment.properties
file. Either Research Space can perform this, or an on-premises RSpace administrator. Details of the properties are in the RSpaceConfiguration.md
configuration document included with RSpace distribution.Configuration
Getting set up is quick and easy. In order to use PyRAT, make sure an administrator has configured RSpace to use PyRAT and has set it as 'Available' in the System->Configuration panel.
1. You will need a personal access token, which you can request from your PyRAT admin.
2. Now, in RSpace, go to Apps Page and select the PyRAT banner after you have enabled it

3. Select the server alias (previously configured by the administrator) and add your api-key, and save.
![]() | ![]() |
4. After you've saved, the App panel should look like this:

You can update an existing token at any time by entering a new value and clicking 'Save'.
Using PyRAT from RSpace
You can access PyRAT from the text editor toolbar.

Once you click on the PyRAT icon, you will be asked to select a specific PyRAT Server:

After you select the server, the popup will show a paginated listing of entries (some columns are redacted for privacy):

You can filter results and also choose which columns to display:

To insert data into RSpace, select the desired rows using the checkboxes, then 'Insert'. A table will be added to RSpace text field with the visible columns.

Troubleshooting
PyRAT server domain certificate (RSpace version 1.96.1, or later)
From version 1.96, RSpace fetches data from PyRAT via the RSpace server rather than directly from the browser. This has the advantage of preventing the CORS issues described below but requires that the RSpace server trust the certificate of the PyRAT server. If the integration is not working, then a system administrator should consult the server logs. If there is message akin to the following then consult the guide on domain certificates.
I/O error on GET request for "$PYRAT_SERVER/api/v2/version": PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target; nested exception is javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
CORS (RSpace version 1.96.0 or older)
If you see an error message relating to CORS or pagination label that looks like this

then your PyRAT server has not be adequately configured for integration with RSpace. We make a cross-origin request directly from the RSpace application to the PyRAT server and as such the PyRAT server must allow cross-origin requests. Furthermore, it must also allow us to access the custom HTTP headers that describe the number of results in the search query. It is for this reason we recommend that the PyRAT server be configured to respond with the HTTP header of:
access-control-expose-headers: *
Thereafter, RSpace will be able to access the x-total-count
header and display the results with pagination.