logo
down
shadow

(How) Can filters / parameters be used with a DB-connected service in Apigility?


(How) Can filters / parameters be used with a DB-connected service in Apigility?

By : Cal'EL DLastSon
Date : November 17 2020, 11:52 AM
this one helps. For this you are going to use the zf-content-validation package (see https://apigility.org/documentation/modules/zf-content-validation).
With the content-validation module you are able to define input filters in your module configuration section and specify which input filter to use to validate your service requests.
code :
'zf-content-validation' => array(
    'Application\Controller\HelloWorld' => array(
        'input_filter' => 'Application\Controller\HelloWorld\Validator',
        'POST' => 'Application\Controller\HelloWorld\CreationValidator',
    ),
),


'input_filter_specs' => array(
    'Application\Controller\HelloWorldGet' => array(
        0 => array(
            'name' => 'name',
            'required' => true,
            'filters' => array(
                0 => array(
                    'name' => 'Zend\Filter\StringTrim',
                    'options' => array(),
                ),
            ),
            'validators' => array(),
            'description' => 'Hello to name',
            'allow_empty' => false,
            'continue_if_empty' => false,
        ),
    ),
),


Share : facebook icon twitter icon
Do something when Apigility db-connected actions ocurr using Zend Events

Do something when Apigility db-connected actions ocurr using Zend Events


By : Shashwat Aggarwal
Date : March 29 2020, 07:55 AM
it should still fix some issue Code exemple to attach a logic to a MvcEvent
In module/APIName/Module.php
code :
<?php
namespace APIName;

use Zend\Mvc\MvcEvent;

class Module
{
    public function onBoostrap($e)
    {
        $eventManager        = $e->getApplication()->getEventManager();
        $serviceManager      = $e->getApplication()->getServiceManager();

        $eventManager->attach(MvcEvent::EVENT_ROUTE, function($event) use($serviceManager){
            $route  = $event->getRouteMatch()->getMatchedRouteName();
            // Do some stuff, tests, etc...
        }, -1100); // set low priority to be sure that route is defined
    }
}
Apigility is requiring the route_identifier_name for Code-Connected REST POST Entity

Apigility is requiring the route_identifier_name for Code-Connected REST POST Entity


By : Eric
Date : March 29 2020, 07:55 AM
hop of those help? If you create a new resource on a Restful API you do a post on the collection route. So you should add your POST method to the collection_http_methods array. This is totally according to Restful specifications.
code :
'collection_http_methods' => array(
    0 => 'GET',
    1 => 'POST',
),
'collection_http_methods' => array('GET', 'POST')
Apigility rest service - how to filter by a non unique column using db connected

Apigility rest service - how to filter by a non unique column using db connected


By : user2632907
Date : March 29 2020, 07:55 AM
it should still fix some issue This is my experience with CodeConnected Services. YMMV..
Retrieving URL Parameters - Controller/Resource class.
code :
 /**
 * Fetch a single Entity by ID, with some Query Params
 */
public function fetch($entity_id)
{
    // retrieve the query parameters\
    $queryParams = $this->getEvent()->getQueryParams();
}
'ServiceName\\V1\\Rest\\ServiceName\\Controller' => array(
            ...
            'entity_http_methods' => array(
                0 => 'GET',
                1 => 'PATCH',
                2 => 'PUT',
                3 => 'DELETE',
            ),
            'collection_http_methods' => array(
                0 => 'GET',
                1 => 'POST',
            ),
            'collection_query_whitelist' => array(
                0 => 'username',
                1 => 'entity_provider',
                2 => 'entity_type',
                3 => 'entity_date_range',
                4 => 'sort_by',
                5 => 'sort_order'
            ),
            ...
Apigility "Error saving field" while creating "db-connected" service

Apigility "Error saving field" while creating "db-connected" service


By : JGRodli
Date : March 29 2020, 07:55 AM
hop of those help? It seems that when the new service is created, if the table name contains an underscore ( _ ), the API will convert this to what looks like CamelCase.
But when the UI then wants to create the fields for this newly created service, it (the UI) will still use the tablename with the underscore in it, when accessing the api (/apigility/api/module//rest/--Rest--Controller/input-filter)
Apigility code connected service across two tables / entities

Apigility code connected service across two tables / entities


By : Joe Korn
Date : March 29 2020, 07:55 AM
it should still fix some issue You need to create a code-connected resource (api service) and fill up the Resource class yourself to handle GET, POST, DELETE, etc, yourself.
The best 2 advices I can give on ZF2 related tasks:
Related Posts Related Posts :
  • How to add Smarty templating engine to CodeIgniters 3 framework?
  • Am I maxing out possible data insert
  • Redirect to homepage without changing address bar URL
  • What is the best user-Id Value for a MySql "users" table
  • PHP $_COOKIE is only available in one directory
  • php regular expressions documantation
  • cannot import too large sql file to mysql
  • not getting appilcation/json in content-type in header
  • Only the first data display from my database but other shows but not on a table
  • Is it possible to have a print button link as the content of the mail
  • how to extract full mail address in imap php
  • Alternative to output buffering to put eval'd code into a variable
  • how to run wordpress php snippet mysql update command from ssh and/ultimately cron
  • how to get xml tag by name
  • ModSecurity maximum post limits (PCRE limit errors)
  • Call controller/action in event listener
  • How to improve performance of contacting WebService?
  • PHP nest variable in echoed string that contains a HTML tag in the end
  • Multiple Ajax request for PHP framework
  • Debug Info from Moodle Plugin
  • passing variables through page
  • Passing PHP $result data to Javascript
  • cakePHP File Download was not found or not readable
  • batch waiting until script finishes
  • PHP variables and anchors in URL
  • php eTag generation using php
  • How to check whether the array is an Integer or Not?
  • Is it possible to install Doctrine without PEAR or Composer? If so, how?
  • Call view script of (parent) Abstract controller Zend
  • Curl PHP cannot display amazon
  • Symfony, getters and setters vs magic methods
  • Using 'continue' PHP instruction outside the loop
  • AJAX POST return data not appearing
  • Can I query relations using an INNER JOIN instead of two queries in Eloquent?
  • Looping through dynamic form fields and inserting into database
  • My php code can't select mysql auto_increment value
  • Store Angularjs form data in database using php
  • I want to run my sh file continuously even if I close my Putty connection
  • file_get_contents equivalent for gzipped files
  • Include PHP file with jQuery
  • php curl headers do not return from website?
  • How to find out, if facebook ID is a user, group or page
  • Connect webhost database to android database
  • preg_match get div content with class
  • Upload multiple files in Laravel 4
  • Count array numbers in multidimensional array
  • PHP Date diff with a difference
  • Search Customer by custom field in Netsuite
  • Is it possible to hide/encode/encrypt php source code and let others have the system?
  • list items to be displayed using php code and array
  • check if row exists mysqli
  • PHP errors loading MySQL
  • setup PostgreSQL with Laravel in MAMP
  • PHP - CodeIgniter Notifications
  • Encrypting a password column in a SQL database
  • New to PHP, trying to extract information from another website
  • JavaScript AmChart to Image for Email
  • Is javascript validation enough to keep my forms secure?
  • Regex extract variables from [shortcode]
  • Download a .mp3 link and save it to computer with PHP
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org