PHP code example of reliv / axosoft-api

1. Go to this page and download the library: Download reliv/axosoft-api library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

reliv / axosoft-api example snippets


    // Get AxosoftApi from ZF2 service manager
    $axosoftApi = $this->getServiceLocator()->get('Reliv\AxosoftApi\Service\AxosoftApi');

    // Build request
    $request = new ApiRequestList();
    $request->setProjectId(10);
    $request->setSearchString('search for me');
    $request->setSearchField('name');
    $request->setPage(1);
    $request->setPageSize(1);

    // Get Response
    $response = $axosoftApi->send($request);
    
    // Handle error
    if ($axosoftApi->hasError($response)) {
        throw new \Exception('Call Failed.');
    }
    
    $dataArray = $response->getResponseData();
    $someValue = $response->getResponseProperty('somekey');

    // Get AxosoftApi from ZF2 service manager
    $axosoftApi = $this->getServiceLocator()->get('Reliv\AxosoftApi\Service\AxosoftApi');

    // Build request
    $request = new GenericApiRequest('/api/v5/items');

    $request->setRequestParameter('project_id', 10);
    $request->setRequestParameter('search_string', 'search for me');
    $request->setRequestParameter('search_field', 'name');
    $request->setRequestParameter('page', 1);
    $request->setRequestParameter('page_size', 1);

    // Get Response
    $response = $axosoftApi->send($request);
    
    // Handle error
    if ($axosoftApi->hasError($response)) {
        throw new \Exception('Call Failed.');
    }
    
    $dataArray = $response->getResponseData();
    $someValue = $response->getResponseProperty('somekey');