Sample project for a new API connection in C#

Modified on Thu, 16 Sep 2021 at 08:26 AM

This document will guide you through the steps to create a new API connection from scratch.

Requirements for this sample project are:

  • .Net Framework 3.0 or higher
  • Visual Studio 2013 or higher
  • A valid API key

To get a detailed overview of a SOAP compliant webservice, you can simply open the endpoint in a web browser.

For example, if you open you get the following page:

There are multiple ways to connect with this API, but we will focus on the most accessible way for developers and technical profiles. 

1. Open Visual Studio and create a new project

2. Select "Console App (.NET Framework)"

3. Once the project is created, right click "References" and select "Add Service Reference.."

4. In the "Add Service Reference" screen, fill in the endpoint URI you would like to use and select "Go" 

5. Open the file App.config and verify which bindingConfiguration values have been added.

  • In this example, both ArchiveSoap (SOAP standard 1.1) and ArchiveSoap12 (SOAP standard 1.2) are valid configuration names.

6. Open the file Program.cs and include the following namespace:

using ConsoleApp1.ServiceReference1; // this is <projectname>.<chosen namespace>
Insert the following code in Main:

var client = new ArchiveSoapClient("ArchiveSoap");            // this is a binding config
var sessionID = client.Authenticate("xxx-xxx-xxx-xxx-xxx");   // insert API key here
var response = client.GetCurrentDomain(sessionID);            // example call to the API

Congratulations, you now have a working example to connect to!
The same approach can be used to target any SOAP compliant webservice provided by Yuki.

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article