Skip to content

Item Operations "Not Found" error #1044

@abengtson

Description

@abengtson

I am having issues with my item operations for my endpoints. I am assuming it's not picking up the {id} in the path.

resources.yaml

App\Entity\Agent:
    collectionOperations:
        post:
            method: 'POST'
            path: '/agent'
            validation_groups: ['Default','postValidation']
            controller: 'App\Controller\CreateAgent'
    itemOperations:
        put:
            method: 'PUT'
            path: '/agent/{id}/update'
            validation_groups: ['Default']
            controller: 'App\Controller\UpdateAgent'
        get:
            method: 'GET'
            path: '/agent/{id}/client-information'
            controller: 'App\Controller\GetClientInformation'
            normalization_context:
                groups: ['clientInformationResults']

controller for one of the endpoints:

namespace App\Controller;


use App\Entity\Agent;

class GetClientInformation
{
    /**
     * @param Agent $data
     * @return Agent
     */
    public function __invoke(Agent $data): Agent
    {
        return $data;
    }
}

Error

@context": "/contexts/Error",
    "@type": "hydra:Error",
    "hydra:title": "An error occurred",
    "hydra:description": "Not Found",
    "trace": [
        {
            "namespace": "",
            "short_class": "",
            "class": "",
            "type": "",
            "function": "",
            "file": "/app/vendor/api-platform/core/src/EventListener/ReadListener.php",
            "line": 107,
            "args": []
        },
        ...........

I am assuming I am missing something in my configs but I can't find any examples of this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions