Copy Configurations
You can use a custom action of the Configurations REST API to copy a configuration, as a supplement to the order copy function in an external application.
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:
-
Obtain the configuration identifiers for the configuration to be copied.
-
Retrieve the configuration URI based on the configuration identifiers.
-
Invoke the custom action on the configuration URI.
Note:
Refer to Oracle SCM Cloud Modeling Configurations for SCM for important background information.
Obtain the Configuration Identifiers for the Configuration to Be Copied
The configuration to be copied must already exist.
Here's a typical application processing flow for the scenario:
-
After a configuration session ends, Configurator uses the ReturnUrl parameter value passed in the initialization message to access the calling partner application.
-
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.
Here's a typical application processing flow for the scenario:
-
John uses the values of the ConfigHeaderId and ConfigRevisionId attributes that identify a configuration to query the Configurations resource, by using the following command to send a REST API request from the client to the server.
-
The response payload includes details that describe the results of the request.
-
Your partner application extracts the value of the
href
attribute from theself
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
copy operation. The name of the custom action is copy
. In a request payload, the syntax for the action is:
{ "name":"copy" }
Here's a typical application processing flow for the scenario:
-
John uses the link containing the generated key to post the predefined custom action,
copy
, to the configuration identified by the key, by using a REST API request .Note:
The Content-Type in the request header must be
application/vnd.oracle.adf.action+json
. -
The response payload includes details that describe the results of the request.
-
Your partner application extracts the values for the ConfigHeaderId and ConfigRevisionId that were generated for the new copy of the configuration that you requested.
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":"copy"}' "https://servername/fscmRestApi/resources/version/configurations/00020000000EACED00057708000110F08098A0100000000EACED00057708000110F08098A011"
Example Response
Here's an example of the response body in JSON format.
{ "result": "{"ConfigHeaderId":300100113224915,"ConfigRevisionId":300100113224916}" }