0

I am trying to create a index.phtml page to my RESTful Apigility API. Steps i have taken is 1) Create a DB connected API any given it route "account" 2) Access the account API on /account with postman and got HAL and JSON to response to work 3) Create a new "Selector" under content negotiation with 3 view models. "ZF\ContentNegotiation\ViewModel", "ZF\Hal\View\HalJsonModel" and "Zend\View\Model\ViewModel" 4) Selected the newly created selector in the accounts API 5) Created a index.phtml under Account/view/index.phtml with code "

Test

" 6) Added
'view_manager' => array(
        'template_path_stack' => array(
            'account' => __DIR__ . '/../view',
        ),
    ),

to module.config.php

7) Using postman and accessed /account with Accept application/json // works Accept text/html // don't work

Would be great if someone could lend a hand to get a index.phtml template to work with a restful DB connect API

Fred
  • 11
  • 2

1 Answers1

0

If you want to use ViewModel you should choose RPC API. You can create RPC API with following this documentation

https://apigility.org/documentation/intro/getting-started#create-an-rpc-service

Dolly Aswin
  • 2,684
  • 1
  • 20
  • 23
  • Thanks Dolly. What i am trying to achieve is to create a ViewModel that i can use for a SPA (Singel Page Application) with my REST based API, similar to what the admin ui is based upon. – Fred Sep 04 '15 at 09:04