RESTController handles REST requests.
The controller supports the following actions:
Action default
Handle action according to HTTP method and parameters.
Response Actions | |
ok | In all cases |
- Author
- ingo herwig ingo@.nosp@m.wemo.nosp@m.ve.co.nosp@m.m
Definition at line 44 of file RESTController.php.
Handle a GET request (read object(s) of a given type)
Parameter | Description |
in collection | Boolean whether to load one object or a list of objects. The Range header is used to get only part of the list |
in language | The language of the returned object(s) |
in className | The type of returned object(s) |
in id | If collection is false, the object with className/_id_ will be loaded |
in sortBy | _?sortBy=+foo_ for sorting the list by foo ascending or |
in sort | _?sort(+foo)_ for sorting the list by foo ascending |
in limit | _?limit(10,25)_ for loading 25 objects starting from position 10 |
in relation | Relation name if objects in relation to another object should be loaded (determines the type of the returned objects) |
in sourceId | Id of the object to which the returned objects are related (determines the object id together with className) |
out | Single object or list of objects. In case of a list, the Content-Range header will be set. |
Definition at line 140 of file RESTController.php.
assignResponseDefaults |
( |
| ) |
|
|
protected |
Handle a POST request (create an object of a given type)
Parameter | Description |
in language | The language of the object |
in className | Type of object to create |
in relation | Relation name if the object should be created/added in relation to another object (determines the type of the created/added object) |
in sourceId | Id of the object to which the created objects are added (determines the object id together with className) |
out | Created object data |
The object data is contained in POST content. If an existing object should be added, an oid
parameter in the object data is sufficient.
Definition at line 310 of file RESTController.php.
Handle a PUT request (update an object of a given type)
Parameter | Description |
in language | The language of the object |
in className | Type of object to update |
in id | Id of object to update |
in relation | Relation name if an existing object should be added to a relation (determines the type of the added object) |
in sourceId | Id of the object to which the added object is related (determines the object id together with className) |
in targetId | Id of the object to be added to the relation (determines the object id together with relation) |
out | Updated object data |
The object data is contained in POST content.
Definition at line 371 of file RESTController.php.
Handle a DELETE request (delete an object of a given type)
Parameter | Description |
in language | The language of the object |
in className | Type of object to delete |
in id | Id of object to delete |
in relation | Relation name if the object should be deleted from a relation to another object (determines the type of the deleted object) |
in sourceId | Id of the object to which the deleted object is related (determines the object id together with className) |
in targetId | Id of the object to be deleted from the relation (determines the object id together with relation) |
Definition at line 480 of file RESTController.php.
setLocationHeaderFromOid |
( |
|
$oid | ) |
|
|
protected |
Set the location response header according to the given object id.
- Parameters
-
$oid | The serialized object id |
Definition at line 509 of file RESTController.php.
getRelatedType |
( |
ObjectId |
$sourceOid, |
|
|
|
$role |
|
) |
| |
|
protected |
Get the type that is used in the given role related to the given source object.
- Parameters
-
$sourceOid | ObjectId of the source object |
$role | The role name |
- Returns
- String
Definition at line 538 of file RESTController.php.