How do I configure Drupal restws and format a create request

479 views Asked by At

I have configured the path in the module:

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 url with a post payload?

1

There are 1 answers

0
JAyenGreen On

The problem seems to revolve around the workflow_moderation module being in the mix. If I enable restws and attempt just to hit node/1.json, I get a white screen and an error in the logs. It seems to be a known issue at this point that workflow_moderation is not including the correct parms when it passes the node on. https://drupal.org/node/1238040