Extend the REST-API in different modules?

Jakez
Jakez's picture

Joined: 2004-03-24
Posts: 27
Posted: Sun, 2013-01-13 04:06

Hi gallery team,

I want to extend the gallery3 REST Entity-Array. Therefore I created a new module and extended the item_rest_Core class like this:

class item_rest extends item_rest_Core {

	static function get($request) {
		$result = parent::get($request);

		$result['entity']['foo'] = 'bar';

		return $result;
	}
}

Everything works fine and as expected. The final module can be reviewed here: https://github.com/mrJakez/gallery3-gps_rest

But now I want to extend the REST API in another module with the same pattern, and that causes - of course - in a big problem. Do you have any idea how I can deal with this issue, or is creating just one module the right solution?

Cheers,
Dennis

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Sun, 2013-01-13 04:29
 
Jakez
Jakez's picture

Joined: 2004-03-24
Posts: 27
Posted: Wed, 2013-01-23 06:11

Sorry for that late reply!

Many thanks for the links (especially for the Gallery 3 Developer Handbook!). But to reduce the requests and speed up the remote client, I extended the item_rest_Core now with just one module instead of creating new REST resources.

Anyways - thanks for your answer.

cheers,
Dennis