在sugarcrm 8.0中定制api

The function of my code is, i want it to capitalize the initial letters of the field firstname and last name when they click the Upper name button.

here's the code:

<?php

class UpperNameApi extends SugarApi
{
    public function registerApiRest()
    {
        return array(
            'UpperNameRequest' => array(
                //request type
                'reqType' => 'GET',

                //endpoint path
                'path' => array('Leads', 'UpperName'),

                //endpoint variables
                'pathVars' => array('module','record'),

                //method to call
                'method' => 'UpperNameMethod',

                //short help string to be displayed in the help documentation
                'shortHelp' => 'Example endpoint',

                //long help to be displayed in the help documentation
                'longHelp' => 'custom/clients/base/api/help/MyEndPoint_MyGetEndPoint_help.html',
            ),
        );
    }

    /**
     * Method to be used for my MyEndpoint/GetExample endpoint
     */
    public function UpperNameMethod($api, $args)
    {
        if (isset($args['record']) && !empty($args['record'])) {
            $bean = BeanFactory::getBean('Leads', $args['record']);

            if (!empty($bean->id)) {
                $first = $bean->first_name;
                $first = ucwords($first);
                $bean->first_name = $first;

                $last = $bean->last_name;
                $last = ucwords($last);
                $bean->last_name = $last;
                $bean->save();
            }

            return 'success';
        }


        return 'failed';

    }

}

When i click the "Upper name button" it doesn't work:

When i click the "Upper name button" it doesn't work:

i also tried using postman but this showed up: "error_message": "Could not find a route with 3 elements"

pic2

UPDATED

ive made another request in postman with this values but it shows: "A parameter in your request was invalid."

pic3

UPDATED AGAIN

PROBLEM FIXED.

The solution for this one was really simple and yet it took me hours to figure out. anyways the answer is the 'reqType' => 'GET' line should be 'reqType' => 'POST'.