|
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.
.Net
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: behaviourConfiguration="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.
Using VB.NET ' 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
Using C# in .NET:
// Assuming you have created a service reference and called it ApiNamespace ApiNamespace.ApiClient api = new ApiNamespace.ApiClient(); // If using multiple API's you may need to specify the binding name in this constructor
int CompanyID = 0;
// Substitute the zero for your company ID Guid ApiKey = new Guid("API Key here");
ApiNamespace.Product[] products = api.GetAllProducts(CompanyID, ApiKey);
foreach (YourNamespace.Product p in products) { Response.Write("Product Name: " + p.Title + "<br />"); }
If you are working with earlier versions of .NET you must add it as a "Web reference". Note that this means there will be additional fields that must be completed on almost all API methods to denote whether a value has actually been specified or not. This is unavoidable and is a limitation of the .NET framework prior to version 3.
PHP
PHP users can access the API using the SOAP object. PHP Example: <?php
// Needed to remove PHP's execution timelimit of 30 secs. Some API calls can take longer.
set_time_limit(0);
$Api = new SoapClient("https://api.fast-serve.net/api.svc?wsdl");
// Assign it to prevent warnings
$params = null;
// Params must be named as per the API Docs and are case sensitive
$params->CompanyId = COMPANYID HERE AS INTEGER;
$params->ApiKey = "API KEY HERE";
// Intellisense will not work for these class methods.
// They are also case sensitive.
$ApiResult = $Api->GetAllProducts($params);
$products = $ApiResult->GetAllProductsResult->Product;
foreach($products as $product){
echo "Product Name: " . $product->Title . "<br />";
}
?>
Other Languages
Developers in other languages may use SOAP as well and should refer to their own languages documentation and guides for how to do so. Reference DocumentationA full API method reference can be found here along with links to the same documentation in both PDF and XML docBook format. Resellers should use the XML docBook format to generate custom-branded documentation for their own merchants.
|