-
Notifications
You must be signed in to change notification settings - Fork 15
Custom API Setup
[This is a preview feature. There are some limitations. ]
Creations of custom apis can be done using DAXIF#. The registrations are similar to plugin registrations.
You need to extend your api using [CustomAPI.cs][customapi-gist]:
public class MyCustomAPI : CustomAPI {
public MyCustomAPI()
: base(typeof(MyCustomAPI))
{
...
}
...
}Then you can register a new api using the functions defined in the base class:
RegisterCustomAPI("MyCustomAPI", MyAction);
protected void MyAction(LocalPluginContext localContext)
{
...
}There is a range of configuration possibilities of the api. These can be defined fluently. For a full overview of the different configurations see the Custom API entity reference:
RegisterCustomAPI("MyCustomAPI", MyAction)
.AllowCustomProcessingStep(AllowedCustomProcessingStepType.AsyncOnly)
.Bind<Account>(BindingType.Entity)
.EnableCustomization()
.MakeFunction()
.MakePrivate()
.EnableForWorkFlow();Request Parameters and Response Properties can be defined:
RegisterCustomAPI("MyCustomAPI", MyAction)
.EnableCustomization()
.AddRequestParameter(new CustomAPIConfig.CustomAPIRequestParameter("myRequestParameter", RequestParameterType.Integer))
.AddResponseProperty(new CustomAPIConfig.CustomAPIResponseProperty("myResponseProperty", RequestParameterType.Integer));
protected void MyAction(LocalPluginContext localContext)
{
...
var pluginContext = localContext.PluginExecutionContext;
var input = (int)pluginContext.InputParameters["myRequestParameter"];
...
pluginContext.OutputParameters["myResponseProperty"] = 1337;
}The creation of Custom APIs has been included in the PluginSyncDev.fs script. Meaning if you want to introduce your implemented APIs to dev, then you just need to execute the script.
The APIs and its dependencies is then a part of your solution, and will be deployed as usual across environments.
There is some limitations to the current setup:
- The plugintype entity are used both by the existing plugin registrations and the newly introduced custom apis. These are currently handled in a non optimal way in terms of creation/updates and deletion.
- There might either be some properties that are not relevant for users to define.
- There might lack some properties that the user want to define but can not.
- Certain combination of configurations should not be possible according to the documentation. These should result in failures when trying to sync.
- Name/Displayname/unique of customapi/properties/parameters need to be alligned.
- Can not create apis/properties/parameters with same name.
- If APIs are deployed across environments then you might see the import failing when you make critical changes to the configuration in DEV. Currently the cleanup of existing customapis/properties/parameters is not performed by the tool, and must therefore be performed manually. This can also happen when syncing to dev.
Setup Instructions
General
Example Scripts
- _Config
- CountEntities
- DataExportSource
- DataImportTarget
- GenerateCSharpContext
- GenerateTypeScriptContext
- PluginSyncDev
- SolutionCreateDev
- SolutionExportDev
- SolutionExtract
- SolutionImportArg
- ViewExtender
- SolutionPack
- WebResouresSyncDev
- WorkflowSyncDev
Contribute