APIを使用してソーシング用にカスタム属性を作成する

createCustomAttribute API を使用することで、さまざまなタイプのカスタム属性を作成することができます。 ソーシング目的でカスタム属性を作成した後、それを関連付ける有望なルールを定義することができます。 その後、購入前の履行計算の際にこのルールが考慮されます。

始める前に

手順

  1. createCustomAttribute APIを開きます。
  2. 新しいカスタム属性を定義し、その使用目的を指定します。
    例えば、ソーシング目的で 3p.channel という新しいソーシング属性を定義することができます
    POST https://api.watsoncommerce.ibm.com/configuration/{tenant}/v1/attributes/3p.channel
    {
      "isEnabled": true,
      "datatype": "string",
      "businessPurposes": [ "sourcing" ]
    }
  3. このカスタム属性用の新しいソーシングルールを作成します。
    例えば、 3p.channelnode1-node3 のみを考慮するように、新しいソーシングルールを定義することができます。 Y.
    POST https://api.watsoncommerce.ibm.com/promising/{tenant}/v1/sourcing/rules
    {
      "isEnabled": true,
      "name": "3p.channel sourcing node restriction",
      "desc": "Only allow certain nodes when 3p.channel is Y",
      "effectiveDate": { "from": "2020-01-01T00:00:00Z", "to": "2030-01-01T00:00:00Z" },
      "expr": {
        "and": [
          { "3p.channel": { "eq": "Y" } },
        ]
      },
      "action": {
        "locationRestrictions": {
          "node": {
            "operator": "in",
            "value": [ "node1", "node2", "node3" ]
          }
        }
      }
    }
  4. 有限容量ウィンドウ(EDD)を使用してアイテムの配送またはピックアップ日を計算する APIと有限容量ウィンドウ(チェックアウト割り当て)を使用して購入前の出荷割り当てを計算する APIを開き、 3p.channelsourcing criteria 次の例に示すように:
    POST https://api.watsoncommerce.ibm.com/promising/{tenantId}/v2/edd
    {
      "deliveryMethod": "SHP",
      "capacityUomToConsider": "UNITS",
      "shippingGroupId": "Free_Economy",
      "sourcingCriteria": { "3p.channel": "Y" },
      "destination": { "format": "ADDRESS", "value": { "countryCode": "US", "postalCode": "02144" } },
      "capacityCategoriesToConsider": { "categoryIds": [ "STANDARD_PRODUCT_CAPACITY" ] },
      "itemInfo": { "itemId": "LARGE_TV", "unitOfMeasure": "EACH", "productClass": "NEW" }
    }
    POST https://api.watsoncommerce.ibm.com/promising/{tenantId}/v2/calculateCheckoutAssignments
    {
      "deliveryMethod": "SHP",
      "capacityUomToConsider": "UNITS",
      "shippingGroupId": "Free_Economy",
      "sourcingCriteria": { "3p.channel": "Y" },
      "destination": { "format": "ADDRESS", "value": { "countryCode": "US", "postalCode": "02144" } },
      "cartLines": [
        {
          "lineNo": 1,
           "quantity": 1, "itemInfo": { "itemId": "LARGE_TV", "unitOfMeasure": "EACH", "productClass": "NEW" },
          "sourcingCriteria": { "3p.channel": "N" },
          "capacityCategoriesToConsider": { "categoryIds": [ "STANDARD_PRODUCT_CAPACITY" ] },
        },
    	{
          "lineNo": 2,
          "quantity": 2, "itemInfo": { "itemId": "FLOWERS", "unitOfMeasure": "EACH", "productClass": "NEW" },
          "sourcingCriteria": { "3p.channel": "Y" },
          "capacityCategoriesToConsider": { "categoryIds": [ "STANDARD_PRODUCT_CAPACITY" ] },
        }
      ]
    }
    Checkout assignments APIの場合、 3p.channel がNに設定されているため、1行目はルールを考慮しませんが、2行目はルールを考慮します。 2行目については、 sourcingCriteria は注文レベルで 「Y」 とすでに定義されているため、空白のままにしておくことができます。