Taking Lucas's suggestion of using restws, I have configured the path in the module as such:
function mymodule_restws_resource_info() { return array( 'mymodule_person' => array( 'label' => t('Person'), 'class' => 'PersonResourceController', 'menu_path' => 'api/person', ), ); }
That part seems to work, because when I send a POST transaction via Advanced Rest Client in chrome, I get a 200 response (I get a 404 if I change the request url).
That said, in the module I also throw an error if attempting an update, delete or read. When I send any of those, I still get a 200 response.
Any of GET, POST, PUT or UPDATE gives me
Response does not contain any data
including the create method in the resource controller, so it's not firing.
Do I need to do something to invoke it beyond hitting the api/person with a post payload?
Let's test if the module works. Can you simply hit /node/1.json from the browser? That should render up a json copy of the first node.
Is person a node content type, a new entity type or the user entity? If it is node or user, then restws already supports those out of the box. All you have to do (for a GET) is append .json on the request. Also, make the user that you connect with has appropriate permissions. If you use basic authentication, that means crafting a BA header that includes the base64 encoded REST application id and password and passing it along with the request.
Another helpful feature I've used with restws; I run advanced rest client through xdebug. All that is necessary for that is to add the xdebug cookie to the headers. Then put a break point and step through the code.
Cookie: XDEBUG_SESSION=%idekey%
node/1.json from the browser yields:
The requested page "/node/1.json" could not be found
On Thu, Dec 12, 2013 at 8:33 AM, Lucas Hedding lucashedding@gmail.comwrote:
Let's test if the module works. Can you simply hit /node/1.json from the browser? That should render up a json copy of the first node.
Is person a node content type, a new entity type or the user entity? If it is node or user, then restws already supports those out of the box. All you have to do (for a GET) is append .json on the request. Also, make the user that you connect with has appropriate permissions. If you use basic authentication, that means crafting a BA header that includes the base64 encoded REST application id and password and passing it along with the request.
Another helpful feature I've used with restws; I run advanced rest client through xdebug. All that is necessary for that is to add the xdebug cookie to the headers. Then put a break point and step through the code.
Cookie: XDEBUG_SESSION=%idekey%
-- [ Drupal support list | http://lists.drupal.org/ ]
Ah, there was no node 1. More interesting, with the module enabled, when I just do a node/x, not even node/x.json, I get the url with the alias (same when I do node/x.json), which means I'm reaching the node, but the page is blank. When I disable the module, the page shows.
On Thu, Dec 12, 2013 at 9:11 AM, Jeff Greenberg < listmail.ayendesigns@gmail.com> wrote:
node/1.json from the browser yields:
The requested page "/node/1.json" could not be found
On Thu, Dec 12, 2013 at 8:33 AM, Lucas Hedding lucashedding@gmail.comwrote:
Let's test if the module works. Can you simply hit /node/1.json from the browser? That should render up a json copy of the first node.
Is person a node content type, a new entity type or the user entity? If it is node or user, then restws already supports those out of the box. All you have to do (for a GET) is append .json on the request. Also, make the user that you connect with has appropriate permissions. If you use basic authentication, that means crafting a BA header that includes the base64 encoded REST application id and password and passing it along with the request.
Another helpful feature I've used with restws; I run advanced rest client through xdebug. All that is necessary for that is to add the xdebug cookie to the headers. Then put a break point and step through the code.
Cookie: XDEBUG_SESSION=%idekey%
-- [ Drupal support list | http://lists.drupal.org/ ]
--
drupal.org/user/367108 linkedin.com/in/jeffrgreenberg accidentalcoder.com / ayendesigns.com @accidentalcoder
The white screen seems to be related to node_page_view, and that seems to be a result of a conflict with workflow_moderation ( https://drupal.org/node/1838640). I tried the latest dev version of workflow_moderation and it doesn't fix the issue. :(
On Thu, Dec 12, 2013 at 9:30 AM, Jeff Greenberg < listmail.ayendesigns@gmail.com> wrote:
Ah, there was no node 1. More interesting, with the module enabled, when I just do a node/x, not even node/x.json, I get the url with the alias (same when I do node/x.json), which means I'm reaching the node, but the page is blank. When I disable the module, the page shows.
On Thu, Dec 12, 2013 at 9:11 AM, Jeff Greenberg < listmail.ayendesigns@gmail.com> wrote:
node/1.json from the browser yields:
The requested page "/node/1.json" could not be found
On Thu, Dec 12, 2013 at 8:33 AM, Lucas Hedding lucashedding@gmail.comwrote:
Let's test if the module works. Can you simply hit /node/1.json from the browser? That should render up a json copy of the first node.
Is person a node content type, a new entity type or the user entity? If it is node or user, then restws already supports those out of the box. All you have to do (for a GET) is append .json on the request. Also, make the user that you connect with has appropriate permissions. If you use basic authentication, that means crafting a BA header that includes the base64 encoded REST application id and password and passing it along with the request.
Another helpful feature I've used with restws; I run advanced rest client through xdebug. All that is necessary for that is to add the xdebug cookie to the headers. Then put a break point and step through the code.
Cookie: XDEBUG_SESSION=%idekey%
-- [ Drupal support list | http://lists.drupal.org/ ]
--
drupal.org/user/367108 linkedin.com/in/jeffrgreenberg accidentalcoder.com / ayendesigns.com @accidentalcoder
--
drupal.org/user/367108 linkedin.com/in/jeffrgreenberg accidentalcoder.com / ayendesigns.com @accidentalcoder