Exteded Api Not Works

Hello Community,

Happy New Year 2016 .

Ref: http://docs.cs-cart.com/4.2.x/addons/api_extending.htm

i'm try extending Api using this link: but its not work .

step one : as in document i created a app/Tygh/Addons/Tygh/Api/Entities/Things.php

step 2: Write this code:

namespace Tygh\Api\Entities;
use Tygh\Api\AEntity;
use Tygh\Api\Response;
class Things extends AEntity
{
public function index($id = '', $params = array())
{
return array(
'status' => Response::STATUS_OK,
'data' => array('name' => 'vivek')
);
}
public function create($params)
{
return array(
'status' => Response::STATUS_CREATED,
'data' => array('name' => 'vivek_gupta')
);
}
public function update($id, $params)
{
return array(
'status' => Response::STATUS_OK,
'data' => array('name' => 'gupta')
);
}
public function delete($id)
{
return array(
'status' => Response::STATUS_NO_CONTENT,
);
}
}
?>
Step-3: calling with
try {
$Entity = "Things";
$Response = $cscartapi->get($Entity, $params);
print_r($Response);
} catch (Exception $e) {
print $e->getMessage();
}

Please help me , how we can extend Api with custom entities.

Reference Link is: http://docs.cs-cart.com/4.2.x/addons/api_extending.html

You create the Tygh path in the add-on directory. I.e. app/addons/my_changes/Tygh/…

Posted Today, 12:50 PM#3

You create the Tygh path in the add-on directory. I.e. app/addons/my_changes/Tygh/....
EZ Merchant Solutions: Custom B2B Development, Consulting, Development and Special Projects (get a quote).
Commercial addons and modifications to meet your business and operations needs.
  • 0
  • rep_up.png
  • rep_down.png

Thanks "tbirnseth"

i tried with making /app/addons/my_changes/app/Tygh/Api/Entities/Things.php but its not works .

i getting this response "Not Found: The Entity Things not found".

Please suggest how to done it .

Thanks

I've not extended the API. I simply read the first few lines of the documentation to correct your location since what you had definitely wouldn't be right.

The issue should be examined directly on your server. If you are interested, please pm me temporary FTP access

Thanks Ecom, :)

Whenever i feel some trouble definitely i will PM.

Thanks "tbirnseth"

i tried with making /app/addons/my_changes/app/Tygh/Api/Entities/Things.php but its not works .

i getting this response "Not Found: The Entity Things not found".

Please suggest how to done it .

Thanks

Hello,

Looks like you're trying to use "/app/addons/my_changes/app/Tygh/Api/Entities/Things.php" path instead of the correct "/app/addons/my_changes/Tygh/Api/Entities/Things.php".

Hello,

Looks like you're trying to use "/app/addons/my_changes/app/Tygh/Api/Entities/Things.php" path instead of the correct "/app/addons/my_changes/Tygh/Api/Entities/Things.php".

Thanks abolshakov :)

i'll try it once more.

Sorry , I tried it , but its not work for me. :D

Enable(Active) the my_changes ondons for admin panel

Enable(Active) the my_changes addon in admin panel.