1

Calling this http://localhost/XXX/rest/V1/XXX/uid/2

and My Model Code is

/**
     * Returns greeting message to user
     *
     * @api
     * @param int $uid User Id.
     * @return string Greeting message with users name.
     */

    public function test($uid)
    {
return $uid;
}

and My Interface like

/**
     * Returns greeting message to user
     *
     * @api
     * @param int $uid.
     * @return string Greeting message with users name.
     */
    public function test($uid);

In webApi.xml

 <route url="/V1/XXX/uid/:id" method="GET">
            <service class="XXX\XXX\Api\XApiInterface" method="XXX"/>
            <resources>
                <resource ref="anonymous"/>
            </resources>
        </route> 
3

You have to changes parameter url="/V1/XXX/uid/:id" to url="/V1/XXX/uid/:uid" as, your parameters name is uid at test($uid)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.