This describes the process of calling the Document Verification Verify endpoint using Postman and C#
Postman Example
Postman is a free app that allows you to perform HTTP requests. You can download it from the Postman website here.
Option 1 – Download and import our example collection
We have set up an example Postman collection that contains example requests that you can import https://github.com/W2-Global-Data/Api-Samples/tree/main/REST
All you will need to do is insert your W2 provided API key into the Authorization header of any request in the collection and it should work
Option 2 – Setup your own
1) Set the request method to Post
2) Set the URL to the verify endpoint: https://api.w2globaldata.com/document-verification/verify?api-version=1.1
3) Add an Authentication header to the request with the schema Basic and the value set to your Api Key.
5) Add the request values to the body. Full request details here
C# Example
An example of how to call the document verification verify endpoint using C#
using System;
using System.IO;
using System.Net.Http;
using System.Threading.Tasks;
using Newtonsoft.Json;
public class VerifyResult
{
public string Result { get; set; }
// OTHER PROPERTIES LEFT OUT FOR DEMO
}
public class Program
{
static async Task Main(string[] args)
{
var client = new HttpClient();
var content = new MultipartFormDataContent();
content.Add(new ByteArrayContent(File.ReadAllBytes("/Id1Image-front.png")), "pages", "id1-front.png");
content.Add(new ByteArrayContent(File.ReadAllBytes("/Id1Image-back.png")), "pages", "id1-back.png");
content.Add(new StringContent("Id1"), "DocumentType");
content.Add(new StringContent("123"), "ClientReference");
var response = await client.SendAsync(new HttpRequestMessage
{
Method = HttpMethod.Post,
Headers = { { "Authorization", "Basic YourApiKey" } },
RequestUri = new Uri("https://api.w2globaldata.com/document-verification/verify?api-version=1.1"),
Content = content
});
var verificationResult = JsonConvert.DeserializeObject<VerifyResult>(
await response.Content.ReadAsStringAsync());
Console.WriteLine($"Verification result: {verificationResult.Result}");
Console.ReadLine();
}
}