Questions and discussion about developing processes and programming in PHP, JavaScript, web services & REST API.
Forum rules: Please search to see if a question has already asked before creating a new topic. Please don't post the same question in multiple forums.
By Bonifac
#794336
It is working.

1. The namespace is important in the REST endpoint PHP class.
Code: Select all
<?php
namespace Services\Api\epsample;
use ProcessMaker\Services\Api;
class Sample extends Api
{
    /**
     * @url GET /sample/hello/:var
     */
    public function hellosample($var)
    {
        return $var;
    }
}
2. Before I enabled the plugin, I had deleted the route cache file:
rm /opt/processmaker/shared/sites/workflow/routes.php
By yasiralqaisi
#823512
I try to do the same with 3.3.4-community I cannot get it to work.
I followed the wiki, I checked the webinar all seem fine also the namespace is ok.

plugin file (lawyerCrud.php) code
Code: Select all
<?php
G::LoadClass("plugin");

class lawyerCrudPlugin extends PMPlugin
{
  
  
  public function lawyerCrudPlugin($sNamespace, $sFilename = null)
  {
    $res = parent::PMPlugin($sNamespace, $sFilename);
    $this->sFriendlyName = "Lawyer CRUD";
    $this->sDescription  = "Crud the Lawyer database";
    $this->sPluginFolder = "lawyerCrud";
    $this->sSetupPage    = "setup";
    $this->iVersion      = "1.1";
    //$this->iPMVersion    = 2425;
    $this->aWorkspaces   = null;
    //$this->aWorkspaces = array("os");
    $this->enableRestService(true);

    
    
    return $res;
  }

  public function setup()
  {
    $this->registerMenu("processmaker", "menulawyerCrud.php");
  }

  public function install()
  {
  }
  
  public function enable()
  {

    
  }

  public function disable()
  {
    
  }
  
}

$oPluginRegistry = PMPluginRegistry::getSingleton();
$oPluginRegistry->registerPlugin("lawyerCrud", __FILE__);


Rest end point file lawyerCrud/lawyerCrud/src/Services/Api/lawyerCrud/Sample.php
Code: Select all
<?php

namespace Services\Api\lawyerCrud;
use ProcessMaker\Services\Api;
use \ProcessMaker\Util;

class Sample extends Api
{
    /**
     * @url GET /sample/new/:var
     */
    public function newsample($var)
    {  

        return $var;
    }
}
I user postman with the access token
http://35.204.42.244/api/1.0/workflow/p ... new/qsdqsd

But I get the following result, I deleted the router.php to regenerate it, but always the same problem.
Code: Select all
{
    "error": {
        "code": 404,
        "message": "Not Found"
    }
}
Want to create your own meme coin?

In the world of cryptocurrencies, a unique and exc[…]

The market for cryptocurrencies is demonstrating a[…]

What's SAP FICO?

Embarking on a dissertation can be one of the most[…]

Hello. For rental housing, there are software solu[…]