How to use the API VB.NET
The EasyWebstore API is a SOAP 1.1 Web Service.
WSDL URL: https://api.fast-serve.net/api.svc?wsdl
Note: The API can only be accessed over a secure connection.
When working with the API, if you are using .NET Framework 3 or higher you should add the API URL to your project as a "Service reference". Once it is entered, open your app.config or web.config file and at the bottom check to see that only one endpoint has been configured. Remove the duplicate endpoint if Visual Studio has inserted one. You should have only the one endpoint configured there.
While you are in the *.config file you may also want to apply the following fixes for known issues.
1. Increase the timeout for requests (some requests require more time due to larger result sets)
<binding name="BasicHttpBinding_IApi" closeTimeout="00:1:00" openTimeout="00:1:00" receiveTimeout="00:10:00" sendTimeout="00:5:00" maxBufferSize="2147483647" maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647" messageEncoding="Text">
Setting the timeouts and buffer/message sizes will help ensure that your application doesn't throw an exception when using API methods that take a little longer to retrieve large resut sets.
2. Increase the maximum number records that can be returned.
Create the following section in your *.config inside the "system.serviceModel" section.
<behaviors> <endpointBehaviors> <behavior name="IApiBehavior"> <dataContractSerializer maxItemsInObjectGraph="2147483646"/> </behavior> </endpointBehaviors> </behaviors>
Once you've created this locate the "endpoint" tag and add the attribute: behaviorConfiguration="IApiBehavior"
After setting up the service reference (.NET 3 or higher) you could use code like the following to access the API and write out the name of each product in the store.
' Assuming you have created a service reference and called it ApiNamespace Dim api = New ApiNamespace.ApiClient() ' If using multiple API's you may need to specify the binding name in this constructor Dim CompanyID As Integer = 0 ' Substitute the zero for your company ID Dim ApiKey As New Guid("API Key here") Dim products As ApiNamespace.Product() = api.GetAllProducts(CompanyID, ApiKey) For Each p As YourNamespace.Product In products Response.Write("Product Name: " & p.Title & "<br />") Next