假设有一个自定义API来获取giftcode。
API具有引用和 Amount 作为必需参数,而已激活和数量作为可选参数
如果URL为:
http://ruteurl/rest/V1/giftcode/request?reference=XYZ&amount=50
它应该在默认情况下假设已激活且数量为1的情况下运行
如果URL为:
http://ruteurl/rest/V1/giftcode/request?reference=XYZ&amount=50&activated=0&quantity=5
值应为url中提供的值,而不是默认值。
我们如何使用php做到这一点? (我的平台是Magento 2)