external_api_data
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| external_api_data [2023/01/26 09:32] – created angelos | external_api_data [2023/11/21 16:12] (current) – chris | ||
|---|---|---|---|
| Line 3: | Line 3: | ||
| Oftentimes you have external data coming from a REST HTTP API and want access to it through the Pathomation software platform for digital pathology and virtual microscopy. Importing the data as Pathomation form data may not always make sense for a variety of reasons. | Oftentimes you have external data coming from a REST HTTP API and want access to it through the Pathomation software platform for digital pathology and virtual microscopy. Importing the data as Pathomation form data may not always make sense for a variety of reasons. | ||
| - | PMA.core allows you to link external rest APIs and use them as regular form data. | + | PMA.core allows you to link external rest APIs and use them as regular form data. This works by invoking a user-defined command line application which must exist in the system that hosts PMA.core. Such applications can be: |
| + | * curl | ||
| + | * python | ||
| + | * custom cli utilities | ||
| - | ==== Configuring data connections ==== | + | PMA.core executes the application for a given image path and can also supply extra command line arguments. Once the application has finished, PMA.core reads the standard output stream and expects a JSON response, in which it attempts to read values for particular fields. |
| - | The first step in configuring | + | ==== Configuring HTTP API data connections ==== |
| - | * SQL Server | + | |
| - | * Oracle | + | To configure |
| - | {{ : | + | |
| - | To add an external connection you simply | + | {{: |
| + | |||
| + | On the next page you will be prompted to add | ||
| * Name: A name for the new connection to distinguish this connection from others | * Name: A name for the new connection to distinguish this connection from others | ||
| - | * Connection String: The connection string | + | * Command: The name or path of the application to execute |
| + | * Arguments: Command line arguments to pass to the application | ||
| + | * Fields: Field names to expect in the JSON output, once the command is executed | ||
| - | {{ :: | + | {{:add-external-api-data-connection.png?direct&600|}} |
| - | ==== Configure queries ==== | + | === Arguments |
| - | After creating | + | In the arguments field you can specify any number of command line arguments that are required for the correct execution of the command. For example, if you want to run a python script, |
| - | === SQL query === | + | Additionally, |
| - | {{ :: | + | - [path]: Gets replaced with the path of the image for which the external |
| - | Even though | + | |
| - | | + | |
| - | | + | |
| - | * Display name: A name for this query, just to distinguish between this and other queries | + | |
| - | * Fields to include: This is a list of all fields in the table. It is **automatically** populated after selecting the //Table Name// | + | |
| - | | + | |
| - | * Regular expression: This is an // | + | |
| - | | + | |
| - | | + | |
| - | As stated an above the **# | + | For example, |
| - | Before your query is ready you need to test that it works as expected | + | * Command: curl |
| + | * Arguments: -G -X GET --header " | ||
| + | |||
| + | === Fields === | ||
| + | |||
| + | PMA.core can read top level field values from a JSON response. You can specify a list of fields | ||
| === Testing === | === Testing === | ||
| - | To test your query for errors and validating its results you can use the Test query field. | + | You can test the result of the command |
| - | {{ :test_query.jpg?400 |}} | + | |
| + | {{:external-api-data-raw-command.png?direct&400|}} | ||
| - | Clicking on the Execute button will execute the query on the server. Any errors in syntax will be reported immediately bellow the execute button. If no errors occur a popup will appear that will show the results of the query. | ||
| - | {{ :: | ||
| ==== Consumption and applications ==== | ==== Consumption and applications ==== | ||
| - | After creating the queries | + | After creating the connection |
| - | This is the same API that is used to provide external data in downstream | + | This is the same API that is used to provide external data in downstream |
| {{ :: | {{ :: | ||
| - | |||
| - | ==== More background ==== | ||
| - | |||
| - | See [[https:// | ||
external_api_data.1674721963.txt.gz · Last modified: by angelos
