ng-admin-postgrest icon indicating copy to clipboard operation
ng-admin-postgrest copied to clipboard

HTTP 405 when editing entities

Open nicolov opened this issue 8 years ago • 2 comments

Thanks for the great job, ng-admin is very slick.

In any case, I've set-up ng-admin 0.7.0 with postgrest 0.2.11.1 according to this demo repo. Creating new entities works fine, but editing existing ones fails with:

Oops, an error occured : (code: 405) You must speficy all and only primary keys as params

My table schema:

 Column |  Type   |                       Modifiers                       
--------+---------+-------------------------------------------------------
 id     | integer | not null default nextval('customer_id_seq'::regclass)
 name   | text    | 

My ng-admin config snippet:

        var customer = nga.entity('customer');

        app.addEntity(customer);

        customer.listView()
            .perPage(10)
            .fields([
                nga.field('id'),
                nga.field('name')
            ])
            .listActions(['edit', 'show']);

        customer.showView()
            .fields([
                nga.field('id'),
                nga.field('name')
            ]);

        customer.creationView()
            .fields([
                nga.field('name')
            ]);

        customer.editionView()
            .fields(customer.creationView().fields());

nicolov avatar Sep 14 '15 03:09 nicolov

ping @brikou

fzaninotto avatar Sep 14 '15 08:09 fzaninotto

Changing the code from using the PUT verb to PATCH will fix the problem. In fact puts are no longer supported in v3 because their benefit vs code complexity isn't high enough.

begriffs avatar Feb 02 '16 20:02 begriffs