Guide
  • SDK

    • PHP
    • .NET
  • Postman

    • Postman Collection
Api Docs
Guide
  • SDK

    • PHP
    • .NET
  • Postman

    • Postman Collection
Api Docs
  • Getting Started

    • Getting Started
    • Integration process
  • Tools and libraries

    • SDK for PHP
    • SDK for .NET
    • Postman Collection
  • Fundamentals

    • Authorization
    • Errors
    • Extensions
    • Rate Limits
  • API Objects

    • Resources
    • Managing calendars
    • Online Features
    • Patient Presence
  • Callbacks

    • Push vs Pull
    • Real-time requests
  • Mappings

    • Vendor mapping
  • Changelog

    • Changelog
DOCPLANNER INTEGRATIONS

SDK for .NET

Our SDKs provide comprehensive implementations of all available models and methods, making it easy to integrate with the Docplanner API. Below you will find the necessary details to quickly get started with our .NET library.

Introduction

The Docplanner SDK is built on .NET Standard 2.0, supporting both .NET Framework 4.6.1+ and .NET Core 2.0+ projects.

Requirements

No special requirements are needed. The package includes dependencies:

  • Newtonsoft.Json (version 12.0.0 or higher)
  • System.ComponentModel.Annotations (version 5.0.0 or higher)

Setup

Obtaining the Package

The package is available in the Docplanner public repository.

  1. Add the following package source to your NuGet configuration:
    https://pkgs.dev.azure.com/docplanner/c4fa307b-7faf-45b9-a23f-faace862ad8f/_packaging/integrations%40Release/nuget/v3/index.json
    
  2. Search for and install the Integrations.Api.Sdk package via your NuGet package manager.

Authentication

The SDK uses OAuth 2.0 protocol to authenticate against API endpoints.

  1. Obtain a token by calling:
    https://www.{domain}/oauth/v2/token
    
    Use the appropriate grant type and scope, along with your client_id and client_secret for basic authorization. For example:
    var values = new List<KeyValuePair<string, string>>
    {
        new KeyValuePair<string, string>("grant_type", "client_credentials"),
        new KeyValuePair<string, string>("scope", "integration")
    };
    requestMessage.Headers.Add("Authorization", $"Basic {client_id}:{client_secret}");
    
  2. Use the acquired token in the Authorization header for all API requests:
    httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", "your_token");
    

For more information on authentication, see the authentication documentation.


Using the Client

Client Naming

Clients are named according to the tags specified in the API documentation. For example, if there is a Services tag, the corresponding client will be named ServicesClient.

Example Usage

Below is an example of retrieving a list of facilities using the FacilitiesClient.
Set up an HttpClient with the base URI:

var httpClient = new HttpClient()
{
    BaseAddress = new Uri("https://www.{domain}/api/v3/integration")
};
httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", await GetToken());
var facilitiesClient = new FacilitiesClient(httpClient);
var result = await facilitiesClient.FacilitiesGetAsync();

Sample Applications

Sample applications are available for the .NET SDK.
Remember: You will need to replace client_id and client_secret with your own values.

  • Console Application:
    A simple console app using the default HttpClient.
    Download here.

  • Web Application (Custom Handler):
    A sample web application utilizing a custom HttpMessageHandler to manage token acquisition and storage.
    Download here.

  • Web Application (Identity Handler):
    A sample web application leveraging the IdentityModel.AspNetCore package to simplify OAuth2 token usage.
    Download here.

Prev
SDK for PHP
Next
Postman Collection