In order to use the API, you need to be registered first with the Association Medicys. By registering, you will be given a client secret key that you will use to ask for an access token at http://auth.medicys-conventionnel.fr/connect/token (for the sandbox, use https://staging-auth.medicys-conventionnel.fr/connect/token). We use the grant type "client credentials" when authenticating the end users to the API.

// request token
var tokenResponse = await client.RequestClientCredentialsTokenAsync(new ClientCredentialsTokenRequest
{
    Address = disco.TokenEndpoint,

    ClientId = "client",
    ClientSecret = "secret",
    Scope = "api1"
});

if (tokenResponse.IsError)
{
    Console.WriteLine(tokenResponse.Error);
    return;
}

Console.WriteLine(tokenResponse.Json);

Once you are granted a token, you can use it to make calls to the API

// call api
var client = new HttpClient();
client.SetBearerToken(tokenResponse.AccessToken);

var response = await client.GetAsync("https://api.medicys-conventionnel.fr/api/JudicialFile/GetFiles");
if (!response.IsSuccessStatusCode)
{
    Console.WriteLine(response.StatusCode);
}
else
{
    var content = await response.Content.ReadAsStringAsync();
    Console.WriteLine(JArray.Parse(content));
}
// call api
var client = new HttpClient();
client.SetBearerToken(tokenResponse.AccessToken);

var response = await client.GetAsync("https://staging-api.medicys-conventionnel.fr/api/JudicialFile/GetFiles");
if (!response.IsSuccessStatusCode)
{
    Console.WriteLine(response.StatusCode);
}
else
{
    var content = await response.Content.ReadAsStringAsync();
    Console.WriteLine(JArray.Parse(content));
}