Create an Index
/mobile/system/databaseManagement/tables/{table}/indexes
Creates an index for the table.
Permissions
Only team members with the Mobile_DbMgmt
role can access the Database Management API.
Request
- application/json
-
table: string
The name of the table.
object
-
columns:
array indexColumns
Minimum Number of Items:
1
Unique Items Required:true
The indexed columns. -
name:
string
The index name.
array
1
true
{
"name":"my_index_name",
"columns":[
"first_name",
"last_name"
]
}
Response
- application/json
201 Response
The index was created successfully.
object
-
columns:
array indexColumns
Minimum Number of Items:
1
Unique Items Required:true
The indexed columns. -
name:
string
The index name.
array
1
true
{
"name":"my_index_name",
"columns":[
"first_name",
"last_name"
]
}
409 Response
The index already exists. To modify the index, delete it and then create it again.
Examples
The following example shows how to create an index by submitting a POST request on the REST resource using cURL. For more information about cURL, see Use cURL.
curl -i
-X POST
-u username:password
-d @index.json
-H "Content-Type: application/json; charset=utf-8"
-H "Oracle-Mobile-Backend-ID: ABCDd59b-f13c-4722-81b8-4e719b5a4622"
https://fif.cloud.oracle.com/mobile/system/databaseManagement/tables/Movies/indexes
Example of Request Body
The following shows an example of the request body. This example creates an index on the inTheaters
and releaseDate
columns.
{
"columns":[
"inTheaters",
"releaseDate"
],
"name":"release"
}
Example of Response Header
The following shows an example of the response header:
200 OK Content-Type: application/json Date: Mon, 29 Jan 2017 20:32:51 GMT
Example of Response Body
The following example shows, in JSON format, the contents of the response body.
{
"name": "release",
"columns": [
"inTheaters",
"releaseDate"
]
}