# Getting started

The Validated Party Data (VPD) service exposes a GraphQL (opens new window) endpoint for querying party information. This endpoint accepts POST requests with a JSON body containing a GraphQL query.

Authentication is required when using the service. When querying for party data, an OAuth bearer token (opens new window) must be added to the request.

# Getting a bearer token

The authority that issues and verifies access tokens for the VPD service is the eConnect Identity server. To be able to request access tokens you will need the credentials for the VPD Service Client.

Requesting the token can be done as follows:

using IdentityModel.Client;

var client = new HttpClient();

var request = new ClientCredentialsTokenRequest
{
    Address = "https://accp-identity.econnect.eu/connect/token",
    ClientId = "{client_id}",
    ClientSecret = "{client_secret}",
    Scope = "vpd"
};

var response = await client.RequestClientCredentialsTokenAsync(request);

if (response.IsError || response.AccessToken == null)
{
    // handle error
}

var token = response.AccessToken;

For the production environment use https://identity.econnect.eu/connect/token (opens new window).

# Making a request

Once you have an access token you can send requests to the VPD service. Details on the schema and what information can be queried is defined in the party schema chapter.

This simplified example shows the basics of making a request:

using GraphQL;
using System.Net.Http.Json;

var client = new HttpClient();

client.SetBearerToken(token); // your access token

var request = new GraphQLRequest
{
  Query = @"
  {
    party(name:""eConnect"", postcode:""3447GW"") {
        legalName
        website
    }
  }"  
};

var content = JsonContent.Create(request);

var response = await client.PostAsync("https://accp-vpd.econnect.eu/graphql/v1", content);

var result = await response.Content.ReadAsStringAsync();

For the production environment use https://vpd.econnect.eu/graphql/v1 (opens new window).

© 2024 eConnect International B.V.