Sample project for a new API connection in C#

Gewijzigd op Wo, 28 Jul, 2021 om 12:56 PM

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 https://api.yukiworks.be/ws/Archive.asmx 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 https://api.yukiworks.be/ws/Archive.asmx!
The same approach can be used to target any SOAP compliant webservice provided by Yuki.



Was dit artikel nuttig?

Dat is fantastisch!

Hartelijk dank voor uw beoordeling

Sorry dat we u niet konden helpen

Hartelijk dank voor uw beoordeling

Laat ons weten hoe we dit artikel kunnen verbeteren!

Selecteer tenminste een van de redenen
CAPTCHA-verificatie is vereist.

Feedback verzonden

We stellen uw moeite op prijs en zullen proberen het artikel te verbeteren