Wednesday, May 13, 2020

How to Setup REST Web Service for a MySQL Database

I want to access/update a MySQL database from Oracle.  Found the most reasonable way is using REST API. 





How to implement ZOOM API on PL/SQL with JWT Token

How to implement ZOOM API on PL/SQL


<<< UPDATE NEWS - ZOOM API DOES NOT SUPPORT JWT ANY MORE SINCE MID 2023

IGNORE THIS DOCUMENT >>>>


We adopt JWT Token instead of OAUTH2 for it is more suitable for pl/sql implementation.


Step 1. Create an email for the zoom account application (e.g. zoom@hovon.com)

Step 2.  Sign up a Zoom Marketplace Account at https://marketplace.zoom.us/ with zoom email

Step 3.  Sign in the zoom account and create an JWT app. (we will use this to generate JWT token for Zoom API access)

 

 

 

 

On App Credentials page, you can find two important information for next few steps

(API Key and API Secret).  You can copy the JWT Token here for testing.

 

Go to https://jwt.io/ and paste the JWT token on Encoded Area (Left hand side)

 

You will then check the decoded result on right hand side

If everything is good, you will find the iss: is your API Key, iat: is the token issue date and exp: is the token expiration date.


Now your jwt configuration is ready.  (Your app is allowed to invoke any Zoom APIs)

 

Step 4.  Setup Necessary environment for JWT token generation in PL/SQL

For Oracle 12 and after you can install JWT_NINJA as stated on https://github.com/morten-egan/jwt_ninja


For Oracle 10/11, you can install my fork of JWT_NINJA

https://github.com/kevincch/jwt_ninja


Step 5. Testing JWT Token Generation

Generate a jwt token valid for 90 minutes with following SQL

select jwt_ninja.jwt_generate(

        p_signature_key        => '<Zoom API Secret>'

       ,p_reg_claim_issuer        => '<Zoom API Key>'

       ,p_reg_claim_issuedat    => sysdate

                -(to_number(substr(TZ_OFFSET(SESSIONTIMEZONE),1,3))/24) -- convert to GMT

       ,p_reg_claim_expiration  => sysdate  

                                        -(to_number(substr(TZ_OFFSET(SESSIONTIMEZONE),1,3))/24) -- convert to GMT

                                        +(1/24/60*90)   -- plus 90 minutes

) as token from dual;


Go to https://jwt.io/ and paste the JWT token on Encoded Area (Left hand side)

 

You will then check the decoded result on right hand side’

If everything is good, you will find the iss: is your API Key, iat: is the token issue date and exp: is the token expiration date.


Step 6 Testing the Zoom API with JWT Token with curl command


$ curl --request GET  \

         --url 'https://api.zoom.us/v2/users/me'  \

         --header 'content-type: application/json' \

         --header 'authorization: Bearer <JWT Token Here>'


You will get similar result as following


NOW YOU JWT SHOULD WORK WELL, you can then build you own code for Zoom API implementation