Testing APIs

Learn about the environments we provide to test your software with our APIs.

Overview

We provide environments to test your software with our APIs. There are different environments depending on which APIs you are using.

For some of our APIs, you must give evidence of your testing before you go live as part of our onboarding process.

Sandbox testing

Some of our APIs have a sandbox environment you can use for early testing.

Sandbox APIs don't usually require authorisation and are usually stateless - they return hard-coded responses.

To find out about sandbox testing for a particular API, read its documentation in our API catalogue.

Integration testing

Some of our APIs have an integration test environment you can use for more realistic testing.

The different approaches to integration testing are explained below. For details on a particular API, read its documentation in our API catalogue.

Integration testing with our RESTful APIs

For some of our RESTful APIs, you can access our integration test environments as follows:

1. Create an application and activate APIs

1. If you don't already have one, create a developer account.
3. Select 'My applications'.
4. Select '+ NEW APP'.
5. Enter details for your application.
6. In the 'APIs' section, find the testing APIs you want to test with and activate them by clicking the slider.
7. If you are using user-restricted APIs, specify your application's OAuth 2.0 Callback URL.
8. Select 'CREATE' to create the application.
9. Make a note of the API key and secret.

2. Generate a key pair, if required

If you are using signed JWT authentication, you need to generate a private/public key pair for testing and register your public key with us.

For details, see Application-restricted RESTful APIs - signed JWT authentication.

3. Configure your software for testing

To get your software working with our integration test environment, configure the following:

1. Base URL for APIs: https://int.api.service.nhs.uk
2. OAuth client ID and client secret (if needed): use the API key and secret from the previous step
3. Base URL path for our authorisation server (if needed) as follows:
Type of testing Authorisation server base URL
User-restricted API - simulated sign-in - no smartcard needed
- use for early testing
https://int.api.service.nhs.uk/oauth2-no-smartcard
User-restricted API - NHS Identity sign-in with smartcard or modern alternative https://int.api.service.nhs.uk/oauth2
Application-restricted API - signed JWT authentication https://int.api.service.nhs.uk/oauth2

4. Set up smartcard access, if required

If your software is using smartcards for user authentication, do the following:

1. get an ODS code - you’ll need one before you can access the Health and Social Care Network
3. get physical smartcards for testing
4. download client software, including the Identity Agent (IA) and the NHS Identity Hub

You must use a Windows platform with your software, including the .NET framework.

The following Windows operating systems are supported:

• Windows 10
• Windows 8.1

The NHS Identity Hub does NOT work with Internet Explorer, you will need to use a non-IE internet browser.  The following browsers are supported:

• Edge version 79 or above
• Chrome version 72 or above
• Firefox version 62 or above

5. Set up test data, if required

Some of our APIs include standard test data packs.

In some cases you might need to set up your own test data, for example:

• to test specific cases that the standard test pack doesn't cover
• to test data updates, for example patient data in PDS

To set up your own test data, you can either:

• use our Test Data Self-Service Portal (TDSSP) test data tool - but you need an HSCN connection - or

• tell us if you need access to a specific test pack for update testing, for example, for PDS update testing we recommend the PDS Compliance Pack

6. Start testing

During testing, for user-restricted APIs you need to sign in as an end user, as follows:

• if your test environment is set up for smartcard access, use the smartcard you set up in step 3 above
• if your test environment is set up for simulated sign-in, simply click the 'sign in' button - you don't need any credentials

Integration testing with our HL7 V3 APIs

Our HL7 V3 APIs have a number of Path to Live environments for integration testing, including:

• Development - early sandbox testing
• Integration - end-to-end and regression tests
• Deployment - test in situ and user acceptance tests
• Proof of concept
• Non-functional tests

For more details see Path to Live environments.

Performance testing

We do not provide environments for performance testing.

Moreover, the path-to-live environments for our RESTful APIs have low rate limits to protect them against overuse.

Last edited: 7 January 2021 12:46 pm