Muokkaa

Jaa


Access DICOM Change Feed logs by using C# and the DICOM client package

The Change Feed capability enables you to go through the history of a DICOM® service and act on the create and delete events.

You access the Change Feed by using REST APIs. These APIs, along with sample usage of Change Feed, are documented in the DICOM Change Feed overview. The version of the REST API should be explicitly specified in the request URL as described in the API Versioning for DICOM service Documentation.

Consume Change Feed

The following C# code example shows how to consume Change Feed using the DICOM client package.

const int limit = 10;
 
using HttpClient httpClient = new HttpClient { BaseAddress = new Uri("<URL>") };
using CancellationTokenSource tokenSource = new CancellationTokenSource();
 
int read;
List<ChangeFeedEntry> entries = new List<ChangeFeedEntry>();
DicomWebClient client = new DicomWebClient(httpClient);
do
{
    read = 0;
    DicomWebAsyncEnumerableResponse<ChangeFeedEntry> result = await client.GetChangeFeed(
        $"?offset={entries.Count}&limit={limit}&includeMetadata={true}",
        tokenSource.Token);
 
    await foreach (ChangeFeedEntry entry in result)
    {
        read++;
        entries.Add(entry);
    }
} while (read > 0);

To view and access the ChangeFeedRetrieveService.cs code example, see Consume Change Feed.

Next steps

For information, see the DICOM service overview.

Note

DICOM® is the registered trademark of the National Electrical Manufacturers Association for its Standards publications relating to digital communications of medical information.