/
Connexion Api

Connexion Api

The Connexion api service should not be exposed to the public internet.

The Connexion service includes an API which allows you to programmatically modify the Connexion configuration. This API is subject to change as Connexion functionality is updated.

To enable the Connexion api service, run the configuration wizard and check the 'Enable the Connexion API' checkbox. Optionally change the API port (cannot be the same port as other Connexion services):

In order to provide authentication (and TLS traffic encryption), each client which will access this API must provide a certificate. This certificate must be installed within the “Trusted People” folder of the Connexion host machine.

The recommended approach is to create a unique self-signed certificate for each distinct API client. See https://docs.microsoft.com/en-us/powershell/module/pkiclient/new-selfsignedcertificate for information on creating self-signed certificates in Windows. We recommend setting the subject name of the certificate to a value which can identify the consumer (user name, machine name, etc.).

Some users have had issues using the above method (specifically the inability to export the certificate). The image below shows an alternate method for generating and exporting both certificates (one with a PK (pfx) and one without (cer)).

 

Once you have run the Powershell command, you will find the new certificate in your Personal folder of the Local machine store.

Export this certificate twice - once without the private key, and once with the private key. When exporting with the private key, you will need to supply a password. Copy the no-private-key file over to the Connexion host and install it into the “Trusted People” store of the Local Computer. This can be achieved by right clicking the certificate file (on the Connexion host) and choosing the “install certificate” option.

Choose the Local Machine store. Then select the ‘Trusted People’ store as the target.

You have now completed the requirements for the client API to create a tunnel with the API service. Verify that the certificate installed correctly on the Connexion host by looking in the ‘Trusted People’ store.

Deleting an API client certificate from this store will revoke access to the Connexion API.

Next, reference the Connexion.Api library (Connexion.Api.dll) and create a proxy to Connexion.

using System; using System.Security.Cryptography.X509Certificates; using Connexion.Api; namespace CxnApiClient { class Program { static async Task Main(string[] args) { // load the certificate to pass to the gateway api var certificate = new X509Certificate2(@"c:\test\apicert.pfx", "foobar"); // create a proxy to Connexion using (var proxy = ConnexionApiProxyFactory.CreateProxy("127.0.0.1", 8089, certificate)) { // test the connection Console.WriteLine("Query Groups..."); var response = await proxy.ServiceMethods.GetGroupsAndTabsAsync(new GetGroupsAndTabsRequest(true)); foreach (var group in response.Groups) { Console.WriteLine(group.Name); foreach (var tab in group.Tabs) { Console.WriteLine($"-->{tab.Name}"); } } } Console.ReadLine(); } } }

At this point, you can now make API calls.

Sample projects:

 

Related content

Connexion v16.0 R2 (16.0.2412)
Connexion v16.0 R2 (16.0.2412)
Read with this
Gateway Api
Gateway Api
More like this
Overview
Overview
Read with this
Connecting to a remote Connexion Server
Connecting to a remote Connexion Server
More like this
v16.0 Releases
v16.0 Releases
Read with this
Configure SSL on Inbound HL7 Device
Configure SSL on Inbound HL7 Device
More like this