How to include a new field on the Shipment API in Magento2

Create a new field on the sales shipment table using the db-schema.xml file Then add the newfield on the extension attributes file app/code/JJ/DocumentNumber/etc extension_attributes.xml <config xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xsi:noNamespaceSchemaLocation=”urn:magento:framework/Extension/etc/extension_attributes.xsd”> <extension_attributes for=”MagentoSalesApiDataShipmentCreationArgumentsInterface”> <attribute code=”document_number” type=”string”/> </extension_attributes> </config> For saving the field di.xml <config xsi:noNamespaceSchemaLocation=”urn:magento:framework/ObjectManager/etc/config.xsd”> <type name=”MagentoSalesApiShipmentRepositoryInterface”> <plugin name=”custom_shipment_repository_plugin” type=”JJDocumentNumberPluginShipmentRepositoryPlugin”/> </type> </config> ShipmentRepositoryPlugin.php <?php namespace JJDocumentNumberPlugin; use MagentoSalesApiDataShipmentExtensionFactory; use MagentoSalesApiDataShipmentInterface; use MagentoSalesApiShipmentRepositoryInterface; class ShipmentRepositoryPlugin… Continue reading How to include a new field on the Shipment API in Magento2

API to update the inventory to Magento without manging stock

Here we’re having a REST API which is used to update the inventory from any external Source of integrationHere we have considered NetSuite API: https://example.com/rest/default/V1/inventory/stocks/{stockId} body { “stock”: { “stock_id”: 0, “name”: “string”, “extension_attributes”: {} } } Response Example

error code: INVALID_REQUEST error message: The request could not be understood by the server due to malformed syntax. Magento Error

This error is caused due to the signature method error or auth expired from the auth method provided, Recently we have noticed that the hmac_sha1 signature method has expired for some of the projects. it can be resolved by modifying the signature method to hmac_sha256 replace the ouath_signature_method to hmac_sha256. the error will be reolved

Magento REST API Search Criteria

Search criterias can be added to GET request API to get required data from magento. The basic pattern for specifying the criteria is: searchCriteria[filter_groups][][filters][][field]=<field_name> searchCriteria[filter_groups][][filters][][value]=<search_value> searchCriteria[filter_groups][][filters][][condition_type]=<operator> where: field is an attribute name. value specifies the value to search for. condition_type is one of the following values: CONDITION NOTES eq Equal finset A value within a… Continue reading Magento REST API Search Criteria