Configuring Unbound Actions
The framework supports configuring unbound actions in a domain similar to unbound functions. An unbound action is considered as an operation that can change the state of a service. Due to this, the framework supports calling an action with a POST request. After the unbound action is configured, it is invoked by a POST request to the URL <Domain Root>/<Domain Namespace>.<Unbound Action Name>. The body of the POST request contains the parameters that will be passed to the action.
An unbound action is configured in the import.json file in the same way as an unbound function except the following differences:
An unbound action is specified in the actions collection property in the import.json file.
While specifying the action in the import.json file, the property includeInServiceDocument is not applicable to actions. This is because actions cannot be included in the service document available at the domain root.
The action names defined in the import.json file start with action_.
Paging on Actions
The configuration property isPageable is used to configure an action as pageable. When it is set to true, the action supports paging. The action is rerun and the result is navigated to the requested page. This configuration option should be used only for actions that can be safely rerun (that is, the action does not modify data) and return a flat list. The default is false.
Example
"actions":
{
"name": "Preview",
"importName": "Preview",
"description": "Generates a preview of the business administrative data changes that meet the specified criteria.",
"isComposable": false,
"isPageable": true,
"parameters": [
{
"name": "types",
"type": "String",
"isCollection": true
},
{
"name": "startDate",
"type": "DateTimeOffset"
},
{
"name": "endDate",
"type": "DateTimeOffset"
}
],

"returnType": {

"type": "PTC.BACMgmt.Delta",
"isCollection": true
}
}
A new request header type boolean PTC-EnablePagination is introduced. If the header is set to true, then the response returned to the client is paginated.
For actions marked as pageable, the action is rerun and the result is navigated to the requested page.
URI
POST / Windchill/servlet/odata/BACMgmt/Preview HTTP/1.1
Request Header
Make a request with a new request header PTC-EnablePagination set to true. The result returned to the client will be paginated, as specified in the odata.maxpagesize Prefer header. The new request header PTC-EnablePagination by default is set to false to avoid breaking existing clients.
Content-Type: application/json
CSRF_NONCE:<Use the value from Fetch NONCE example>
Prefer: odata.maxpagesize=1000
PTC-EnablePagination: true
Request Body
{
"types": [
"Preference"
],
"startDate": "2022-09-01T00:00:00.000Z",
"endDate": "2022-09-14T00:00:00.000Z"
}
Response
{
"@odata.context": "http://<host>:<port>/Windchill/servlet/odata/BACMgmt/$metadata#Collection(PTC.BACMgmt.Delta)",
"@PTC.AppliedContainerContext.LocalTimeZone": "GMT",
"value": [
{
"oid": "wt.preference.PreferenceInstance:262931",
"type": "Preference",
"localizedType": "Preference",
"context": "Site",
"name": "Default cache vault created",
"description": null,
"details": [
{
"key": "Value",
"value": "true"
},
{
"key": "Locked",
"value": "true"
},
{
"key": "Client",
"value": "Windchill"
}
],
"modifiedDate": "2022-09-12T14:46:40Z",
"localizedModifiedDate": "2022-09-12 14:46:40 GMT",
"modifiedBy": null,
"action": "Create"
},
{
"oid": "wt.preference.PreferenceCategoryDefinition:115478",
"type": "Preference",
"localizedType": "Preference",
"context": null,
"name": "Link [Include related Parts - Collector]",
"description": null,
"details": [
{
"key": "Object Type",
"value": "Link [Defintion - Category]"
},
{
"key": "Internal Name",
"value": "Link [MANAGED_COLLECTION_COLLECTOR_CATEGORY.AddToManagedCollection.ASSOCIATED_WTPART.default.option.id - MANAGED_COLLECTION_COLLECTOR_CATEGORY]"
}
],
"modifiedDate": "2022-09-12T14:37:29Z",
"localizedModifiedDate": "2022-09-12 14:37:29 GMT",
"modifiedBy": null,
"action": "Create"
}
],
"@odata.nextLink": "http://<host>:<port>/Windchill/servlet/odata/BACMgmt/Preview?$count=true&$skiptoken=1000"
}