/ords/READme.md

https://github.com/oracle/oracle-db-tools · Markdown · 53 lines · 28 code · 25 blank · 0 comment · 0 complexity · d8594a6316e692b8c93583dfebceecd3 MD5 · raw file

  1. # ords-sql-examples
  2. Scripts that demonstrate RESTful Services with Oracle REST Data Services (ORDS).
  3. We also have a set of examples for the REST Enabled SQL feature [here](https://github.com/oracle/oracle-db-tools/tree/master/ords/rest-sql).
  4. # Prerequisites
  5. You will need at least a browser to work with the simple GET examples. You will also need a REST client such as Postman or cURL.
  6. Download from OTN: ORDS & Oracle SQL Developer
  7. Required: [Download ORDS](http://www.oracle.com/technetwork/developer-tools/rest-data-services/downloads/index.html)
  8. Required: [Download SQLDev](http://www.oracle.com/technetwork/developer-tools/sql-developer/downloads/index.html)
  9. Required: Install ORDS, configure for an Oracle Database (11gR2 or higher), REST enable a schema.
  10. # REST Enabling a Schema
  11. RESTful Services are defined in the schema from which the services will run. For example, a service mapped to /ords/hr/ will run as the HR user, therefore inheriting the privileges defined for that Oracle user account.
  12. This code sample will REST enable the HR schema, therefore allowing RESTful Services to be defined in the HR schema, and for those said services to be executed as the HR user.
  13. BEGIN
  14. ORDS.ENABLE_SCHEMA(p_enabled => TRUE,
  15. p_schema => 'HR',
  16. p_url_mapping_type => 'BASE_PATH',
  17. p_url_mapping_pattern => 'hr',
  18. p_auto_rest_auth => FALSE);
  19. commit;
  20. END;
  21. To access services on this REST enabled schema, you would use this URI pattern to get started:
  22. *https://host:port/ords/hr* -- where 'hr' is the `p_url_mapping_pattern` value.
  23. To access a list of the available services on a schema, use the /metadata-catalog/ endpoint:
  24. *https://host:port:/ords/hr/metadata-catalog/*
  25. This endpoint returns a JSON document. Each RESTful Services module also includes a */open-api-catalog/* endpoint which supports the Open API 2.0 (Swagger) Spec.
  26. ![](swagger.png)
  27. # On Security
  28. For simplicity, many of the examples here are presented unsecured. This is not recommended for production deployments. ORDS supports many authentication schemes, including OAuth2 and first party auth, and we plan on delivering example scenarios to showcase securing your services specifically.