I created web api and trying to validate entered data ":postcode".
Here is code in etc/webapi.xml
<?xml version="1.0"?> <routes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Webapi:etc/webapi.xsd"> <route url="/V1/postcode/check/:postcode" method="GET"> <service class="Modules\ShippingMethod\Api\Data\PostcodeInterface" method="check"/> <resources> <resource ref="anonymous"/> </resources> </route> </routes> When I send
curl http://site.dev/rest/default/V1/postcode/check/0003 the var_dump() inside "check" method gives me an integer value "3", but I need to get full variable with all zero symbols and, maybe, specify string type for it. How can I specify variable type or get full request variable?