To more easily use JSON data in C#, you will need to install the JSON.Net library from

All API calls require the endpoint URL and a set of headers. Some API calls will also require parameters (GET or DELETE requests) or data (POST or PUT) requests.

Every findCustomer, findPartner, or findProvider API call should include the following headers:






All calls are made using JSON data structures


Your subscription key for the NHVR Portal API

The subscription key uniquely identifies you to the NHVR Portal API

The find* endpoint uses the GET method and has three parameters:

  1. <Controller Entity Name>View<Account Type>Filter

  2. view

  3. viewAction


The filter parameter allows for paginating results, ordering results and filtering using a where clause. The following sub parameters are available:


Default value




The maximum number of records returned by the method.

The allowed range for this parameter is 1 to 500.



The number of records to skip in the record set. Use to paginate records.


The order clause to for sorting records.


The where clause for filtering records.

The filter parameter name consists of the API controller entity name and the account type and can be found in the API definitions found in the NHVR Developer Portal.

In this article we will use the VehicleRegistrationController.findCustomer controller method available from the NHVR Portal - Vehicle Service.

The filter parameter name for the VehicleRegistrationController.findCustomer controller method is: VehicleRegistrationViewCustomerFilter

Currently the 'where' sub-parameter must be supplied even if not required. If not required then set the 'where' sub-parameter to '{}'.


To control the number of records returned by the method set the limit to a value between 1 and 500.{"limit": 500, "where": {}}


If the total records available exceeds the limit then use skip to control the number of records to skip as the starting point for the records returned.{"limit": 500, "skip": 500, "where": {}}


To sort the record set specify the field or fields to sort in array and use the sort type 'DESC' to sort the field in descending alphanumeric order or 'ASC' to sort the field in ascending alphanumeric order.{"limit": 10, "skip": 0, "order": ["vehicleId DESC"], "where": {}}


To filter the record set specify the field or fields to filter in an object using the key as the field and the value as the filter value.{"limit": 10, "skip": 0, "order": ["vehicleId DESC"], "where": {"vehicleId": 1}}

C# example

using System;
using System.Net.Http.Headers;
using System.Net.Http.Json;
using System.Net.Http;
using System.Web;
using System.Threading.Tasks;
using Newtonsoft.Json;

namespace CSHttpClientSample

public class LoginResponse
public string token { get; set; }
public string refreshToken { get; set; }

static class Program
static void Main()

static async void MainAsync()
var client = new HttpClient();
var subscriptionKey = "<subscription key>";
var findResult = await GetVehicleRegistrations(client, subscriptionKey);

static async Task<string> GetVehicleRegistrations(HttpClient client, string subscriptionKey)
var queryString = HttpUtility.ParseQueryString("VehicleRegistrationViewCustomerFilter={\"limit\": 10, \"skip\": 0, \"order\": [\"vehicleId DESC\"], \"where\": {\"vehicleId\": \"1\"}}");
var uri = "" + queryString;

// Headers
client.DefaultRequestHeaders.Add("Cache-Control", "no-cache");
client.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", subscriptionKey);
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

// Get
HttpResponseMessage response = await client.GetAsync(uri);

string jsonResponse = response.Content.ReadAsStringAsync().Result;
return jsonResponse;

Did this answer your question?