Connect

Last updated: May 18th, 2021

Getting Started

Prerequites

If you haven't already please read through the onboarding process. You will not be able to access any of IPAF's Data Services without going through this process, you'll also need a good understanding of OAuth 2.0 with OpenIDConnect.

Configure Startup for IPAF ID

Introduction to the IPAF ID

The Data Services and access to resources is managed by an IPAF ID. Anyone can create an IPAF ID, head on to IPAF ID Site to create yours. The IPAF ID utilises the standardised Authentication and Authorisation flow of OAuth 2.0 with OpenIDConnect. Once you have gone through the onboarding process and you are provided with your API Client and Secret you can proceed with building your application. All requests made to the Data Services, must provide a bearer access_token which is gained via the IPAF ID via your Client ID/Secret.

Using IPAF ID

If you want to learn more about the IPAF ID's Authorisation/Authentication go to Security to find out how this works. There are lots of examples on the web using the Authorisation Code Flow (with PKCE).

Here are a couple of great examples:

Postman and Auth0 are great ways of building your clients that makes it easy for developers to create, share, test and document APIs. We recommend testing your Data Services calls using our client via our definitions, Postman's or any other client to aid your development and understanding. You'll find all the discovery documentation for the IPAF ID Here

Create HTTP Client

Introduction

Once you have successfully received your access_token. We can now work towards connecting and making your first API call using C#. The simplest way to do this is using the built-in .Net class System.Net.Http.HttpClient in the System.Net.Http.Dll assembly. Before we start make sure your project has a reference to the System.Net.Http.Dll either directly or via a package manager (i.e NuGet).

Client Example

Here is a basic example that requests a Licence by passing the assigned access_token.

using System;
using System.Net.Http;
using System.Threading.Tasks;

namespace Api.Example
{
    class Program
    {
        static async Task Main(string[] args)
        {
            using var client = new HttpClient();
            client.DefaultRequestHeaders.Add("Authorization", "bearer ACCESS_TOKEN");
            var response = await client.GetAsync("https://ds.dev.ipaf.org/licence/v1.1/licence/00000000-0000-0000-0000-000000000000");
            response.EnsureSuccessStatusCode();
            var responseStream = await response.Content.ReadAsStringAsync();
            Console.WriteLine(responseStream);
        }
    }
}

Making your First Call

Understanding Data Service Endpoints

The Data Service endpoints all adhere to the OpenAPI Specification (OAS) this defines a standard, language-agnostic interface to RESTful APIs which allows both humans and computers to discover and understand the capabilities of the service without access to source code, documentation, or through network traffic inspection.

  • To see a working example of one of the Data Services OpenAPI Documentation here is the Licence Specification

The Next Step

If you're ready to move on to building your application(s) using the IPAF ID and Data Services the next step is to head on over to the Endpoints area.

Here you will discover Data Services easy to use Client and documentation for testing your new Data Service powered operations, good luck - if you need any assistance at any point please contact us on itsupport@ipaf.org.