dolibarr  7.0.0-beta
Public Member Functions | List of all members
MyModuleApi Class Reference
+ Inheritance diagram for MyModuleApi:
+ Collaboration diagram for MyModuleApi:

Public Member Functions

 __construct ()
 Constructor. More...
 
 get ($id)
 Get properties of a myobject object. More...
 
 index ($sortfield="t.rowid", $sortorder= 'ASC', $limit=100, $page=0, $sqlfilters= '')
 List myobjects. More...
 
 post ($request_data=NULL)
 Create myobject object. More...
 
 put ($id, $request_data=NULL)
 Update myobject. More...
 
 delete ($id)
 Delete myobject. More...
 
 _validate ($data)
 Validate fields before create or update object. More...
 
- Public Member Functions inherited from DolibarrApi
 __construct ($db, $cachedir='', $refreshCache=false)
 Constructor. More...
 
 _cleanObjectDatas ($object)
 Executed method when API is called without parameter. More...
 
 _checkFilters ($sqlfilters)
 Return if a $sqlfilters parameter is valid. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from DolibarrApi
static _checkAccessToResource ($resource, $resource_id=0, $dbtablename='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid')
 Check user access to a resource. More...
 
static _forge_criteria_callback ($matches)
 Function to forge a SQL criteria. More...
 

Detailed Description

Definition at line 38 of file api_mymodule.class.php.

Constructor & Destructor Documentation

MyModuleApi::__construct ( )

Constructor.

GET /

Definition at line 59 of file api_mymodule.class.php.

Member Function Documentation

MyModuleApi::_validate (   $data)

Validate fields before create or update object.

Parameters
array$dataData to validate
Returns
array
Exceptions
RestException

Definition at line 290 of file api_mymodule.class.php.

Referenced by post().

MyModuleApi::delete (   $id)

Delete myobject.

Parameters
int$idMyObject ID
Returns
array

DELETE myobject/{id}

Definition at line 254 of file api_mymodule.class.php.

References DolibarrApi\_checkAccessToResource().

MyModuleApi::get (   $id)

Get properties of a myobject object.

Return an array with myobject informations

Parameters
int$idID of myobject
Returns
array|mixed data without useless information

GET myobjects/{id}

Exceptions
RestException

Definition at line 77 of file api_mymodule.class.php.

References DolibarrApi\_checkAccessToResource(), and DolibarrApi\_cleanObjectDatas().

MyModuleApi::index (   $sortfield = "t.rowid",
  $sortorder = 'ASC',
  $limit = 100,
  $page = 0,
  $sqlfilters = '' 
)

List myobjects.

Get a list of myobjects

Parameters
string$sortfieldSort field
string$sortorderSort order
int$limitLimit for list
int$pagePage number
string$sqlfiltersOther criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')"
Returns
array Array of order objects
Exceptions
RestExceptionGET /myobjects/

Definition at line 112 of file api_mymodule.class.php.

References DolibarrApi\_checkFilters().

MyModuleApi::post (   $request_data = NULL)

Create myobject object.

Parameters
array$request_dataRequest datas
Returns
int ID of myobject

POST myobjects/

Definition at line 195 of file api_mymodule.class.php.

References _validate().

MyModuleApi::put (   $id,
  $request_data = NULL 
)

Update myobject.

Parameters
int$idId of myobject to update
array$request_dataDatas
Returns
int

PUT myobjects/{id}

Definition at line 221 of file api_mymodule.class.php.

References DolibarrApi\_checkAccessToResource().


The documentation for this class was generated from the following file: