AIF Integration using a Web Service

Customers can use AIF to calculate the Optimized History, Option Counts and Sales Potential that are used by AP during the Assortment Fit Process. The Optimized History/Option Count and Sale Potential can be interfaced to AP.

Before using the web service calls in AP, AP needs to export the Assortment Group that is the combination of unique Assortment Periods and Location Clusters. It runs as part of the daily batch and AIF also needs additional setups during implementation to run those Option Forecasts in the nightly batch. For more details, see the Oracle Retail Analytics and Planning Integration Implementation Guide.

Generated Option Forecasts/Optimized Sales/Sales Potential from AIF can be interfaced using the custom menu planning actions, directly into relevant workspaces that are pre-configured to get the data through internal web service calls using the standard RPAS web service framework.

The RPAS web service framework uses the configured serviceConfig.json file, which can be used to map the RPAS dimensions/measures that are used in workbook templates against the keys present in web service requests and responses for web services created within RAP; the same web service can be triggered using the custom menu from those templates. For more details about the mapping of serviceConfig.json, see the Service Config Definitions section in the Deployment Tool chapter in the Oracle Retail Predictive Application Server Cloud Edition Configuration Tools User Guide.

On successful connection using a web service call, an Admin task with the name <service_name> from workbook <workbook_name> will be available in OAT. It shows the calls triggered from the template with the details of contents in the web service request and response in JSON format. Sample request and response triggered from the custom menu are provided in the examples below. The same OAT log can be used to debug any issues during the transfer of data using web service calls if the response has any errors due to any issues.

Following are the details of the two configured web services with AIF for the AP GA configuration.

WebService for Optimized History/Option Count

AIF Service Name: /app/rgbuaifpyapwebservice/optioncountinference

AP Service Name: AIFService1

Service Version: dis

The following tables shows the key fields present in the web service request and response, and the corresponding mapped measures in AP GA.

Web Service Request Input Key Mappings

Key/Parameter Data Type GA Intersection Description Mapped Measure
asrtReqId VARCHAR2(250) Dept/Assort Period Assortment Request Id aft1asrtidt
asrtLabel VARCHAR2(250) Dept/Assort Period Assortment Label aft1asrtidl
asrtProdId VARCHAR2(80) Dept/Assort Period

Assortment Parent Product Dimension.

Department Position Id will be used in AP.

aft1prodkeyt
asrtPeriod VARCHAR2(80) Dept/Assort Period Assort Period Dimension Id used in AP aft1asrtlblt
asrtGroupId VARCHAR2(80) Dept/Assort Period Assortment Group Id aft1prdt
attrTypeIdList VARCHAR2(80) Dept/Assort Period List of Eligible Product Attribute Type Id's aft1prdattt
prodList   Dept/Assort Period Collection for List of Product/Store Cluster aft1clusidb
prodId VARCHAR2(80) Subclass/Assort Period/Store Cluster Product Id bwdbprodkeyt
storClusId VARCHAR2(80) Subclass/Assort Period/Store Cluster Store Cluster Id bwdbclusidt
keyStorId VARCHAR2(80) Subclass/Assort Period/Store Cluster One Sample Key Store Id with in Store Cluster against which to receive the data. afdbclusidt
tgtSls NUMBER(20,4) Subclass/Assort Period/Store Cluster Target Sales Units afdbtgtslsu
fcstSls NUMBER(20,4) Subclass/Assort Period/Store Cluster Forecasted Sales Units afdbfcstslsu
histSls NUMBER(20,4) Subclass/Assort Period/Store Cluster Historical Sales Units afdbhistslsu
attrSlsThr NUMBER(20,4) Subclass/Assort Period/Store Cluster Optional Historic Sales Threshold % for Attributes Values to Recommend. afdbattrslsthrp

Web Service Response Output Key Mappings

Key/Parameter Data Type GA Intersection Description Mapped Measure
asrtStgyRecOptHeader   Dept/Assort Period Collection for the Main Request Response Header
responseCode VARCHAR2(80) Dept/Assort Period

Ex:

200 - For Successful Processing of Data

aft1respcodet
responseCodeMessage VARCHAR2(255) Dept/Assort Period Detailed Response Message for Request aft1respcodel
asrtStgyRecOptDetail   Dept/Assort Period Collection for the Main Request Response Details
asrtReqId VARCHAR2(80) Dept/Assort Period Same asrtReqId provided in the input request aft2asrtidt
asrtProdId VARCHAR2(80) Dept/Assort Period Same asrtProdId provided in the input request dept
asrtPeriod VARCHAR2(80) Dept/Assort Period Same asrtPeriod provided in the input request bper
asrtGroupId VARCHAR2(80) Dept/Assort Period Assortment Group Unique Id to link Prod/Assort Period/Store Clusters aft2prdt
prodCnt NUMBER(10,0) Dept/Assort Period Number of SubClass/Store Clusters in the request for the Dept. afdvprdct
prodList   Subclass/Assort Period/Store Cluster Collection for List of Products/Store Cluster
prodId VARCHAR2(80) Subclass/Assort Period/Store Cluster Same product Id provided in the input request scls
storClusId VARCHAR2(80) Subclass/Assort Period/Store Cluster Same Store Cluster Id provided in the input request bwdbclusidt
storId VARCHAR2(80) Subclass/Assort Period/Store Cluster One Store Id with in the Store Cluster stor
optTtlSls NUMBER(20,4) Subclass/Assort Period/Store Cluster Optimized Total Sales aft1optslsu
optTtlCnt NUMBER(20,4) Subclass/Assort Period/Store Cluster Optimized Sales Option Count aft1recoptnct
tgtTtlCnt NUMBER(20,4) Subclass/Assort Period/Store Cluster Target Sales Option Count aft1tgtttlct
histTtlCnt NUMBER(20,4) Subclass/Assort Period/Store Cluster Actual Sales Option Count aft1histttlct
fcstTtlCnt NUMBER(20,4) Subclass/Assort Period/Store Cluster Forecast Sales Option Count aft1fcstttlct
statusCode VARCHAR2(255) Subclass/Assort Period/Store Cluster Status Code to capture any errors at detail level. aft1statcodet
statusMessage VARCHAR2(255) Subclass/Assort Period/Store Cluster Status Message to capture any errors at detail level. aft1statcodel
attrTypeList   Subclass/Assort Period/Store Cluster  
attrTypeId VARCHAR2(80) Subclass/Assort Period/Store Cluster/Attribute Type Collection for Attribute Types patt
attrTypeWgt NUMBER(20,4) Subclass/Assort Period/Store Cluster/Attribute Type Attribute Type Weight calculated in Science for Recommending this Attribute aft1attrtypev
attrList   Subclass/Assort Period/Store Cluster/Attribute Type Collection for Attribute Value List
attrValue VARCHAR2(80) Subclass/Assort Period/Store Cluster/Attribute Value Attribute Value Name aft1attridl
attrId VARCHAR2(80) Subclass/Assort Period/Store Cluster/Attribute Value Attribute Name and "_" and Attribute Value Name. Unique Id used in Planning for Attribute Values. patv
optAttrSls NUMBER(20,4) Subclass/Assort Period/Store Cluster/Attribute Value Optimized Attribute Value Sales Units aft1optattrslsu
optAttrMix NUMBER(20,4) Subclass/Assort Period/Store Cluster/Attribute Value Recommended Attribute Value Mix Percentage aft1optattrmixv

Sample Web Service Request Call

{
    "asrtStgyRecOptHeader": {
        "requestID": "103_ap03_20230507192443",
        "rspVersion": "v1",
        "timeout": 4.0
    },
    "asrtReqId": "103_ap03_20230507192443",
    "asrtLabel": "SPRING SUMMER 2023",
    "asrtProdId": "103",
    "asrtPeriod": "ap03",
    "asrtGroupId": "103_ap03_20230507",
    "attrTypeIdList": [
        "brnd",
        "color",
        "fabric"
     ],
    "prodList": [
        {
            "prodId": "1030101",
            "storClusId": "us_1_52058",
            "keyStorId": "1175",
            "tgtSls": 0,
            "fcstSls": 33592,
            "histSls": 76028,
            "attrSlsThr": 0.0
        },
        {
            "prodId": "1030202",
            "storClusId": "us_1_52058",
            "keyStorId": "1175",
            "tgtSls": 0,
            "fcstSls": 14977,
            "histSls": 29254,
            "attrSlsThr": 0.0
        }
    ]
}

Sample Web Service Response Call

{
    "AsrtStgyRecOptDetail": {
        "asrtGroupId": "103_ap03_20230507",
        "asrtPeriod": "ap03",
        "asrtProdId": "103",
        "asrtReqId": "103_ap03_20230507192443",
        "prodCnt": 2,
        "prodList": [
            {
                "attrTypeList": [
                    {
                        "attrList": [
                            {
                                "attrId": "color_pink",
                                "attrValue": "pink",
                                "optAttrMix": 0.1364,
                                "optAttrSls": 212637.0
                            },
                            {
                                "attrId": "color_purple",
                                "attrValue": "purple",
                                "optAttrMix": 0.0909,
                                "optAttrSls": 7542.0
                            },
                            {
                                "attrId": "color_off_white",
                                "attrValue": "off_white",
                                "optAttrMix": 0.0227,
                                "optAttrSls": 30006.0
                            }
                        ],
                        "attrTypeId": "color",
                        "attrTypeWgt": 0.0168
                    },
                    {
                        "attrList": [
                            {
                                "attrId": "fabric_wool",
                                "attrValue": "wool",
                                "optAttrMix": 0.1364,
                                "optAttrSls": 74618.0
                            },
                            {
                                "attrId": "fabric_polyester",
                                "attrValue": "polyester",
                                "optAttrMix": 0.0682,
                                "optAttrSls": 113571.0
                            },
                            {
                                "attrId": "fabric_organiccotton",
                                "attrValue": "organiccotton",
                                "optAttrMix": 0.2045,
                                "optAttrSls": 334509.0
                            }
                        ],
                        "attrTypeId": "fabric",
                        "attrTypeWgt": 0.126
                    }
                ],
                "fcstTtlCnt": 0.6572,
                "histTtlCnt": 1.4874,
                "keyStorId": "1175",
                "optTtlCnt": 21.9848,
                "optTtlSls": 1123705,
                "prodId": "1030101",
                "statusCode": "",
                "statusMessage": "",
                "storClusId": "us_1_52058",
                "tgtTtlCnt": 0.0
            },
            {
                "attrTypeList": [
                    {
                        "attrList": [
                            {
                                "attrId": "color_white",
                                "attrValue": "white",
                                "optAttrMix": 0.075,
                                "optAttrSls": 4875.0
                            },
                            {
                                "attrId": "color_blue",
                                "attrValue": "blue",
                                "optAttrMix": 0.075,
                                "optAttrSls": 39521.0
                            },
                            {
                                "attrId": "color_maroon",
                                "attrValue": "maroon",
                                "optAttrMix": 0.025,
                                "optAttrSls": 15163.0
                            }
                        ],
                        "attrTypeId": "color",
                        "attrTypeWgt": 0.0338
                    },
                    {
                        "attrList": [
                            {
                                "attrId": "fabric_woolsilk",
                                "attrValue": "woolsilk",
                                "optAttrMix": 0.025,
                                "optAttrSls": 15163.0
                            },
                            {
                                "attrId": "fabric_polyester",
                                "attrValue": "polyester",
                                "optAttrMix": 0.025,
                                "optAttrSls": 16810.0
                            },
                            {
                                "attrId": "fabric_merinowool",
                                "attrValue": "merinowool",
                                "optAttrMix": 0.125,
                                "optAttrSls": 46314.0
                            }
                        ],
                        "attrTypeId": "fabric",
                        "attrTypeWgt": 0.0196
                    }
                ],
                "fcstTtlCnt": 1.4811,
                "histTtlCnt": 2.8931,
                "keyStorId": "1175",
                "optTtlCnt": 39.6602,
                "optTtlSls": 401023,
                "prodId": "1030202",
                "statusCode": "",
                "statusMessage": "",
                "storClusId": "us_1_52058",
                "tgtTtlCnt": 0.0
            }
        ]
    },
    "asrtStgyRecOptHeader": {
        "responseCode": "200",
        "responseCodeMessage": "Assortment Strategy - Key Attributes data returned Successfully"
    }

Web Service for Sales Potential

AIF Service Name: /app/rgbuaifpyapwebservice/salespotential

AP Service Name: AIFService2

Service Version: dis

The following tables shows the key fields present in the web service request and response, and the corresponding mapped measures in AP GA.

Web Service Request Input Key Mappings

Key/Parameter Data Type GA Intersection Description Mapped Measure
asrtReqId VARCHAR2(80) Dept/Assort Period Assortment Request Id aft1asrtidt
asrtProdId VARCHAR2(80) Dept/Assort Period

Assortment Parent Product Dimension.

Department Position Id will be used in AP.

aft1prodkeyt
asrtPeriod VARCHAR2(80) Dept/Assort Period Assort Period Dimension Id used in AP aft1asrtlblt
asrtGroupId VARCHAR2(80) Dept/Assort Period Assortment Group Id aft1prdt
itemLevel VARCHAR2(80) Dept/Assort Period Item Level used in Input - STYL (Style), COLOR (Style-Color) or ITEM (SKU). AP GA will use COLOR for Style-Color aft1asrtitemt
attrTypeIdList VARCHAR2(80) Dept/Assort Period List of Eligible Product Attribute Type Id's aft1prdattt
storClusCnt NUMBER(10,0) Dept/Assort Period Count of Store-Clusters with in product for this request. aft1clusidi
storClusList VARCHAR2(80) Dept/Assort Period Collection for Store Cluster afdbclusidb
storClusId VARCHAR2(80) Dept/Assort Period/Store Cluster Store Cluster Id bwt2clusidt
keyStorId VARCHAR2(80) Dept/Assort Period/Store Cluster One Sample Key Store Id with in Store Cluster against which to receive the data. aft2clusidt
itemCnt NUMBER(10,0) Dept/Assort Period Count of Items (Style-Color) with in the product for this request. afdbstatusct
itemList   Dept/Assort Period   afdbstatusb
itemId VARCHAR2(80) Style-Color/Assort Period Item Identifier bwdvitemidt
prodId VARCHAR2(80) Style-Color/Assort Period Product Id afdvprodkeyt
NewItem VARCHAR2(80) Style-Color/Assort Period Y/N. Flag to tell if item if item is new item. For New Items it's Y else N. afdvphitmt
attrList VARCHAR2(80) Style-Color/Assort Period Attribute List at Style-Color level afdbprdattrb
attrTypeId VARCHAR2(80) Style-Color/Assort Period/Attribute Value Attribute Type Identifier afdvprdattl
attrValueId VARCHAR2(80) Style-Color/Assort Period/Attribute Value Attribute Value Identifier afdvprdattt

Web Service Request Output Key Mappings

Key/Parameter Data Type GA Intersection Description Mapped Measure
asrtFitSlsPHeader   Dept/Assort Period Collection for the Main Request Response Header
responseCode VARCHAR2(80) Dept/Assort Period

Ex:

200 - For Successful Processing of Data

aft2respcodet
responseCodeMessage VARCHAR2(255) Dept/Assort Period Detailed Response Message for Request aft2respcodel
asrtFitSlsPDetail   Dept/Assort Period Collection for the Main Request Response Details
asrtReqId VARCHAR2(80) Dept/Assort Period Same asrtReqId provided in the input request aft2asrtidt
asrtProdId VARCHAR2(80) Dept/Assort Period Same asrtProdId provided in the input request dept
asrtPeriod VARCHAR2(80) Dept/Assort Period Same asrtPeriod provided in the input request bper
asrtGroupId VARCHAR2(80) Dept/Assort Period Assortment Group Unique Id to link Prod/Assort Period/Store Clusters aft2prdt
prodList   Dept/Assort Period Collection for List of Products/Store Cluster
prodId VARCHAR2(80) Subclass/Assort Period/Store Cluster Same product Id provided in the input request scls
storClusId VARCHAR2(80) Subclass/Assort Period/Store Cluster Same Store Cluster Id provided in the input request bwdbclusidt
keyStorId VARCHAR2(80) Subclass/Assort Period/Store Cluster One Store Id from the Store Cluster stor
avgROS NUMBER(20,4) Subclass/Assort Period/Store Cluster Average Rate of Sales aft2rosv
statusCode VARCHAR2(80) Subclass/Assort Period/Store Cluster Status Code aft3statcodet
statusMessage VARCHAR2(255) Subclass/Assort Period/Store Cluster Status Message aft3statcodel
itemList   Style-Color/Assort Period/Store Cluster Collection for Item List
itemId VARCHAR2(80) Subclass/Assort Period/Store Cluster/Attribute Value Same Item/Style-Color Id passed in Input skup
itemASlsP NUMBER(20,4) StyleColor/Assort Period/Store Cluster Average Sales Potential calculated at Item/Style-Color Level aft2itemaslspu
itemMSlsP NUMBER(20,4) StyleColor/Assort Period/Store Cluster Maximum Sales Potential calculated at Item/Style-Color Level aft2itemmslspu
statusCode VARCHAR2(80) StyleColor/Assort Period/Store Cluster Status Code aft2statcodet
statusMessage VARCHAR2(255) StyleColor/Assort Period/Store Cluster Status Message aft2statcodel

Sample Web Service Request Call

{
    "asrtStgyRecOptHeader": {
        "requestID": "103_ap03_20230507025519",
        "rspVersion": "v1",
        "timeout": 4.0
    },
    "asrtReqId": "103_ap03_20230507025519",
    "asrtProdId": "103",
    "asrtPeriod": "ap03",
    "asrtGroupId": "103_ap03_20230507",
    "itemLevel": "COLOR",
    "attrTypeIdList": [
        "brnd",
        "color",
        "fabric"
    ],
    "storClusCnt": 2,
    "itemCnt": 2,
    "storClusList": [
        {
            "storClusId": "us_1_52056",
            "keyStorId": "1117"
        },
        {
            "storClusId": "us_1_52058",
            "keyStorId": "1175"
        }
    ],
    "itemList": [
        {
            "itemId": "1101279",
            "prodId": "1030201",
            "NewItem": "N",
            "attrList": [
                {
                    "attrTypeId": "brnd",
                    "attrValueId": "PrivateLabel"
                },
                {
                    "attrTypeId": "color",
                    "attrValueId": "red"
                },
                {
                    "attrTypeId": "fabric",
                    "attrValueId": "wool"
                }
            ]
        },
        {
            "itemId": "1101282",
            "prodId": "1030201",
            "NewItem": "N",
            "attrList": [
                {
                    "attrTypeId": "brnd",
                    "attrValueId": "PrivateLabel"
                },
                {
                    "attrTypeId": "color",
                    "attrValueId": "green"
                },
                {
                    "attrTypeId": "fabric",
                    "attrValueId": "cotton"
                }
            ]
        }
    ]
}

Sample Web Service Response Call

                        "itemASlsP": 400,
                        "itemMSlsP": 500,
                        “statusCode”: Null,
                        “statusMessage”: Null
                    },
                    {
                       "itemId": "1101282",
                       "itemASlsP": 500,
                       "itemMSlsP": 600,
                       “statusCode”: Null,
                       “statusMessage”: Null
                    }
                ],
                "keyStorId": "1117",
                "prodId": "1030201",
                “statusCode”: Null,
                “statusMessage”: Null,
                "storClusId": "us_1_52056"
            },
            {
                "avgROS": 14000,
                "itemList": [
                    {
                        "itemId": "1101279",
                        "itemASlsP": 500,
                        "itemMSlsP": 600,
                        “statusCode”: Null,
                        “statusMessage”: Null
                    },
                    {
                        "itemId": "1101282",
                        "itemASlsP": 600,
                        "itemMSlsP": 700,
                        “statusCode”: Null,
                        “statusMessage”: Null
                    }
                ],
                "keyStorId": "1175",
                "prodId": "1030201",
                “statusCode”: Null,
                “statusMessage”: Null,
                "storClusId": "us_1_52058"
            }
        ]
    },
    "AsrtFitSlsPHeader": {
        "responseCode": 200,
        "responseCodeMessage": "Assortment Fit - Sales Potential data returned Successfully"
    }
}