I get this error when posting
POST works fine:{"errors":[{"title":"Resource not found","code":404}]}
But I guess that webservices calls some view, after the data has been POSTed?* Trying 260793b2:e42c::2667...
* TCP_NODELAY set
* connect to nnnn:nnn:nnnn:nnn port 443 failed: Connection refused
* Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (nn.nn.nn.nn) port 443 (#0)
* ALPN, offering http/1.1
* SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256
* ALPN, server did not agree to a protocol
* Server certificate:
* subject: CN=*.cloudaccess.host
* start date: Dec 14 00:00:00 2022 GMT
* expire date: Nov 22 23:59:59 2023 GMT
* subjectAltName: host "localhost" matched cert's "*.cloudaccess.host"
* issuer: C=US; O=DigiCert, Inc.; CN=RapidSSL Global TLS RSA4096 SHA256 2022 CA1
* SSL certificate verify ok.
> POST /api/index.php/v1/volbilling/staging HTTP/1.1
Host: localhost
Accept: application/vnd.api+json
X-Joomla-Token: secretkey
Content-Length: 839
Content-Type: application/x-www-form-urlencoded
* upload completely sent off: 839 out of 839 bytes
As I can read later in the call:
But how do I trace the code?< HTTP/1.1 404 Not Found
< Date: Thu, 25 May 2023 15:38:08 GMT
< Server: Apache
< x-frame-options: SAMEORIGIN
< referrer-policy: strict-origin-when-cross-origin
< cross-origin-opener-policy: same-origin
< Server-Timing: 0Load;dur=65.783978;desc="Load", 1Initialise;dur=559.205055;desc="Initialise", 6ApiRoute;dur=280.481100;desc="ApiRoute", Modules;dur=0;desc="Modules", Access;dur=1.5201568603516;desc="Access"
< X-Powered-By: JoomlaAPI/1.0
< Expires: Wed, 17 Aug 2005 00:00:00 GMT
< Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
< Pragma: no-cache
< Last-Modified: Thu, 25 May 2023 15:38:10 GMT
< Transfer-Encoding: chunked
< Content-Type: application/vnd.api+json; charset=utf-8
<
* Connection #0 to host spictera.cloudaccess.host left intact
{"errors":[{"title":"Resource not found","code":404}]}
I can't find what is missing?
Here is the api/src/Controller/StagingController.php
Code: Select all
<?php
namespace Spictera\Component\Volbilling\Api\Controller;
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\MVC\Model\ListModel;
use Joomla\CMS\MVC\Controller\ApiController;
use Joomla\Component\Fields\Administrator\Helper\FieldsHelper;
use Spictera\Component\VolBilling\Administrator\Helper\volbillingHelper;
use Spictera\Component\VolBilling\Administrator\Model\CustomerrolesModel;
use Spictera\Component\VolBilling\Administrator\Model\PartnerrolesModel;
class StagingController extends ApiController
{
protected $contentType = 'staging';
protected $default_view = 'staging';
public function displayList()
{
/*
$apiFilterInfo = $this->input->get('filter', [], 'array');
$filter = InputFilter::getInstance();
if(\array_key_exists("cutsomer", $apiFilterInfo))
{
$this->modelState->set('filter.customer_id', $filter->clean($apiFilterInfo['customer_id'],'INT'));
}
$apiListInfo = $this->input->get('list',[],'array');
if(array_key_exists('ordering',$apiListInfo))
{
$this->modelState->set('list.ordering', $filter->clean($apiListInfo['ordering'], 'STRING'));
}
if(array_key_exists('direction', $apiListIndo))
{
$this->modelState->set('list.direction', $filter-<clean($apiListInfo['direction'], 'STRING'));
}
*/
return parent::displayList();
}
...
api/src/View/Staging/JsonapiView.php
Code: Select all
<?php
namespace Spictera\Component\Volbilling\Api\View\Staging;
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\MVC\View\JsonApiView as BaseApiView;
use Joomla\Component\Fields\Administrator\Helper\FieldsHelper;
class JsonapiView extends BaseApiView
{
protected $fieldsToRenderItem = ['id', 'alias', 'name', 'catid'];
protected $fieldsToRenderList = ['id', 'alias', 'name', 'catid'];
public function displayList(array $items = null)
{
foreach (FieldsHelper::getFields('com_volbilling.staging') as $field)
{
$this->fieldsToRenderList[] = $field->id;
}
$mailer = Factory::getMailer();
$user = Factory::getUser();
$recipient = $user->email;
$mailer->addRecipient($recipient);
$body = "Hi,\n".$content.' '.var_export($items);
$mailer->setSubject('debug add '.$path);
$mailer->setBody($body);
// $mailer->addAttachment(JPATH_COMPONENT.'/assets/document.pdf');
// send the email
$send = $mailer->Send();
return parent::displayList();
}
...
And I dont know how to trace this, or review any application logs that can indicate the cause for this.
Any tips?
Regards Tomas