RE: Agents & REST - when to use what?
Hi Patrick,
You probably already know, but for other readers who don't, we have three API options:
- SOAP
- RESTful Agents
- RESTful REST
The SOAP API is normally accessed with client proxy wrappers. For this we provide proxies in the legacy SuperOffice.NetServer.Services nuget packages. Usage:
ContactAgent ca = new ContactAgent();
ContactEntity ce = ca.GetContactEntity(contactId);
The RESTful APIs are:
- WebAPI Agents, where all methods are POST requests. Notice how the URL for the Agent uses Method name segments...this is the key different between WebApi Agents and WebApi REST
POST /api/v1/Agents/Contact/GetContactEntity?contactEntityId=5
- pure RESTful API uses the traditional HTTP GET, PUT, POST, PATCH, DELETE methods.
GET /api/v1/Contact/5
For the WebApi option, where have a new Library option SuperOffice.WebApi. This library wraps the WebApi Agents API, and is meant as a transitional API for integrations moving from the legacy WCF SOAP-based API to the HTTP option - the object models are nearly identical.
Also, in contract to the legacy SuperOffice.NetServer.Services package, which is only for usable with .NET 4.8 Full Framework compiled code, SuperOffice.WebApi is compiled to .NET Standard 2.0 and can be used by .NET 4.8, .NET Core and .NET 5 projects. See the SuperOffice WebApi article for more details.
TL;DR
Agents use Method-based signatures and are all POST requests, where as the pure REST endpoints use more traditional HTTP verb methods and url segment naming schemes.
Hope this helps!