I the get error response {"error":"not_found","error_message":"Could not find record: at_risk in module: Accounts"} no matter if I add the varible in the call or not. It say's I can add wild cards. Am I doing it wrong?

This is what it looks like;

class AtRiskApi extends SugarApi{ // This function is only called whenever the rest service cache file is deleted. // This shoud return an array of arrays that define how different paths map to different functions public function registerApiRest() { return array( 'getAtRisk' => array( // What type of HTTP request to match against, we support GET/PUT/POST/DELETE 'reqType' => 'GET', // This is the path you are hoping to match, it also accepts wildcards of ? and <module> 'path' => array('Accounts', 'at_risk','?'), // These take elements from the path and use them to populate $args 'pathVars' => array('Accounts', 'at_risk', 'model_id'), // This is the method name in this class that the url maps to 'method' => 'getAtRisk', // The shortHelp is vital, without it you will not see your endpoint in the /help 'shortHelp' => 'Lists at risk accounts in the system', // The longHelp points to an HTML file and will be there on /help for people to expand and show 'longHelp' => '', ), ); } function getAtRisk($api, $args) { //return $args['model_id']; return 'hej'; }}

Did you do a Quick Repair/Rebuild? If not your API is not registered and there are a couple of APIs that start Accounts/:record so it may be thinking you're trying one of those and passing "at_risk" as the record.

Also, my understanding is that the variables are just for "the variables".... those items in your call that change depending on what you want. So I would do: