Skip to main content
In just a few simple steps you can get ready to work with the web service agents:
  1. Obtain OAuth tokens.
  2. Instantiate a WebApiOptions object.
  3. Define the IAuthorization credential type.
  4. Create the desired Agent class, passing in the WebApiOptions as a constructor parameter.

Instantiate a WebApiOptions object

WebApiOptions(string baseUrl); The primary constructor accepts the target WebApi URL, https://sod.superoffice.com/cust12345/api, which is available as a claim in the ID token and system user token. WebApiOptions inherits from RequestOptions, which contain the internationalization settings. These settings can also be passed into the overloaded constructor.

Define the IAuthorization credential type

The IAuthorization parameter is used to define the credential type and to set the Authorization attribute in each HTTP request. Assign an instance to the WebApiOptions.Authorization property. Alternative 1:
Alternative 2:

Create and use the desired Agent

To create an Agent object, pass in the WebApiOptions as a constructor parameter.
This is the only Agent difference when compared to using the existing WCF SOAP proxies.
Now your code can make the same calls as before. The biggest change is that they are now asynchronous and can use the async-await pattern!