Magento 2 API helps to create an attribute method that defines a request type. First, you must create a custom attribute for the product or order entity using eav_setup. This attribute will define the request type, such as "new" or "update." After defining the attribute, modify or extend the
Magento 2 API by exposing this attribute through webapi.xml. This ensures it can be read or updated through API calls. By implementing get and set methods for the custom attribute, the request type can be managed seamlessly via API, providing flexibility for external integrations and automating workflows.