> For the complete documentation index, see [llms.txt](https://community-test.logicnets.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://community-test.logicnets.com/release-9/platform-documentation/advanced-topics/system-integration/package-discovery-cds-hook.md).

# 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*](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.

![](https://2802811211-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdFhfexCjZ5JMhwGzzywq%2Fuploads%2Fgit-blob-46aecba6604a2e43f581978632cd6e027118a086%2Fcdadc6e8-57e2-4331-ab89-94eb74036ba1.png?alt=media)

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*](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:

1. Open your Designer workspace.
2. Create a new blank project with a descriptive name; for example, *CustomPackageDiscovery*.
3. 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).

   ![](https://2802811211-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdFhfexCjZ5JMhwGzzywq%2Fuploads%2Fgit-blob-829d7f148919c7bfef3a0472349519c17edf8ff3%2F901d7c2b-da92-47b9-8e99-5d17cddf4618.png?alt=media)
4. Set the start code (3).
5. Click the *Framework* tab (1) and configure your customizations:

   ![](https://2802811211-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdFhfexCjZ5JMhwGzzywq%2Fuploads%2Fgit-blob-4d1cdf66d6a92fc5f6822c210ae68bf871c8074d%2F79c9b99b-441f-4274-8302-de47312c5e1c.png?alt=media)
6. Enter a hook name and description (2).
7. (Optionally) provide a tag value (3). The PackageDiscovery API will only return packages with this tag.
8. (Optionally) Add custom endpoints (4). Every custom endpoint will appear as an endpoint in the returned package card-links section.
9. 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.
10. 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*](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.

![](https://2802811211-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdFhfexCjZ5JMhwGzzywq%2Fuploads%2Fgit-blob-a12ea9a7236154ef1bc38c946bbd3dd755f7fd8c%2Ff2324adb-df7a-4a9a-bb01-7dd82424f9e5.png?alt=media)

![](https://2802811211-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdFhfexCjZ5JMhwGzzywq%2Fuploads%2Fgit-blob-2966a98296c3629e15073f84dc000abe1a321746%2Ffe2820ad-e9a6-4b60-9523-e36cd1afca14.png?alt=media)

## Example Project

For an example of this functionality, download the sample project attached to this article and import it into your Designer.

## Attachments

* [CustomPackageDiscovery.zip](https://github.com/logicnets/community-portal/tree/release-9/docs/.gitbook/assets/63btw4-CustomPackageDiscovery.zip)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://community-test.logicnets.com/release-9/platform-documentation/advanced-topics/system-integration/package-discovery-cds-hook.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
