Package Discovery CDS Hook
Description
The Package Discovery CDS Hook is a Web API that implements the CDS Hooks interface standard (https://cds-hooks.org/) and returns all available package endpoints to which the authenticated user has access, for example, the start URL.
Package Discovery API
The Package Discovery API is located at https://myhost.com/mycompany/cds-services/PackageDiscoveryHook, and only authorized users can access this API. To authorize a user, add the api role for the PackageDiscoveryHook to a new or existing user group in the LogicNets Access Management function.
Every authorized package is returned as a CDS Hooks card (https://cds-hooks.hl7.org/2.0/#card-attributes) with information about the package and the project from which the package is published:
Card Field | Description | Example |
indicator | Static value | info |
uuid | Project GUID | E725A115F235A3C8422DEEF0EDE64AAA |
summary | Package Description | My description |
source > label | Package Title | My title |
links | Collection of endpoints exposed by the package | |
links > type | Static value | absolute |
links > label | End point label/description | Default package startup |
links > url | End point URL | https://myhost.com/mycompany/mystartcode |
extension > info.logicnets.startcodes | List of start codes that be used to the start the package | mystartcode |
extension > info.logicnets.publishDate | UTC Time stamp indicating when the package was created | 2024-01-11T08:13:29Z |
extension > info.logicnets.category | Package category | myproject |
extension > info.logicnets.tags | Tags configured in the package | “tag1”, “tag2” |
Most packages have a default start code, which is configured during publishing. The package can be started by calling the start package URL that consists of the instance base URL and the start code (e.g. https://myhost.com/mycompany/mystartcode). This default package startup URL is placed in the links section of the returned card.
PackageDiscoveryHook Customization
You can also customize the PackageDiscoveryHook to do the following:
- Filter the packages returned based on package tags
- Add custom endpoints
To customize the PackageDiscoveryHook, do the following:
- Open your Designer workspace.
- Create a new blank project with a descriptive name; for example, CustomPackageDiscovery.
- From the Details tab, click Modify and scroll to the General section. Select based on framework as the type (1) and PackageDiscoverHook as the framework (2).
- Set the start code (3).
- Click the Framework tab (1) and configure your customizations:
- Enter a hook name and description (2).
- (Optionally) provide a tag value (3). The PackageDiscovery API will only return packages with this tag.
- (Optionally) Add custom endpoints (4). Every custom endpoint will appear as an endpoint in the returned package card-links section.
- Optionally configure user roles. If you have configured user roles you have to authorize the user that calls the API. You can authorize user groups to access your CustomPackageDiscovery API in the Access Management application after you publish your project.
- Publish your project.
Call the API
With Postman or another application, call using your CustomPackageDiscovery API via the following URL: https://myhost.com/mycompany/CustomPackageDiscovery. Note: You must be authorized to access your CustomPackageDiscovery API or the standard PackageDiscoveryHook API.
The CustomPackageDiscovery API will return all packages with the same tag as configured above that user who is calling the API is authorized to use.
Example Project
For an example of this functionality, download the sample project attached to this article and import it into your Designer.