Use SODA for REST
Oracle Database Exadata Express Cloud Service supports SODA for REST.
About SODA for REST
Oracle Database Exadata Express Cloud Service supports Simple Oracle Document Access (SODA) using Representational State Transfer (REST).
SODA for REST can be used from any modern programming language capable of making HTTP requests. For further details including a complete list of SODA for REST HTTP operations available for the SODA for REST API, see REST Data Services SODA for REST Developer's Guide.
SODA for REST Prerequisites
Prerequisites must be satisfied in order to use SODA for REST.
The following must be performed or known before attempting to use SODA for REST:
-
You must enable SODA for your service. See Enable SODA for Your Service.
-
You must provide the appropriate roles to users using SODA for REST. See Assign User Roles for SODA for REST.
-
You must know how to determine the REST URI. See Determine the SODA for REST HTTP Operation URIs.
Set up Users and Roles for SODA for REST
Service users that want to use SODA for REST must be assigned the appropriate role and must use the proper authentication mechanism.
Assign User Roles for SODA for REST
Before a user can access SODA for REST, users must be assigned the predefined roles of Database Administrator or Database Developer and your service must be enabled for SODA for REST. It is also possible to create custom roles for accessing SODA for REST.
The initial Service Administrator User for the service is automatically assigned the Database Administrator and Database Developer roles. Additional users need to be manually assigned these roles. You can change the roles assigned to users from the Infrastructure Console. Roles can also be assigned during user creation. See Adding Users and Assigning Roles in Getting Started with Oracle Cloud.
Create Custom Roles
In addition to the predefined roles, such as Database Administrator and Database Developer, you can create your own custom roles. A custom role, for example, allows you to guard access to a particular SODA document collection, instead of a whole schema.
The custom role name is created and defined from the Infrastructure Console Users page. The custom role can then be assigned to users. You need to perform PL/SQL commands to define what the custom role does. See Security in Oracle REST Data Services SODA for REST Developer’s Guide.
To create your own custom role:
About Authentication Mechanisms
Simple Oracle Document Access (SODA) for REST is built on top of Oracle REST Data Services (ORDS), which provides various authentication mechanisms, such as basic authentication, OAuth, and so on.
See Authentication Mechanisms in Oracle REST Data Services SODA for REST Developer’s Guide.
Determine the SODA for REST HTTP Operation URIs
A SODA for REST HTTP URI includes the host name of your Oracle Database Exadata Express Cloud Service and, for non-default schemas, the schema name. The default schema name is the name of the schema your service was provisioned with and is not included in the URI.
A SODA for REST HTTP Operation has a Universal Resource Identifier (URI) of this form:
https://hostname/apex/schema(only if non-default schema)/soda/latest
where:
-
hostname is the host name found in the Service Instance URL displayed on the Service Details page.
-
schema is the name of the non default schema. For the default schema the schema name is not included.
Example URL Pattern for Default Schema:
https://myhostname/apex/soda/latest
Example URL Pattern for Non-default Schema:
https://myhostname/apex/myschemaname/soda/latest
Get Started with SODA for REST Operations
Some basic SODA operations using REST are provided to demonstrate the steps needed to list all collections, create a new collection, insert a document, retrieve a document, and finally to delete the created collections that allow documents to be stored in, and retrieved from, document collections.
For further details on the example operations described below, see Getting Started with SODA for REST and SODA for REST HTTP Operations in Oracle REST Data Services SODA for REST Developer’s Guide.
Note:
The following example operations use Basic Authentication with a fictitious useruser@example.com
with password password
and the user has a role of either Database Administrator, Database Developer or both. It is not secure to specify usernames and passwords in clear text as part of the cURL command. Although, for the purposes of brevity, the sample commands shown here use clear text for the username and password.