dolibarr  9.0.0
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...
 
 _cleanObjectDatas ($object)
 Clean sensible object datas. 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

◆ __construct()

MyModuleApi::__construct ( )

Constructor.

GET /

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

Member Function Documentation

◆ _cleanObjectDatas()

MyModuleApi::_cleanObjectDatas (   $object)

Clean sensible object datas.

Parameters
object$objectObject to clean
Returns
array Array of cleaned object properties

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

◆ _validate()

MyModuleApi::_validate (   $data)

Validate fields before create or update object.

Parameters
array$dataData to validate
Returns
array
Exceptions
RestException

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

◆ delete()

MyModuleApi::delete (   $id)

Delete myobject.

Parameters
int$idMyObject ID
Returns
array

DELETE myobject/{id}

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

◆ get()

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.

◆ index()

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.

◆ post()

MyModuleApi::post (   $request_data = null)

Create myobject object.

Parameters
array$request_dataRequest datas
Returns
int ID of myobject

POST myobjects/

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

◆ put()

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 225 of file api_mymodule.class.php.


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