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.
The documentation of this REST API is available on
http://<host>:<port>/webadmin/denodo-scheduler-admin/swagger-ui/index.html
Note
Swagger doesn’t support Basic authentication where either the username or password contains non-ASCII characters
since it is not able to correctly encode those characters in base64.
Consequently, the cURL command displayed on the webpage has an error in the -H 'Authorization: Basic <BASE64-user-pass>'
argument. This means if we use the cURL command given, we’ll have to fix the Authorization header to use the correct
Basic <BASE64-user-pass>.
Alternatively, a workaround exists to use Swagger when the username or password contains non-ASCII characters:
Don’t authenticate directly within Swagger.
Perform the REST API call we require.
This will prompt the browser itself to ask for credentials in a pop-up.
This alternative works with most major browsers.
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 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:
Construct the user-pass by concatenating the user-id, a single colon (“:”) character and the password
Encode the user-pass using Base64 into a sequence of US-ASCII characters
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:
The access token in the
Authorizationheader.The
uriparameter 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 Scheduler Administration Tool
configuration file <DENODO_HOME>/conf/scheduler-webadmintool/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:
GET
http://<host>:<port>/webadmin/denodo-scheduler-admin/Ping.Extract from the response: The X-XSRF-TOKEN value from the header, and the JSESSIONID from the cookie.
POST
http://<host>:<port>/webadmin/denodo-scheduler-admin/accesstokenincluding the OAuth access token.
Note
This request also has to include:
The value of the X-XSRF-TOKEN header extracted in the step 2.
The value of the JSESSIONID cookie extracted in the step 2.
The
uriparameter pointing to the Scheduler server, using the format//<host>:<port>.
Extract from response: The X-XSRF-TOKEN value from the header, and JSESSIONID from the cookie.
Request any API endpoint.
GET requests.
Note
The GET requests have to include:
The value of the JSESSIONID cookie extracted in the step 3.
The
URIheader pointing to the Scheduler server, using the format//<host>:<port>.
POST/PUT/DELETE requests.
Note
POST/PUT/DELETE requests have to include:
The value of the X-XSRF-TOKEN header extracted in the step 3.
The value of the JSESSIONID cookie extracted in the step 3.
The
URIheader pointing to the Scheduler server, using the format//<host>:<port>.
POST
http://<host>:<port>/webadmin/denodo-scheduler-admin/logout.
Note
This request has to include:
The value of the X-XSRF-TOKEN header extracted in the step 3.
The value of the JSESSIONID cookie extracted in the step 3.
The
URIheader 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:
Ping.
curl --location --request GET 'http://localhost:9090/webadmin/denodo-scheduler-admin/Ping' --header 'URI: //localhost:8000' -i
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
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
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
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 Scheduler Administration Tool
configuration file <DENODO_HOME>/conf/scheduler-webadmintool/ConfigurationParameters.properties.
Private (Deprecated)¶
The steps in order to perform a successful authentication are:
GET
http://<host>:<port>/webadmin/denodo-scheduler-admin/PingExtract from response: X-XSRF-TOKEN value from header and JSESSIONID from cookie
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
Extract from response: X-XSRF-TOKEN value from header and JSESSIONID from cookie
Request any API endpoint with:
GET requests:
Note
It is necessary to add in the request:
Cookie JSESSIONID with the value of last JSESSIONID cookie got
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
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:
Ping
curl --location --request GET 'http://localhost:9090/webadmin/denodo-scheduler-admin/Ping' --header 'URI: //localhost:8000' -i
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
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
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
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
