Skip to content

Can't create or update #123

@victorsferreira

Description

@victorsferreira

I followed the steps in the documentation to create a Clients collection and although I can read the collection and its items (/clients and /clients/:id) I can't POST or PUT to it.

It gives me a generic error:

DataException in DataObject.php line 66:
An error with the provided data occured.

Going to that line and printing the $errorBag variable I get this:

object(NilPortugues\Api\JsonApi\Server\Errors\ErrorBag)#194 (2) { ["errors":protected]=> array(1) { [0]=> object(NilPortugues\Api\JsonApi\Server\Errors\InvalidTypeError)#210 (8) { ["id":protected]=> NULL ["links":protected]=> array(0) { } ["status":protected]=> NULL ["code":protected]=> string(22) "resource_not_supported" ["title":protected]=> string(18) "Unsupported Action" ["detail":protected]=> string(38) "Resource type clients not supported." ["source":protected]=> array(1) { ["pointer"]=> string(5) "/data" } ["meta":protected]=> NULL } } ["httpCode":protected]=> NULL }

So it says "Unsupported Action" and "Resource type clients not supported.", what am I missing?

So I probably did something wrong or skipped a step in the configuration of the api.

Anyone knows what happened?

Extra info

at DataObject::assertPost(array('type' => 'clients', 'attributes' => array('cpf' => '123', 'email' => '123', 'name' => '123', 'created_at' => '2017-06-05 05:34:50', 'updated_at' => '2017-06-05 05:34:50', 'deleted_at' => '2017-06-02 04:54:30')), object(JsonApiSerializer), 'App\Model\Database\Clients', object(ErrorBag)) in CreateResource.php line 58

I'm using Axios to send a request from a react spa. I configured CORS and I'm already getting things from the server.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions