AdvantageCMS.Core.Common.BaseClasses Namespace
Advantage CSP

Enabling API Requests

Enabling access to the API requires 2 steps.

  • Register the API for usage in the Global.asax file.
  • Register a BusinessObject for access inside the AdvantageCSP admin.

Global.asax


To allow the system to access the API, you must add the registration to the "Application Start"
If secure access is required, you must configure a custom handler to process the security. There is a sample handler included by default in the project.

  • Public Access -> AdvantageCSP.API.WebApiConfig.Register(GlobalConfiguration.Configuration, null);
  • Secure Access -> AdvantageCSP.API.WebApiConfig.Register(GlobalConfiguration.Configuration, new SecureContentControllerHandler());
C# Copy imageCopy
void Application_Start(object sender, EventArgs e)
{
    AdvantageCSP.API.WebApiConfig.Register(GlobalConfiguration.Configuration, null);
    //** Uncomment to add to route for API.  Create your own Handler for authentication or use NULL for public read.  Sample for reference only. **
    //AdvantageCSP.API.WebApiConfig.Register(GlobalConfiguration.Configuration, new AdvantageCSP.WebAPI.Handler.SecureContentControllerHandler());
}


Register a Data Entity BusinessObject


For an data entity to be accessable, it must be configured in the API screen inside the admin

Navigate to Domain Management -> Configuration Settings -> System -> API

API Navigation


Add the API Entry

Add API

  • API Name -> The name of the API object use by the consumer.
  • Object Name -> The BusinessObject.
  • Use Cache -> Enables Caching of database queries.
  • Cache Minutes -> How long cache results should be held before refreshing.
  • Permissions -> What actions are allowed on this entry.