Click or drag to resize

Sample Code Notes

Some extra information pertaining to the provided code samples.

1.    The code samples are written in VB.NET.

  • Using .Net is no longer the preferred approach for consuming the restful methods, but is still acceptable. Restful methods can be consumed with a variety of different languages. Feel free to use any technology better suited for your purposes. VB.Net was chosen since it is best suited for current WCF users to transition from.

2.    The code samples use WebClient to consume SDK.

  • There are many different technologies that can consume restful services. Feel free to use any technology better suited for your purposes. We only chose to use WebClient in order to keep the samples concise and involve minimal setup.
  • Here is further information about WebClient.

3.    The code samples tend to use a dictionary to store an object.

  • There are many different ways to represent input or output of a restful service. Alternatives include data transfer objects, strings or JObjects. Feel free to use any strategy best suited for your purposes. Dictionary was chosen for the sample code since it is readable, easily compiled and can demonstrate partial input.

4.    The code samples tend to handle errors briefly.

5.    The code samples may not demonstrate all the properties.

  • We provide links under the Request and Response headers that further explain properties.

6.    A few import statements need to be added in order to execute the code samples.

  • Imports System.Net
  • Imports System.Text
  • Imports System.Collections
  • Imports System.Collections.Generic

7.    Some input values used in the code samples will not be valid in another environment.

  • For example, our sample code may show a hard-coded account lookup code. It is unlikely real environments will have an account with a lookup code that matches the example account lookup code in the code sample. In those cases, real values would need to entered before the sample can run successfully. Information about how valid values can be obtained appears in the documentation, the sample code and in the error messages.

8.    All the code samples use default value for Accept header (application/json).

  • All the responses in sample code are in JSON format by default. In order to get responses in XML format, request Accept header needs to be set to "application/xml". E.g.
    1With oWebclient.Headers
    2  .Add("AuthenticationKey", AUTHENTICATION_KEY)
    3  .Add("DatabaseName", DATABASE)
    4  .Add("Content-type", "application/json")
    5  .Add("Accept", "application/xml")           'Accept XML
    6End With