Create Active Configurations

You may have to create a solution that allows your customer (a personal computer vendor) to use a mobile client to create configured computer system in an order capture application.

You can use the POST action of the Configurations REST API to create an active configuration. An active configuration resource is essentially configuration without a user interface. The resulting payload for a POST HTTP action, includes a configuration identifier in addition to a configuration session token attribute, which is supplied as a HTTP header attribute for any subsequent interactions (update or delete actions) with the newly created active configuration.

Here's a typical application processing flow for the scenarios to use a REST API for an active configuration:

  1. You create an active configuration
  2. You can retrieve a runtime model node under the active configuration
  3. You can update a runtime model node under the active configuration
  4. You can use a custom action on the configuration to finish an active configuration

For more information, see Oracle Supply Chain Management Cloud Modeling Configurations for SCM.

Create an Active Configuration

In this scenario, you create an active configuration.

Example URL

Use this resource URL format.

POST

curl -u username:password -X POST -H "Content-Type:application/vnd.oracle.adf.resourceitem+json" -d 'request payload' 
"https://servername/fscmRestApi/resources/version/configurations"

Example Request

Here's an example of the request body in JSON format.

{
  "CallingApplicationCode": "OM",
  "InventoryItemNumber": "zCZ-AS100",
  "SessionEffectiveDate": "2018-11-28T00:00:01-07:00",
  "FinishConfigurationFlag": false
}

The following table shows the attributes that are required to start an active configuration.

Attribute Description

CallingApplicationCode

Abbreviation that identifies the name of the application that called this resource. The resource uses this name to identify the user interface to call when starting an interactive session.

InventoryItemNumber

Item number of the product or service model item the application uses to start the configuration.

SessionEffectiveDate

Session date and time to use when loading the model definition for the configuration session. This date determines the configuration options that are available, depending on how the Product Configurator Manager modeled the item.

FinishConfigurationFlag

Contains one of the following values: true or false. If true, then finish the configuration immediately when creating a configuration resource. If false, then do not finish the configuration immediately. For an active configuration this value will always be false.

Example Response

Here's an example of the response body in JSON format.

{
    "ConfigHeaderId": 300100174277130,
    "ConfigRevisionId": 300100174277131,
    "ConfigurationId": "300100174277130_300100174277131",
    "Name": "zCZ-AS100 (Wed Nov 28 00:00:01 MST 2018)",
    "Description": "Audio System",
    "ValidConfigurationFlag": false,
    "CallingApplicationId": 10500,
    "CallingApplicationCode": "FOM",
    "InventoryItemNumber": "zCZ-AS100",
    "InventoryOrganizationCode": "V1",
    "FinishConfigurationFlag": false,
    "LineQuantity": 1,
    "HeaderAttributes": null,
    "AdditionalRootLineAttributes": null,
    "CustomParameters": "[{\"Name\":\"FinishConfigurationFlag\",\"Value\":\"N\"}]",
    "ManualPriceAdjustments": null,
    "OutputMode": "filtered",
    "ConfigurationSessionToken": "82E65BA967003441E0530803F00AC7F6300100174277130300100174277131",
    "CreatedBy": "SCMOPERATIONS",
    "CreatedOn": "2019-03-07T06:33:34-07:00",
    "LastUpdatedBy": "SCMOPERATIONS",
    "LastUpdatedOn": "2019-03-07T06:33:34.496-07:00",
    "ConfigurationState": "Active",
    "SessionEffectiveDate": "2018-11-28T00:00:01-07:00",
...
}

The following table shows the attributes you need from the response payload to interact with the newly created active configuration.

Attribute Description

ConfigurationId

Value that uniquely identifies a configuration according to the ConfigHeaderId and ConfigRevisionId attributes.

ConfigurationSessionToken

Value that identifies an active configuration session. If the FinishConfigurationFlag attribute is False, then the application creates this token when it creates the configuration resource. You must add this token to the HTTP request header for each subsequent request to maintain continuity of the requests for the interactive configuration. HTTP header attribute name will be the same.

Note:

If an interactive session is ended (finished state), an error message is displayed that the session token is invalid.

Note:

If you try to access an expired configuration session (removed from the session cache due timeout), then a new configuration session is restored from the intermediate saved state with the session token. Once a configuration is moved to a finished state, the session token is no longer valid.

Retrieve a Runtime Model Node

In this scenario, you retrieve (GET) a runtime model node under the active configuration. Since an active configuration does not have a user interface, you can access the runtime nodes (child resources) by using the Model Nodes child resource. This includes both Oracle Product Hub Cloud and the supplemental runtime nodes and their attributes.

Example URL

Use this resource URL format.

GET

curl -u username:password -X GET -H "Content-Type:application/json" -H "ConfigurationSessionToken:ConfigurationSessionToken" "https://servername/fscmRestApi/resources/version/configurations/ConigurationId/child/modelNodes/NodeId"

The ConfigurationSessionToken and ConfigurationId from the POST action are required for this command. Additionally, since configurations always have a root node, the NodeId is 1 for the root node. The modelNode child resource has the ability to recursively access any mode under the configuration. To access any runtime node under the configuration, you can use the same pattern of /child/modelNodes/nodeId in the URL to identify the node.

For example, use the this resource URL format to retrieve the model nodes that are three-levels deep:

curl -u username:password -X GET -H "Content-Type:application/json" -H "ConfigurationSessionToken:ConfigurationSessionToken" "https://servername/fscmRestApi/resources/version/configurations/ConigurationId/child/modelNodes/NodeId/child/modelNodes/NodeId/child/modelNodes/NodeId"

Example Response

The response JSON payload for a runtime node includes only the relevant attributes for that node type. For example, a Quantity attribute is relevant only to a standard item and not to a text feature. And conversely, a Value attribute is relevant only to a text feature and not to a standard item.

Here's an example of the response body in JSON format.

{
    "NodeId": 1,
    "NodeType": "ROOT_MODEL_ITEM",
    "Name": "zCZ-AS100",
    "ParentNodeId": null,
    "Description": "Audio System",
    "DisplayName": "Audio System",
    "DisplayNamePath": "Audio System",
    "HasChildrenFlag": true,
    "HasTransactionalAttributesFlag": false,
    "InErrorModeFlag": false,
    "InputRequiredFlag": false,
    "InputRequiredInSubtreeFlag": false,
    "IsBoundFlag": true,
    "ProposedFlag": false,
    "ValidFlag": true,
    "ChangedByAutocompleteFlag": false,
    "Quantity": 1,
    "links": [
        {
            "rel": "self",
            "href": " https://servername/fscmRestApi/resources/version/configurations/300100174277130_300100174277131/child/modelNodes/1",
            "name": "modelNodes",
            "kind": "item"
        },
        {
            "rel": "canonical",
            "href": " https://servername/fscmRestApi/resources/version/configurations/300100174277130_300100174277131/child/modelNodes/1",
            "name": "modelNodes",
            "kind": "item"
        },
        {
            "rel": "parent",
            "href": " https://servername/fscmRestApi/resources/version/configurations/300100174277130_300100174277131",
            "name": "configurations",
            "kind": "item"
        },
        {
            "rel": "child",
            "href": " https://servername/fscmRestApi/resources/version/configurations/300100174277130_300100174277131/child/modelNodes/1/child/modelNodes",
            "name": "modelNodes",
            "kind": "collection"
        }
    ]
}

Update a Runtime Model Node

Once you have identified the URL reference to a runtime node, you can use the PATCH method to update the runtime model node under the active configuration. Depending on the node type, you can update one or more of the following attributes:

  • SelectionSate of a node; for example Boolean, Standard Item, or Option
  • Quantity of a node
  • Value of a supplemental node; for example, Text, Integer, or Decimal

Example URL

Use this resource URL format to update the attributes of a runtime node:

PATCH

curl -X PATCH -u "username:password" -H "Content-Type: application/vnd.oracle.adf.resourceitem+json" -d 'request payload' "https://servername/fscmRestApi/resources/version/configurations/ConigurationId/child/modelNodes/NodeId/child/modelNodesNodeId"

Example Request

Here's an example of the request body in JSON format.

{
  "Quantity": 5
}

Note:

A root runtime node cannot be updated.

If a PATCH request to update a runtime node results in a conflict error message, you can resubmit the same request with the OverrideConflictFlag attribute set to true.

Here's an example of a request body in JSON format if the above example results in a conflict that can be overridden:

Example Response

Here's an example of the response body in JSON format.

{
    "NodeId": 1,
    "NodeType": "ROOT_MODEL_ITEM",
    "Name": "zCZ-AS100",
    "ParentNodeId": null,
    "Description": "Audio System",
    "DisplayName": "Audio System",
    "DisplayNamePath": "Audio System",
    "HasChildrenFlag": true,
    "HasTransactionalAttributesFlag": false,
    "InErrorModeFlag": false,
    "InputRequiredFlag": false,
    "InputRequiredInSubtreeFlag": false,
    "IsBoundFlag": true,
    "ProposedFlag": false,
    "ValidFlag": true,
    "ChangedByAutocompleteFlag": false,
    "Quantity": 5,
...
}

Finish an Active Configuration

Once an active configuration has all the needed selections for a valid configuration, you run the custom Finish action to finish the configuration and persist the final configuration in a finished state.

Example URL

Use this resource URL format to finish an active configuration.

POST

curl -u username:password -X POST -H "Content-Type:application/vnd.oracle.adf.action+json" -d ' {"name":"finish"} -H "ConfigurationSessionToken:ConfigurationSessionToken" 
"https://servername/fscmRestApi/resources/version/configurations/ConigurationId"

You use the ConfigurationSessionToken and ConfigurationId attributes from the return payload of the POST action.

Note:

The Content-Type in the request header must be application/vnd.oracle.adf.action+json.