dolibarr  13.0.2
Public Member Functions | Protected Member Functions | Private 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...
 
- Public Member Functions inherited from DolibarrApi
 __construct ($db, $cachedir= '', $refreshCache=false)
 Constructor. More...
 

Protected Member Functions

 _cleanObjectDatas ($object)
 Clean sensible object datas. More...
 
- Protected Member Functions inherited from DolibarrApi
 _cleanObjectDatas ($object)
 Executed method when API is called without parameter. More...
 
 _checkFilters ($sqlfilters)
 Return if a $sqlfilters parameter is valid. More...
 

Private Member Functions

 _validate ($data)
 Validate fields before create or update object. More...
 

Additional Inherited Members

- Static Protected 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 37 of file api_mymodule.class.php.

Constructor & Destructor Documentation

MyModuleApi::__construct ( )

Constructor.

GET /

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

References db.

Member Function Documentation

MyModuleApi::_cleanObjectDatas (   $object)
protected

Clean sensible object datas.

Parameters
Object$objectObject to clean
Returns
Object Object with cleaned properties

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

Referenced by get(), and index().

MyModuleApi::_validate (   $data)
private

Validate fields before create or update object.

Parameters
array$dataArray of data to validate
Returns
array
Exceptions
RestException

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

Referenced by post().

MyModuleApi::delete (   $id)

Delete myobject.

Parameters
int$idMyObject ID
Returns
array
Exceptions
RestExceptionDELETE myobjects/{id}

Definition at line 261 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
RestException401 Not allowed
RestException404 Not found

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

References DolibarrApi\_checkAccessToResource(), and _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 105 of file api_mymodule.class.php.

References DolibarrApi\_checkFilters(), _cleanObjectDatas(), and db.

MyModuleApi::post (   $request_data = null)

Create myobject object.

Parameters
array$request_dataRequest datas
Returns
int ID of myobject
Exceptions
RestExceptionPOST 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
Exceptions
RestExceptionPUT myobjects/{id}

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

References DolibarrApi\_checkAccessToResource().


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