» Shipping Rate SDK Documentation

Getting All Shipping Rates

Function: admin_shipping_rates_get_list()

Purpose

The admin_shipping_rates_get_list function retrieves a list of all available shipping rates. This provides an overview of the configured shipping rates, including their conditions, policies, and other relevant attributes.

Parameters

This function does not require any input parameters.

Use Case

Use this function when you need to fetch and display all shipping rates. It is useful for managing and auditing shipping configurations, ensuring that the correct rates are applied, and identifying duplicate or outdated rates.

def admin_shipping_rates_get_list_test():
    SDKConfig.PRINT_REQUEST_DATA = False
    SDKConfig.PRINT_RAW_RESPONSE = False

    webcommander_sdk: WebCommanderSDK = WebCommanderSDK().init_sdk(request_token_dto=CommonData.get_request_token_dto())

    try:
        response = webcommander_sdk.admin_shipping_rates.list()
        print(response)
    except WCException as ab:
        print(ab)
        print(ab.get_errors())
        print(ab.raw_response)

Response

The function returns a ShippingRatesListResponseDTO, which contains a list of ShippingRateDTO objects. Each object includes detailed information about a shipping rate, such as its ID, name, policy type, conditions, and timestamps.

ShippingRatesListResponseDTO(
    shippingRates=[
        ShippingRateDTO(
            id=PLACEHOLDER_ID,
            name="PLACEHOLDER_NAME",
            policyType="PLACEHOLDER_POLICY_TYPE",
            additionalAmount=PLACEHOLDER_ADDITIONAL_AMOUNT,
            additionalCost=PLACEHOLDER_ADDITIONAL_COST,
            isCumulative=PLACEHOLDER_IS_CUMULATIVE,
            includesTax=PLACEHOLDER_INCLUDES_TAX,
            isAdditional=PLACEHOLDER_IS_ADDITIONAL,
            conditions=[
                ShippingConditionDTO(
                    id=PLACEHOLDER_CONDITION_ID,
                    fromAmount=PLACEHOLDER_FROM_AMOUNT,
                    toAmount=PLACEHOLDER_TO_AMOUNT,
                    packetWeight=PLACEHOLDER_PACKET_WEIGHT,
                    handlingCost=PLACEHOLDER_HANDLING_COST,
                    shippingCost=PLACEHOLDER_SHIPPING_COST,
                    shippingCostType="PLACEHOLDER_SHIPPING_COST_TYPE",
                    handlingCostType="PLACEHOLDER_HANDLING_COST_TYPE",
                    apiType="PLACEHOLDER_API_TYPE",
                    apiServiceType="PLACEHOLDER_API_SERVICE_TYPE",
                    extraCover=PLACEHOLDER_EXTRA_COVER,
                    packingAlgorithm="PLACEHOLDER_PACKING_ALGORITHM",
                    itemAttributes="PLACEHOLDER_ITEM_ATTRIBUTES",
                    shippingPolicy=[
                        ShippingPolicyDTO(
                            id=PLACEHOLDER_POLICY_ID
                        )
                    ]
                )
            ],
            createdAt="PLACEHOLDER_CREATED_AT",
            updatedAt="PLACEHOLDER_UPDATED_AT"
        )
    ],
    pagination=PaginationDTO(
        records=PLACEHOLDER_TOTAL_RECORDS,
        limit=PLACEHOLDER_LIMIT,
        offset=PLACEHOLDER_OFFSET,
        nextPage=PLACEHOLDER_NEXT_PAGE,
        previousPage=PLACEHOLDER_PREVIOUS_PAGE
    )
)

Getting Specific Shipping Rates

Functions: admin_shipping_rates_get_details() 

Purpose

The admin_shipping_rates_get_details function retrieves detailed information about a specific shipping rate using its unique identifier. This allows access to the shipping rate's configuration, including its conditions, policies, and metadata.

Parameters

Parameter
Type
Description
id
String
The unique identifier of the product.

Use Case

Use this function when you need to fetch the complete details of a particular shipping rate. It is helpful for inspecting, updating, or validating specific shipping rate configurations in the system.

def admin_shipping_rates_get_details_test():
    SDKConfig.PRINT_REQUEST_DATA = False
    SDKConfig.PRINT_RAW_RESPONSE = False

    webcommander_sdk: WebCommanderSDK = WebCommanderSDK().init_sdk(request_token_dto=CommonData.get_request_token_dto())

    try:
        id = 'PLACEHOLDER_ID'
        response = webcommander_sdk.admin_shipping_rates.details(id=id)
        print(response)
    except WCException as ab:
        print(ab)
        print(ab.get_errors())
        print(ab.raw_response)

Response

The function returns a ShippingRatesDetailsResponseDTO object, which contains a ShippingRateDTO representing the shipping rate's full details, including conditions, policy type, and timestamps.

ShippingRatesDetailsResponseDTO(
    shippingRate=ShippingRateDTO(
        id=PLACEHOLDER_ID,
        name="PLACEHOLDER_NAME",
        policyType="PLACEHOLDER_POLICY_TYPE",
        additionalAmount=PLACEHOLDER_ADDITIONAL_AMOUNT,
        additionalCost=PLACEHOLDER_ADDITIONAL_COST,
        isCumulative=PLACEHOLDER_IS_CUMULATIVE,
        includesTax=PLACEHOLDER_INCLUDES_TAX,
        isAdditional=PLACEHOLDER_IS_ADDITIONAL,
        conditions=[
            ShippingConditionDTO(
                id=PLACEHOLDER_CONDITION_ID,
                fromAmount=PLACEHOLDER_FROM_AMOUNT,
                toAmount=PLACEHOLDER_TO_AMOUNT,
                packetWeight=PLACEHOLDER_PACKET_WEIGHT,
                handlingCost=PLACEHOLDER_HANDLING_COST,
                shippingCost=PLACEHOLDER_SHIPPING_COST,
                shippingCostType="PLACEHOLDER_SHIPPING_COST_TYPE",
                handlingCostType="PLACEHOLDER_HANDLING_COST_TYPE",
                apiType="PLACEHOLDER_API_TYPE",
                apiServiceType="PLACEHOLDER_API_SERVICE_TYPE",
                extraCover=PLACEHOLDER_EXTRA_COVER,
                packingAlgorithm="PLACEHOLDER_PACKING_ALGORITHM",
                itemAttributes="PLACEHOLDER_ITEM_ATTRIBUTES",
                shippingPolicy=[
                    ShippingPolicyDTO(
                        id=PLACEHOLDER_POLICY_ID
                    )
                ]
            )
        ],
        createdAt="PLACEHOLDER_CREATED_AT",
        updatedAt="PLACEHOLDER_UPDATED_AT"
    )
)

Creating Specific Shipping Rates

Functions: admin_create_shipping_rates() 

Purpose

The admin_create_shipping_rates function is used to create a new shipping rate in the system. This includes defining rate properties such as policy type, conditions, tax inclusion, and other parameters.

Parameters

Parameter
Type
Description
name
String
The unique name of the tax profiles.

Use Case

Use this function when you need to add a new shipping rate to your system. It is helpful for setting up shipping costs, handling charges, and defining conditions based on shipping policies.

def admin_create_shipping_rates_test(): 
    SDKConfig.PRINT_REQUEST_DATA = False
    SDKConfig.PRINT_RAW_RESPONSE = False

    webcommander_sdk: WebCommanderSDK = WebCommanderSDK().init_sdk(request_token_dto=CommonData.get_request_token_dto())

    try:
        request_data = ShippingRateRequestDTO(
            shippingRate=ShippingRateDTO(
                name="PLACEHOLDER_NAME",
                policyType="PLACEHOLDER_POLICY_TYPE",
                additionalAmount=PLACEHOLDER_ADDITIONAL_AMOUNT,
                additionalCost=PLACEHOLDER_ADDITIONAL_COST,
                isCumulative=PLACEHOLDER_IS_CUMULATIVE,
                includesTax=PLACEHOLDER_INCLUDES_TAX,
                isAdditional=PLACEHOLDER_IS_ADDITIONAL,
                conditions=[
                    ShippingConditionDTO(
                        id=PLACEHOLDER_CONDITION_ID,
                        fromAmount=PLACEHOLDER_FROM_AMOUNT,
                        toAmount=PLACEHOLDER_TO_AMOUNT,
                        packetWeight=PLACEHOLDER_PACKET_WEIGHT,
                        handlingCost=PLACEHOLDER_HANDLING_COST,
                        shippingCost=PLACEHOLDER_SHIPPING_COST,
                        shippingCostType="PLACEHOLDER_SHIPPING_COST_TYPE",
                        handlingCostType="PLACEHOLDER_HANDLING_COST_TYPE",
                        apiType="PLACEHOLDER_API_TYPE",
                        apiServiceType="PLACEHOLDER_API_SERVICE_TYPE",
                        extraCover=PLACEHOLDER_EXTRA_COVER,
                        packingAlgorithm="PLACEHOLDER_PACKING_ALGORITHM",
                        itemAttributes="PLACEHOLDER_ITEM_ATTRIBUTES",
                        shippingPolicy=[
                            ShippingPolicyDTO(
                                id=PLACEHOLDER_POLICY_ID
                            )
                        ]
                    )
                ]
            )
        )
        response = webcommander_sdk.admin_shipping_rates.create_shipping_rates(request_data=request_data)
        print(response)
    except WCException as ab:
        print(ab)
        print(ab.get_errors())
        print(ab.raw_response)

Response

The function returns a ShippingRatesDetailsResponseDTO object containing the details of the newly created shipping rate, including its ID, name, policy type, and related conditions.

ShippingRatesDetailsResponseDTO(
    shippingRate=ShippingRateDTO(
        id=PLACEHOLDER_ID,
        name="PLACEHOLDER_NAME",
        policyType="PLACEHOLDER_POLICY_TYPE",
        additionalAmount=PLACEHOLDER_ADDITIONAL_AMOUNT,
        additionalCost=PLACEHOLDER_ADDITIONAL_COST,
        isCumulative=PLACEHOLDER_IS_CUMULATIVE,
        includesTax=PLACEHOLDER_INCLUDES_TAX,
        isAdditional=PLACEHOLDER_IS_ADDITIONAL,
        conditions=[
            ShippingConditionDTO(
                id=PLACEHOLDER_CONDITION_ID,
                fromAmount=PLACEHOLDER_FROM_AMOUNT,
                toAmount=PLACEHOLDER_TO_AMOUNT,
                packetWeight=PLACEHOLDER_PACKET_WEIGHT,
                handlingCost=PLACEHOLDER_HANDLING_COST,
                shippingCost=PLACEHOLDER_SHIPPING_COST,
                shippingCostType="PLACEHOLDER_SHIPPING_COST_TYPE",
                handlingCostType="PLACEHOLDER_HANDLING_COST_TYPE",
                apiType="PLACEHOLDER_API_TYPE",
                apiServiceType="PLACEHOLDER_API_SERVICE_TYPE",
                extraCover=PLACEHOLDER_EXTRA_COVER,
                packingAlgorithm="PLACEHOLDER_PACKING_ALGORITHM",
                itemAttributes="PLACEHOLDER_ITEM_ATTRIBUTES",
                shippingPolicy=[
                    ShippingPolicyDTO(
                        id=PLACEHOLDER_POLICY_ID
                    )
                ]
            )
        ],
        createdAt="PLACEHOLDER_CREATED_AT",
        updatedAt="PLACEHOLDER_UPDATED_AT"
    )
)

Updating Specific Shipping Rates

Functions: admin_update_shipping_rates() 

Purpose

The admin_update_shipping_rates function is used to update an existing shipping rate in the system. This allows modifying shipping rate properties such as the name, policy type, conditions, tax settings, and other relevant attributes.

Parameters

Parameter
Type
Description
id
String
The unique identifier of the tax profiles.

Use Case

Use this function when you need to change or correct an existing shipping rate. This is useful for adjusting shipping costs, updating conditions, or modifying policy types without creating a new shipping rate.

def admin_update_shipping_rates_test(): 
    SDKConfig.PRINT_REQUEST_DATA = False
    SDKConfig.PRINT_RAW_RESPONSE = False

    webcommander_sdk: WebCommanderSDK = WebCommanderSDK().init_sdk(request_token_dto=CommonData.get_request_token_dto())

    try:
        request_data = ShippingRateRequestDTO(
            shippingRate=ShippingRateDTO(
                name="PLACEHOLDER_NAME",
                policyType="PLACEHOLDER_POLICY_TYPE",
                additionalAmount=PLACEHOLDER_ADDITIONAL_AMOUNT,
                additionalCost=PLACEHOLDER_ADDITIONAL_COST,
                isCumulative=PLACEHOLDER_IS_CUMULATIVE,
                includesTax=PLACEHOLDER_INCLUDES_TAX,
                isAdditional=PLACEHOLDER_IS_ADDITIONAL,
                conditions=[
                    ShippingConditionDTO(
                        id=PLACEHOLDER_CONDITION_ID,
                        fromAmount=PLACEHOLDER_FROM_AMOUNT,
                        toAmount=PLACEHOLDER_TO_AMOUNT,
                        packetWeight=PLACEHOLDER_PACKET_WEIGHT,
                        handlingCost=PLACEHOLDER_HANDLING_COST,
                        shippingCost=PLACEHOLDER_SHIPPING_COST,
                        shippingCostType="PLACEHOLDER_SHIPPING_COST_TYPE",
                        handlingCostType="PLACEHOLDER_HANDLING_COST_TYPE",
                        apiType="PLACEHOLDER_API_TYPE",
                        apiServiceType="PLACEHOLDER_API_SERVICE_TYPE",
                        extraCover=PLACEHOLDER_EXTRA_COVER,
                        packingAlgorithm="PLACEHOLDER_PACKING_ALGORITHM",
                        itemAttributes="PLACEHOLDER_ITEM_ATTRIBUTES",
                        shippingPolicy=[
                            ShippingPolicyDTO(
                                id=PLACEHOLDER_POLICY_ID
                            )
                        ]
                    )
                ]
            )
        )
        id = "PLACEHOLDER_SHIPPING_RATE_ID"
        response = webcommander_sdk.admin_shipping_rates.update_shipping_rates(id=id, request_data=request_data)
        print(response)
    except WCException as ab:
        print(ab)
        print(ab.get_errors())
        print(ab.raw_response)

Response

The function returns a ShippingRatesDetailsResponseDTO object containing the updated shipping rate details, including the new values for the shipping rate and its conditions.

ShippingRatesDetailsResponseDTO(
    shippingRate=ShippingRateDTO(
        id=PLACEHOLDER_SHIPPING_RATE_ID,
        name="PLACEHOLDER_NAME",
        policyType="PLACEHOLDER_POLICY_TYPE",
        additionalAmount=PLACEHOLDER_ADDITIONAL_AMOUNT,
        additionalCost=PLACEHOLDER_ADDITIONAL_COST,
        isCumulative=PLACEHOLDER_IS_CUMULATIVE,
        includesTax=PLACEHOLDER_INCLUDES_TAX,
        isAdditional=PLACEHOLDER_IS_ADDITIONAL,
        conditions=[
            ShippingConditionDTO(
                id=PLACEHOLDER_CONDITION_ID,
                fromAmount=PLACEHOLDER_FROM_AMOUNT,
                toAmount=PLACEHOLDER_TO_AMOUNT,
                packetWeight=PLACEHOLDER_PACKET_WEIGHT,
                handlingCost=PLACEHOLDER_HANDLING_COST,
                shippingCost=PLACEHOLDER_SHIPPING_COST,
                shippingCostType="PLACEHOLDER_SHIPPING_COST_TYPE",
                handlingCostType="PLACEHOLDER_HANDLING_COST_TYPE",
                apiType="PLACEHOLDER_API_TYPE",
                apiServiceType="PLACEHOLDER_API_SERVICE_TYPE",
                extraCover=PLACEHOLDER_EXTRA_COVER,
                packingAlgorithm="PLACEHOLDER_PACKING_ALGORITHM",
                itemAttributes="PLACEHOLDER_ITEM_ATTRIBUTES",
                shippingPolicy=[
                    ShippingPolicyDTO(
                        id=PLACEHOLDER_POLICY_ID
                    )
                ]
            )
        ],
        createdAt="PLACEHOLDER_CREATED_AT",
        updatedAt="PLACEHOLDER_UPDATED_AT"
    )
)

Deleting a Shipping Rates

Function: admin_shipping_rates_delete()

Purpose

The admin_shipping_rates_delete function is used to delete an existing shipping rate by its unique identifier. This allows removing shipping rates that are no longer required or were created by mistake.

Parameters

ParameterTypeDescription
idstringThe unique identifier of the blog post to be deleted.

Use Case

Use this function when you need to permanently delete a shipping rate from the system. This is useful for cleaning up outdated, incorrect, or unnecessary shipping rates.

def admin_shipping_rates_delete_test(): 
    SDKConfig.PRINT_REQUEST_DATA = False
    SDKConfig.PRINT_RAW_RESPONSE = False

    webcommander_sdk: WebCommanderSDK = WebCommanderSDK().init_sdk(request_token_dto=CommonData.get_request_token_dto())

    try:
        id = "PLACEHOLDER_SHIPPING_RATE_ID"
        response = webcommander_sdk.admin_shipping_rates.shipping_rates_delete(id=id)
        print(response)
    except WCException as ab:
        print(ab)
        print(ab.get_errors())
        print(ab.raw_response)

Response

The function returns a success message confirming that the shipping rate has been deleted.