Scheduler REST Client API

Besides the Scheduler RMI Client API you can also interact with the Scheduler servers through a REST API provided by the Scheduler Administration Tool. With updates released after 20210715, the documentation of this REST API is available on http://<host>:<port>/webadmin/denodo-scheduler-admin/swagger-ui/index.html

With update 20210715 or a previous one, the documentation is available on http://<host>:<port>/webadmin/denodo-scheduler-admin/swagger-ui.html

However first of all, in order to use this API, an authentication action needs to be done. There are several ways to do it:

1. Public which uses HTTP Basic Authentication (RFC 7617) in all requests (stateless) or OAuth <https://oauth.net/2/> which could be used in stateless or stateful mode.

2. Private which performs a login before any request and logout after all them. The private alternative is deprecated to be used by external REST API clients and they should use the public.

Public

Basic Authentication

In order to perform a request with Basic Authentication it is necessary to follow next indications:

  1. Construct the user-pass by concatenating the user-id, a single colon (“:”) character and the password

  2. Encode the user-pass using Base64 into a sequence of US-ASCII characters

  3. Build a header “Authorization” and the value “Basic <BASE64-user-pass>”

An example to retrieve the list of projects by calling /public/api/projects and assuming user password admin/admin was:

curl --location --request GET 'http://localhost:9090/webadmin/denodo-scheduler-admin/public/api/projects?uri=//localhost:8000' --header 'Authorization: Basic YWRtaW46YWRtaW4='

And for adding a new project:

curl --location --request POST 'http://localhost:9090/webadmin/denodo-scheduler-admin/public/api/projects?uri=//localhost:8000' --header 'Authorization: Basic YWRtaW46YWRtaW4=' --header 'Content-Type: application/json' --data-raw '{"description": "Postman Test project","name": "Test project 1"}'

OAuth Stateless Authentication

In order to perform a request with OAuth stateless authentication, first you have to enable OAuth in Virtual DataPort.

Then, you have to include in each request:

  1. The access token in the Authorization header.

  2. The uri parameter pointing to the Scheduler server, using the format //<host>:<port>.

The following example uses OAuth stateless authentication to retrieve the list of projects by calling the endpoint /public/api/projects:

curl --location --request GET 'http://localhost:9090/webadmin/denodo-scheduler-admin/public/api/projects?uri=//localhost:8000' --header 'Authorization: Bearer <OAUTH-ACCESS-TOKEN>'.

Note

This authentication method is disabled by default. You can enable it by setting the parameter oauth.statelessEnabled=true in the Data Catalog configuration file conf/scheduler/ConfigurationParameters.properties.

OAuth Stateful Authentication

In order to perform a request with OAuth stateful authentication, first you have to enable OAuth in Virtual DataPort.

Then, the steps to perform a successful authentication are:

  1. GET http://<host>:<port>/webadmin/denodo-scheduler-admin/Ping.

  2. Extract from the response: The X-XSRF-TOKEN value from the header, and the JSESSIONID from the cookie.

  3. POST http://<host>:<port>/webadmin/denodo-scheduler-admin/accesstoken including the OAuth access token.

Note

This request also has to include:

  1. The value of the X-XSRF-TOKEN header extracted in the step 2.

  2. The value of the JSESSIONID cookie extracted in the step 2.

  3. The uri parameter pointing to the Scheduler server, using the format //<host>:<port>.

  1. Extract from response: The X-XSRF-TOKEN value from the header, and JSESSIONID from the cookie.

  2. Request any API endpoint.

    1. GET requests.

    Note

    The GET requests have to include:

    1. The value of the JSESSIONID cookie extracted in the step 3.

    2. The URI header pointing to the Scheduler server, using the format //<host>:<port>.

    1. POST/PUT/DELETE requests.

    Note

    POST/PUT/DELETE requests have to include:

    1. The value of the X-XSRF-TOKEN header extracted in the step 3.

    2. The value of the JSESSIONID cookie extracted in the step 3.

    3. The URI header pointing to the Scheduler server, using the format //<host>:<port>.

  3. POST http://<host>:<port>/webadmin/denodo-scheduler-admin/logout.

Note

This request has to include:

  1. The value of the X-XSRF-TOKEN header extracted in the step 3.

  2. The value of the JSESSIONID cookie extracted in the step 3.

  3. The URI header pointing to the Scheduler server, using the format //<host>:<port>.

The following example uses OAuth stateful authentication to retrieve the list of projects and create a new one. This example uses the API endpoint /api/projects:

  1. Ping.

curl --location --request GET 'http://localhost:9090/webadmin/denodo-scheduler-admin/Ping' --header 'URI: //localhost:8000' -i
  1. Login.

curl --location --request POST 'http://localhost:9090/webadmin/denodo-scheduler-admin/admin/accesstoken?uri=//localhost:8000' --header 'X-XSRF-TOKEN: <XSRF-TOKEN-VALUE-FROM-HEADER>' --header 'Cookie: JSESSIONID=<JSESSIONID-VALUE-FROM-COOKIE>' --header 'Authorization: Bearer <OAUTH-ACCESS-TOKEN>' -i
  1. Get the projects list.

curl --location --request GET 'http://localhost:9090/webadmin/denodo-scheduler-admin/api/projects' --header 'URI: //localhost:8000' --header 'Cookie: JSESSIONID=<JSESSIONID-VALUE-FROM-COOKIE>' -i
  1. Add a new project.

curl --location --request POST 'http://localhost:9090/webadmin/denodo-scheduler-admin/api/projects' --header 'URI: //localhost:8000' --header 'Content-Type: application/json' --header 'X-XSRF-TOKEN: <XSRF-TOKEN-VALUE-FROM-HEADER>' --header 'Cookie: JSESSIONID=<JSESSIONID-VALUE-FROM-COOKIE>' --data-raw '{"description": "projDesc","name": "proj"}' -i
  1. Logout.

curl --location --request POST 'http://localhost:9090/webadmin/denodo-scheduler-admin/logout' --header 'URI: //localhost:8000' --header 'X-XSRF-TOKEN: <XSRF-TOKEN-VALUE-FROM-HEADER>' --header 'Cookie: JSESSIONID=<JSESSIONID-VALUE-FROM-COOKIE>' -i

Note

This authentication method is disabled by default. You can enable it by setting the parameter oauth.statefulEnabled=true in the Data Catalog configuration file conf/scheduler/ConfigurationParameters.properties.

Private (Deprecated)

The steps in order to perform a successful authentication are:

  1. GET http://<host>:<port>/webadmin/denodo-scheduler-admin/Ping

  2. Extract from response: X-XSRF-TOKEN value from header and JSESSIONID from cookie

  3. POST http://<host>:<port>/webadmin/denodo-scheduler-admin/login

Note

It is necessary to add in the request:

Header X-XSRF-TOKEN with the value of X-XSRF-TOKEN header got in 2

Cookie JSESSIONID with the value of JSESSIONID cookie got in 2

  1. Extract from response: X-XSRF-TOKEN value from header and JSESSIONID from cookie

  2. Request any API endpoint with:

    1. GET requests:

    Note

    It is necessary to add in the request:

    Cookie JSESSIONID with the value of last JSESSIONID cookie got

    1. POST requests:

    Note

    It is necessary to add in the request:

    Header X-XSRF-TOKEN with the value of last X-XSRF-TOKEN header got

    Cookie JSESSIONID with the value of last JSESSIONID cookie got

  3. POST http://<host>:<port>/webadmin/denodo-scheduler-admin/logout

Note

It is necessary to add in the request:

Header X-XSRF-TOKEN with the value of last X-XSRF-TOKEN header got

Cookie JSESSIONID with the value of last JSESSIONID cookie got

An example to retrieve the list of projects by calling /api/projects and create a new project was:

  1. Ping

curl --location --request GET 'http://localhost:9090/webadmin/denodo-scheduler-admin/Ping' --header 'URI: //localhost:8000' -i
  1. Login

curl --location --request POST 'http://localhost:9090/webadmin/denodo-scheduler-admin/login' --header 'X-XSRF-TOKEN: <XSRF-TOKEN-VALUE-FROM-HEADER>' --header 'Cookie: JSESSIONID=<JSESSIONID-VALUE-FROM-COOKIE>' --form 'username=admin' --form 'password=admin' --form 'uri=//localhost:8000' -i
  1. Projects list

curl --location --request GET 'http://localhost:9090/webadmin/denodo-scheduler-admin/api/projects' --header 'URI: //localhost:8000' --header 'Cookie: JSESSIONID=<JSESSIONID-VALUE-FROM-COOKIE>' -i
  1. Add new project

curl --location --request POST 'http://localhost:9090/webadmin/denodo-scheduler-admin/api/projects' --header 'URI: //localhost:8000' --header 'Content-Type: application/json' --header 'X-XSRF-TOKEN: <XSRF-TOKEN-VALUE-FROM-HEADER>' --header 'Cookie: JSESSIONID=<JSESSIONID-VALUE-FROM-COOKIE>' --data-raw '{"description": "projDesc","name": "proj"}' -i
  1. Logout

curl --location --request POST 'http://localhost:9090/webadmin/denodo-scheduler-admin/logout' --header 'URI: //localhost:8000' --header 'X-XSRF-TOKEN: <XSRF-TOKEN-VALUE-FROM-HEADER>' --header 'Cookie: JSESSIONID=<JSESSIONID-VALUE-FROM-COOKIE>' -i