Validate Configurations

You can use a custom action of the Configurations REST API to validate a configuration, to eliminate errors prior to submitting a quote or order to an order management application for fulfillment.

For this example, assume that you create a solution that allows John Brown, your customer (a personal computer vendor), to use a mobile client to connect to your partner application (an order capture system) and then use a REST API for additional tasks.

Let's discuss these scenarios:

  1. Obtain the Parameter ID for the initialization parameters.

  2. Obtain the configuration identifiers for the configuration to be validated.

  3. Retrieve the configuration URI based on the configuration identifiers.

  4. Invoke the custom action on the configuration URI.

Note:

See to Oracle SCM Cloud Modeling Configurations for SCM for important background information.

Obtain the Parameter ID for the Initialization Parameters

In order to validate a configuration, you must launch a configuration session that can validate it. To launch a configuration session, you must provide a set of initialization parameters.

Here's a typical application processing flow for the scenario:

  1. John sends a REST API request from the client to the server.

  2. The response payload includes details that describe the results of the request.

  3. The client application extracts the value of the ParameterId attribute from the response payload, for the desired set of initialization parameters. The ParameterId attribute is an ID that identifies a particular set of initialization parameters. It will be used in conjunction with the custom action validate in a later step.

    Note:

    When a partner application launches the configurator in an embedded iFrame for an interactive configuration session, a value for ParameterId is passed to the configurator entry point ConfigLaunch.jspx

Example URL

Use this resource URL format.

GET

curl -u username:password "https://servername/fscmRestApi/resources/version/configurationInitializationParameters"

Example Response

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

{
	"items" : [ {
		"ParameterId" : 300100111326481,
		"CallingApplicationCode" : "FOM",
		"Header" : null,
		"Line" : "{\"LineQuantity\":1,\"InventoryOrganizationCode\":\"V1\",\"InventoryItemId\":300100017155319,\"InventoryItemNumber\":\"zcz_cn82441\",\"RequestOn\":2224306801000,\"InventoryOrganizationId\":204}",
		"CustomParameters" : null,
		"ManualPriceAdjustments" : null,
		"PageTitlePrefix" : null,
		"ExpiredFlag" : false,
		"ErrorMessageText" : null,
		"TerminalActionCaption" : null,
		"ValidationCannotAlterFlag" : true,
		"ValidationFailFastFlag" : true,
		"links" : [ {
			"rel" : "self",
			"href" : "https://servername/fscmRestApi/resources/version/configurationInitializationParameters/300100111326481",
			"name" : "configurationInitializationParameters",
			"kind" : "item"
		}, {
			"rel" : "canonical",
			"href" : "https://servername/fscmRestApi/resources/version/configurationInitializationParameters/300100111326481",
			"name" : "configurationInitializationParameters",
			"kind" : "item"
		} ]
	}, 
	...
	{
		 "ParameterId" : 300100111164232,
		"CallingApplicationCode" : "CZ",
		"Header" : "{}",
		"Line" : "{\"LineQuantity\":2,\"InventoryItemId\":300100033383880,\"RequestOn\":1512693589693,\"InventoryOrganizationId\":204}",
		"CustomParameters" : "[]",
		"ManualPriceAdjustments" : "{}",
		"PageTitlePrefix" : null,
		"ExpiredFlag" : false,
		"ErrorMessageText" : null,
		"TerminalActionCaption" : null,
		"ValidationCannotAlterFlag" : true,
		"ValidationFailFastFlag" : true,
		"links" : [ {
			"rel" : "self",
			"href" : "https://servername/fscmRestApi/resources/version/configurationInitializationParameters/300100111164232",
			"name" : "configurationInitializationParameters",
			"kind" : "item"
		}, {
			"rel" : "canonical",
			"href" : "https://servername/fscmRestApi/resources/version/configurationInitializationParameters/300100111164232",
			"name" : "configurationInitializationParameters",
			"kind" : "item"
		} ]
	} ],
	"count" : 25,
	"hasMore" : true,
	"limit" : 25,
	"offset" : 0,
	"links" : [ {
		"rel" : "self",
		"href" : "https://servername/fscmRestApi/resources/version/configurationInitializationParameters",
		"name" : "configurationInitializationParameters",
		"kind" : "collection"
	} ]
}

Obtain the Configuration Identifiers for the Configuration to Be Validated

The configuration to be validated must already exist.

  1. After a configuration session ends, Configurator uses the ReturnUrl parameter value passed in the initialization message to access the calling partner application.

  2. From the output message, the partner application extracts the values of the output attributes ConfigHeaderId and ConfigRevisionId. These attribute-value pairs will be used in a query to get a composite key for the configuration resource.

    Attribute

    Description

    Example

    ConfigHeaderId

    Identifier for the configuration header generated when the value of the ExitStatus parameter is "save".

    300100112392208

    ConfigRevisionId

    Identifier for the configuration revision, generated when the value of the ExitStatus parameter is "save".

    300100112392209

Retrieve the Configuration URI Based on the Configuration Identifiers

John uses the Configurations resource in a URI that identifies the particular configuration to validate.

Flow of the Configurations resource that identifies the particular configuration to validate.

Here's a typical application processing flow for the scenario:

  1. John uses the values of the ConfigHeaderId and ConfigRevisionId attributes that identify a configuration to query the Configurations resource.

  2. The response payload includes details that describe the results of the request.

  3. Your partner application extracts the value of the href attribute from the self link in the response payload. This URI uniquely identifies the configuration by way of the composite key in the URI and will be used to retrieve the configuration and perform other custom actions on the resource.

    {
          "rel" : "self",
          "href" : "https://servername/fscmRestApi/resources/version/
    configurations/00020000000EACED00057708000110F08098A0100000000EACED00057708000110F08098A011",
          "name" : "configurations",
          "kind" : "item"
        }

Example URL

Use this resource URL format.

GET

curl -u username:password "https://servername/fscmRestApi/resources/version/configurations?q=ConfigHeaderId=300100112392208;ConfigRevisionId=300100112392209"

Example Response

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

{
	"items" : [ {
		"ConfigHeaderId" : 300100112392208,
		"ConfigRevisionId" : 300100112392209,
		"OutputMode" : "filtered",
		"Name" : "zCZ-CN82441 (Mon Jan 08 00:00:01 MST 2018)",
		"Description" : "Sentinel System",
		"ValidConfigurationFlag" : true,
		"SessionEffectiveDate" : "2018-01-08T00:00:01-07:00",
		"CallingApplicationId" : 708,
		"links" : [ {
			"rel" : "self",
			"href" : "https://servername/fscmRestApi/resources/version/configurations/00020000000EACED00057708000110F08098A0100000000EACED00057708000110F08098A011",
			"name" : "configurations",
			"kind" : "item"
		}, {
			"rel" : "canonical",
			"href" : "https://servername/fscmRestApi/resources/version/configurations/ 00020000000EACED00057708000110F08098A0100000000EACED00057708000110F08098A011",
			"name" : "configurations",
			"kind" : "item"
		}, {
			"rel" : "child",
			"href" : "https://servername/fscmRestApi/resources/version/configurations/00020000000EACED00057708000110F08098A0100000000EACED00057708000110F08098A011/child/ConfigurationLines",
			"name" : "ConfigurationLines",
			"kind" : "collection"
		}, {
			"rel" : "child",
			"href" : "https://servername/fscmRestApi/resources/version/configurations/00020000000EACED00057708000110F08098A0100000000EACED00057708000110F08098A011/child/ConfigurationMessages",
			"name" : "ConfigurationMessages",
			"kind" : "collection"
		}, {
			"rel" : "child",
			"href" : "https://servername/fscmRestApi/resources/version/configurations/00020000000EACED00057708000110F08098A0100000000EACED00057708000110F08098A011/child/ConfigurationLineAttributes",
			"name" : "ConfigurationLineAttributes",
			"kind" : "collection"
		} ]
	} ],
	"count" : 1,
	"hasMore" : false,
	"limit" : 25,
	"offset" : 0,
	"links" : [ {
		"rel" : "self",
		"href" : "https://servername/fscmRestApi/resources/version/configurations",
		"name" : "configurations",
		"kind" : "collection"
	} ]
}

Invoke the Custom Action on the Configuration URI

John uses the URI from the previous step to identify the particular configuration on which to post the custom action that performs the validate operation. The name of the custom action is validate. In a request payload, the syntax for the action is:

{
  "name": "validate", 
  "parameters": [{"ParameterId": "value"}]
}

Example:

{
  "name": "validate", 
  "parameters": [{"ParameterId": 300100111326481}]
}
Flow of the Configurations resource to identify the particular configuration on which to post the custom action that performs the validate operation.

Here's a typical application processing flow for the scenario:

  1. John sends a REST API request from the client to the server. The request includes:

    • The predefined custom action, validate, to be applied to the configuration being validated.

    • The ParameterId value that identifies the set of initialization parameters to be passed to the configurator to start a configuration session.
    • The composite key that identifies the specific single configuration to be validated during the session.

    • The URI containing the composite configuration key, against which the custom action is posted.

    Note:

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

  2. The response payload includes details that describe the results of the request.

  3. Your partner application extracts the value of the ExitStatus attribute that resulted from the validation of the configuration that you requested. This table describes the values of the ExitStatus attribute.

    Value

    Indicates

    save

    The configuration is valid and no further action is required.

    error

    A fatal error occurred during the validation process and therefore the validity of the configuration could not be determined. The error message will be available as a URL parameter and further business action can be taken by the calling application.

    validationIssue

    The configuration is invalid based on the current state of the configuration. All validation error messages are persisted and can be retrieved by invoking a GET action on the specific configurations resource using the ConfigHeaderId and ConfigRevsionId of the configuration.

Example URL

Use this resource URL format.

POST

curl -u username:password -X POST -H "Content-Type:application/vnd.oracle.adf.action+json" -d '{ "name": "validate", "parameters": [{"ParameterId": 300100111326481}]}' "https://servername/fscmRestApi/resources/version/configurations/00020000000EACED00057708000110F08098A0100000000EACED00057708000110F08098A011" 

Example Request

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

{
	"ParameterId": 300100111326481
}

Example Response

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

{
  "result": 
  "{"ExitStatus":"save",
    "ConfigHeaderId":300100108257901,
    "ConfigRevisionId":300100108257902,
    "ValidConfigurationFlag":true,
    "ParameterId":300100111326481}"
}