简体   繁体   中英

t3api extension is returning a 404 page not found TYPO3

I am trying to add custom API-s endpoints to my TYPO3 CMS. Here is the model for my Projects.

namespace Geraldib\PortfolioSite\Domain\Model;

use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
use SourceBroker\T3api\Annotation\ApiResource;

/**
 * @ApiResource(
 *     collectionOperations={
 *          "get"={
 *              "path"="/projects",
 *          },
 *     },
 * )
 */
class Project extends AbstractEntity
{

I have also included this code in my config.yaml

imports:
  - { resource: "EXT:t3api/Configuration/Routing/config.yaml" }

Here is the Response it returns.

在此处输入图像描述

I was expecting a array of all projects to be returned. Should I implement this route in my controller if so because I don't see anything in the docs.

The code Structure在此处输入图像描述

TYPO3 version 11.5 Client side url: http://localhost/Typo3/geraldib-site/public/

The Urls in your screenshot does not correspond to anything common to a TYPO3 installation. (Which TYPO3 version do you use?)

A typical TYPO3 installation would consist on this folder structure:

starting with a installation root which would be something like: /srv/www/htdocs/projectname .
There you have multiple folders with public/ as the folder which represents the web root:
/srv/www/htdocs/projectname/public ( https://mydomain/ )

Up to TYPO3 11 in the web root you have a folder typo3conf/ with a subfolder ext/ where all extensions are stored:
/srv/www/htdocs/projectname/public/typo3conf/ext/ or https://mydomain/typo3conf/ext/

So files of the extension t3api (which could be addresses inside of TYPO3 as ext:t3api/... ) would be accessible as /srv/www/htdocs/projectname/public/typo3conf/ext/t3api/... on server side
or https://mydomain/typo3conf/ext/t3api/... on client side.

Your URLS look like a mix of local and client paths, which probably will fail.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM