Supported HTTP Methods
The most commonly used HTTP methods (or verbs) are GET
, POST
, PATCH
, and DELETE.
The building blocks of REST APIs, these methods define actions applied to REST resources using their URLs. See Custom Actions for more information.
Note:
You can combine multiple operations into a single HTTP request to improve performance. For more information, see Batch Actions.The following table lists the methods and their scope for singular and collection resources.
Method | Works with a Singular Resource? | Works with a Collection Resource? |
---|---|---|
Yes. Gets a single resource. |
Yes. Gets a subset, or all of the resources in the collection. |
|
No. For a custom method, you can use the |
Yes. Creates a new resource in the collection. |
|
Yes. Updates a resource. |
No. |
|
Yes. Deletes a resource. |
No. |
The GET Method
Use this method to retrieve information from a resource. To query both a singular resource and a collection resource, use expand
, fields
, and onlyData
query parameters. To filter the queried result, use different parameters for a singular resource and a collection resource.
The following table lists common parameters for querying singular resources and resource collections.
Parameter | Description |
---|---|
expand |
Gets the child resources along with the parent resource when you query a hierarchical resource. The server doesn't return child resources by default. The valid values include:
Starting in REST framework version 3, the |
fields |
Gets information for the specified fields. The valid values include:
Starting in REST framework version 3, the |
onlyData |
Indicates whether the retrieved data contains only resource field values without links. The default value is false, indicating that the retrieved data contains links by default. For example, to return only the name and status without any link, enter the command: GET |
The following table lists the parameters you can use only for querying a collection resource.
Query Parameter for Collection Resource | Description |
---|---|
limit |
Positive integer value that specifies the maximum number of items that a server returns. The server might override this value to improve application performance. If the client request doesn't specify a limit value, then the server uses the default limit value of 25. |
offset |
Positive integer value that specifies the index of the first item to be returned. Default value is 0. For example:
|
q |
Specifies a filter for the items to be returned from the collection. In REST framework version 1, the query parameter is used in the where clause and contains one or more expressions separated by a semicolon. For example: Supported operators in REST framework version 1:
The allowed special characters in REST framework version 1:
For REST framework version 2 and later, the query parameter accepts a rowmatch expression format that identifies the specific rows to retrieve from the resource.
The supported operators in REST framework version 2 and later also include:
The allowed special characters in REST framework version 2 and later:
|
totalResults |
Boolean value that indicates how to return items that match the q query parameter. Default value is false. For example, if the employees collection contains employees with id=1..100, use the following code:
The response is as follows:
|
orderBy |
Specifies the order of the items in the response payload. For details, see Sorting. |
finder |
Uses the predefined where clause that includes certain bind parameters to search the collection. For example, the opportunities resource defines a finder named MyOpportunitiesFinder , with one of the bind parameters named Name . A client can use this finder to fetch all opportunities named Auto that the current user owns. For example:
In this command, the format of the query parameter value is:
|
dependency |
Used for the list-of-values (LOV) resources. For example, a location resource includes the following Country and State fields:
The location resource gets values for the State field from the States resource, which includes a list of values that depend on the Country resource. Assume you change the country to BR in the client. To display the new valid list of states, the client sends a request to the server that uses BR in the Country field and gets the associated state list.
|
The POST Method
Use to create a new item in a resource. The request media type is:
application/vnd.oracle.adf.resourceitem+json
The PATCH Method
Use to update data in a resource. The PATCH
method updates only the fields specified in the request body. The request media type is:
application/vnd.oracle.adf.resourceitem+json
The DELETE Method
Use to delete a resource. The method doesn't require a request body.
Custom Actions
A resource might expose a custom action that isn't the standard Create, Read, Update, and Delete (CRUD) action. For example, any custom object functions that are created on standard objects using Application Composer are available as custom actions. A custom action is always initiated using a POST method.
The relevant request media type is:
application/vnd.oracle.adf.action+json
The response media type is:
application/vnd.oracle.adf.actionresult+json
The following request always contains a custom action and optionally, an array of input parameters for the custom action:
application/vnd.oracle.adf.action+json
The JSON schema of the media type is:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"title": "Action execution representation.",
"description": "Represents the action execution and its parameters.",
"properties": {
"name": {
"type": "string",
"description": "Action name."
},
"parameters": {
"type": "array",
"description": "Parameter name/value pair.",
}
},
"required": [
"name"
]
}