New Entity Not Found

I'm a bit stumped by why this isn't working.

I have an addon that has a Tygh/Api/Entities directory with a file named McbProducts.php

I have the 4 methods (index, create, update and delete) defined as well as a privileges method that returns an array of true for each method (will change to the priviliges for the specific addon later but I've also tried it with the manage_* privilege info from the addon).

Note that the $api_user_email is a root admin and does not belong to any usergroups.

However, when I

$result = HTTP:/post("site.com/api/mcbproducts", $json_data, headers['basic_auth]=>$api_user_emai:$api_key, 'header' => "Content-Type: application/json");

$result always returns result:{"message":"Not Found: The Entity mcbproducts not found","status":404}

Without the privileges function, it returns not found but it's due to unauthorized. So to me, that would imply that the mehod is in fact found and is returning appropriate privileges.

If I add code to the abstract AEntity class for isAuthorized() to log the privileges, it is never called.

There must be a simple answer. The actual Entity class is below: The api_int_log() functions are defined and never generate any output indicating that none of the methods are called.

<?php
/*
 * Copyright 2019 1st Source IT, LLC, EZ Merchant Solutions
 * All rights reserved
 * 
 * Permission to use on a single licensed domain.
 */
namespace Tygh\Api\Entities;

use Tygh\Api\AEntity;
use Tygh\Api\Response;
use Tygh\Registry;

class McbProducts extends AEntity
{
public function index($id = ‘’, $params = array())
{
api_int_log(METHOD.“: id=$id, params:”.print_r($params,true));
return array(
‘status’ => Response::STATUS_OK,
‘data’ => “McbProducts: GET not supported”

    );
}

public function create($params)
{

api_int_log(METHOD.“: params:”.print_r($params,true));
return array(
‘status’ => Response::STATUS_CREATED,
‘data’ => “params:$params”
);
}

public function update($id, $params)
{

api_int_log(METHOD.“: id=$id, params:”.print_r($params,true));
return array(
‘status’ => Response::STATUS_OK,
‘data’ => “McbProducts: PUT not supported”
);
}

public function delete($id)
{

api_int_log(METHOD.“: id=$id”);
return array(
‘status’ => Response::STATUS_NO_CONTENT,
‘data’ => “McbProducts: DELETE not supported”

    );
}

Public function privileges() {

api_int_log(METHOD.“: called”);
return array(
‘create’ => true,
‘update’ => true,
‘delete’ => true,
‘index’ => true
);
}
}

?>

Please try (use underscore in the object name)

$result = HTTP:/post("site.com/api/mcb_products", $json_data, headers['basic_auth]=>$api_user_emai:$api_key, 'header' => "Content-Type: application/json");

Hmm, I had tried it with class/filename of McpProducts and Mcbproducts using 'mcbproducts' as the rest entity. But your change seems to work for McbProducts.

Thanks, I knew it must be something simple.

You are welcome! )