Skip to content

Custom tracking link attribute in shipment track is not getting update from the shipment creation rest api magento 2

i have created custom column tracking_link in sales_shipment_track table in magento 2

i want to update tracking link to the track details which i am pushing through create shipment of an order with the following.

mydomain.net/rest/V1/order/{{orderid}}/ship

{
    "items": [
        {
            "order_item_id": 63364,
            "qty": 1
        }
    ],
    "notify": true,
    "tracks": [
        {
            "carrier_code": "custom",
            "extension_attributes": {
                "tracking_link": "www.mylink.com"
            },
            "title": "Custom",
            "track_number": "1Y-9876543210"
        }
    ]
}

and i added this extension attribute in extension_attributes.xml in magento 2 in my module

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Api/etc/extension_attributes.xsd">
    <extension_attributes for="MagentoSalesApiDataShipmentTrackCreationInterface">
        <attribute code="tracking_link" type="string"/>
    </extension_attributes>
</config>

and i am getting following error in my log file.

main.CRITICAL: Report ID: webapi-62b457fa157f8; Message: Property "TrackingLink" does not have accessor method "getTrackingLink" in class "MagentoSalesApiDataShipmentTrackCreationExtensionInterface". {"exception":"[object] (Exception(code: 0): Report ID: webapi-62b457fa157f8; Message: Property "TrackingLink" does not have accessor method "getTrackingLink" in class "Magento\Sales\Api\Data\ShipmentTrackCreationExtensionInterface". at /vendor/magento/framework/Webapi/ErrorProcessor.php:208, LogicException(code: 0): Property "TrackingLink" does not have accessor method "getTrackingLink" in class "Magento\Sales\Api\Data\ShipmentTrackCreationExtensionInterface". at /vendor/magento/framework/Reflection/NameFinder.php:103)"} []

please help me if i missed anything.