apex connects jira
TRANSCRIPT
APEX connects Jira
Oliver LemmAPEX World07032016
2
Facts amp Figures
Independent Technology Housewith Cross-Industry Expertise
HeadquarterRatingen
(North Rhine ndash Westphalia)240
Employees
Founded1994
BranchesDortmund Cologne
Frankfurt
Top Company for Trainees amp
Students
Privately-Owned
Corporation
Oracle Platinum Partner
24 Mio Euro Revenue
3
about me
Oliver Lemm since february 2007 working for MT AG in Ratingen
Junior Consultant gt Consultant gt Senior Consultant gt Competence Center Leader APEX amp Service Center Leader APEX
Diploma applied computer science at the university of Duisburg-Essen Projectleader IT-Architect and Developer working with Oracle Databases and Oracle Application Express since 2007
Blog httpoliverlemmblogspotde Twitter httpstwittercomOliverLemm
APEX Connect26th ndash 28th April 2016 in Berlin
Get your early-bird ticket now
APEXDOAGORG
APEXCONN16
5
Agenda
1 Motivation
2 Jira
3 Webservices
4 JSON
5 Livedemo
6
Motivation
bdquoWorking with one tool to handle the developing process controlling and all other processes in one projectldquo
bdquoCalculating key figures based on Jira values which are not delivered by Jira itselfldquo
bdquoUsing integrated Jira Plugins and adding additional functionality by using APEX as known technologyldquo
requirements
7
Jira
httpswwwatlassiancomJIRA
Issue tracking and code integration Supporting Dashboards amp Plugins perfect integration from Confluence (wiki)
and Subversion (versioning)
supporting complex workflows
Issue import from Bugzilla Mantis GitHub hellip
Supporting von REST-Webservices
8
9
JiraWorkflow
10
Jira
supporting a huge number of attributes time tracking (estimated time spent remaining) Components (can be used for APEX pages and database objects) versions
fields and screens adjustable per project external issue numbers date of commision date of payment
Supporting own workflows Describing a whole process usable for non developing processes Every step can be defined by user rights or issue dependencies
Using bdquoJIRA Timesheet Reports and Gadgets Pluginldquo
Integrated features
11
Jira
key figures not in desired aggregation time per yearmonth
no further support for SOAP Webservices in Jira SOAP Interface doesnlsquot return all values
Using Jira-Plugins Listed Plugins not fullfilling all requiremends Developing own Jira-Plugins is complex and time consuming
lack of features
12
Jira
API documentation for Jira REST-WebserviceshttpsdocsatlassiancomjiraRESTlatest
URL structure httphostportcontextrestapi-nameapi-versionresource-name
Using an issue identfiied by the key JRA-9 would be like httpsjiraatlassiancomrestapilatestissueJRA-9
Using JQL Language (syntax)httpsjiramt-agcomrestapi2searchjql=project=BP
Returning values in JSON Format (testable also in browser)
REST-Webservice
13
JiraJQL
httpsjiramt-agcomrestapi2searchjql=project=BP
14
Jira
addional information when getting REST-Webservice Result
Default max 50 entries 1 solution add parameter ampmaxResults=XXX
2 solution add Parameter ampstartAt=50
Sort the results
If no Authentication needed donlsquot submit usernamepassword -gt you get Unauthorized (401)
REST-Webservice
expandschemanamesstartAt0maxResults50total827issues[hellip]
httpsjiramt-agcomrestapilatestsearchjql=project=BPampmaxResults=1000
httpsjiramt-agcomrestapilatestsearchjql=project=BPampstartAt=50
httpsjiramt-agcomrestapilatestsearchjql=project=BP+order+by+duedate
15
Webservices
getting Error
Example httpsjiraatlassiancomrestapilatestissueJRA-9
ACL
ORA-29273 HTTP request failed ORA-24247 network access denied by access control list (ACL)
begin dbms_network_acl_admincreate_acl(acl =gt jiraatlassiancomxml description =gt An ACL for Calling REST Webservices principal =gt l_principal is_grant =gt true privilege =gt connect start_date =gt systimestamp end_date =gt null)
dbms_network_acl_adminassign_acl(acl =gt jiraatlassiancomxml host =gt jiraatlassiancom lower_port =gt 443 upper_port =gt 443) commitend
16
Webservices
Getting existing ACL Entries
Important for ACL Using Web Service References (shared
components or the APEX_WEB_SERVICE (package) principal = APEX_050000
using utl_http or other packages calling external resources principal = my_schema_name
ACL select aacl ahost alower_port aupper_port pprincipal pprivilege pis_grant to_char(pstart_date DD-MON-YYYY) as start_date to_char(pend_date DD-MON-YYYY) as end_datefrom dba_network_acl_privileges pleft join dba_network_acls a on aacl = pacl
17
Webservicesexporting certificate
18
Webservices
calling https
To solve this problem you have to get the certificates which are used by the server which runs Jira
Getting certificate use your browser and call the URL from the REST-Webservice or even from Jira click on the lock symbol click show certificate
exporting certificate
ORA-29273 HTTP request failed ORA-29024 Certificate validation failure
19
Webservicesimporting certificate
20
Webservices
use the Oracle Wallet Manager (OWM) to import the certificate run ORACLE_HOMEbinowmcl (on windows a link is created)
Import of the certificate is also possible using the command line
create a wallet for the certificate using a path like thisORACLE_BASEadminltSIDgtltname_walletgt
Use automatic login for your wallet (otherwise you have to use the wallet always with your password in your plsql code)
importing certificate
21
Webservice
APEX documentationhttpdocsoraclecomcdE59726_01doc50e39151adm_wrkspc002htmBABHEHAG
Login into your INTERNAL WorkspaceManage InstanceInstance SettingsWallet
certificate in APEX
23
Webservices
Shared Components Web Service References Create
Problems based on single items authentification result as CLOB
only in Collection No support in apex_items report columns
JSON Format
Web Service Reference
24
WebservicesWeb Service Reference
25
Webservice
Call REST
p_http_method GET HEAD POST PUT DELETE Username amp Password supporting Basic Authentication Parameter if parameter beside the URL itself are needed
APEX_WEB_SERVICE
l_clob = apex_web_servicemake_rest_request( p_url =gt
httpsjiraatlassiancomrestapilatestissueJRA-9p_http_method =gt GETp_wallet_path =gt fileCoracleadminorclmein_walletp_username =gt lemmop_password =gt 123456 sbquop_parm_name =gt apex_utilstring_to_table(param1param2)p_parm_value =gt apex_utilstring_to_table(val1val2)
)
26
JSON
Datentypen String
QS - Demo Feature 2015-11-03T134816630+0100
Number 20
Boolean true false
Null null
Array [ hellip hellip]
format
id 17149 self httpsjiramt-agcomrestapilatestissue17149 key BP-7 fields ldquosummary QS - Demo Feature progress progress 19800 total 19800 percent 100 created 2015-11-03T134816630+0100 worklog startAt 0 maxResults 20 total 2 worklogs [ ]
27
JSON
convert clob to JSON object
looping entries
get value
processingl_values apex_jsont_valueshellipapex_jsonparse(p_values =gt l_values p_source =gt l_clob)
for i in 1 apex_jsonget_count(p_values =gt l_values p_path =gt )loop hellip end loop
l_jira_issuekey = apex_jsonget_varchar2(p_values =gt pi_json_issue p_path =gt key)
l_jira_issuetimespent = apex_jsonget_number(p_values =gt pi_json_issue p_path =gt fieldstimespent)
28
JSON
Number as String you have to convert
Datetime as String Converting with
apex_jsonget_datedoesnlsquot work because of format
custom fieldsin Jira are named likecustomfield_xxxxx
special cases
id 17149
created 2015-11-03T134816630+0100l_timestamp = to_timestamp_tz(pi_string YYYY-MM-DDThh24missFF3TZHTZM) l_string = to_char(l_timestamp yyyymmdd hh24miss)l_date = to_date(l_string yyyymmdd hh24miss)apex_jsonget_varchar2(p_values =gt pi_json_issue p_path =gt fieldscustomfield_10000)
29
JSON
Time worked Worklog not with information by day encapsuleted in issue you have call the worklog for every single ticket by one REST Call
special cases
for i in 1 apex_jsonget_count(p_values =gt l_values p_path =gt issues)loop l_rest_response = make_rest_request(pi_url =gt pi_jira_base_url || c_jira_rest_base_path || issue || apex_jsonget_varchar2(p_values =gt l_values p_path =gt issues[ || i || ]key) pi_username =gt pi_username pi_password =gt pi_password) apex_jsonparse(p_values =gt l_values_issue p_source =gt l_rest_response) l_jira_issue = get_issue_from_json(pi_json_issue =gt l_values_issue) for j in 1 apex_jsonget_count(p_values =gt l_values_issue p_path =gt fieldsworklogworklogs) loop l_jira_issue_worklog = get_issue_worklog_from_json(pi_json_issue_worklog =gt l_values_issue pi_path =gt fieldsworklogworklogs[ || j || ] pi_jira_issue_id =gt l_jira_issueid pi_jira_issue_key =gt l_jira_issuekey) pipe row(l_jira_issue_worklog)
30
JSON
transform JSON into type easier to use Transformation in package instead APEX testing possible by using sql Entities defined as column names documentation von
CollectionSpalte ndash JSON ndash Spaltenname im Type
using table function based on defined types
processing create or replace type t_jira_issue force as object(-- id 16276-- c001 id number -- Jira Issue ID
-- self httpsjiramt-agcomrestapi2issue16276-- c003 url_json varchar2(32767) -- c003 - JSON URL
-- key UITFPP-1057bdquo-- c001 key varchar2(32767) -- Issue Keyselect
from table(jira_rest_ws_pkgget_projects(pi_base_url =gt httpsjiraatlassiancom))
31
APEX
using APEX_COLLECTIONS not every search means new webservice call loading page doesnlsquot call a webservice APEX itself relies also on collections when working with Web Service References
problem authentication for webservice call every call needs a username amp password using Web Service Reference itlsquos inconvenient using Application Items instead
when logging into the apex application password is saved on server-side by application item attention the password value is visible in session state
32
APEXLivedemo
33
Conclusion
complexity is huge because of many different technical aspects
all important key facts are calculateable
transforming JSON in JavaScript or PLSQL is not easy in the beginning
first time parsing JSON even with APEX_JSON needs practiceremember in 12c you can directly parse JSON by SQL
Using APEX integrated bdquoWeb Service Referenceldquo only for simple examples
OliverLemm
httpoliverlemmblogspotde
httpdelinkedincominOliverLemm
httpswwwxingcomprofileOliver_Lemm
Thanks
- APEX connects Jira
- Facts amp Figures
- about me
- Slide 4
- Agenda
- Motivation
- Jira
- Slide 8
- Jira (2)
- Jira (3)
- Jira (4)
- Jira (5)
- Jira (6)
- Jira (7)
- Webservices
- Webservices (2)
- Webservices (3)
- Webservices (4)
- Webservices (5)
- Webservices (6)
- Webservice
- Webservices (8)
- Webservices (9)
- Webservice (2)
- JSON
- JSON
- JSON (2)
- JSON (3)
- JSON (4)
- APEX
- APEX (2)
- Conclusion
- Slide 34
-
2
Facts amp Figures
Independent Technology Housewith Cross-Industry Expertise
HeadquarterRatingen
(North Rhine ndash Westphalia)240
Employees
Founded1994
BranchesDortmund Cologne
Frankfurt
Top Company for Trainees amp
Students
Privately-Owned
Corporation
Oracle Platinum Partner
24 Mio Euro Revenue
3
about me
Oliver Lemm since february 2007 working for MT AG in Ratingen
Junior Consultant gt Consultant gt Senior Consultant gt Competence Center Leader APEX amp Service Center Leader APEX
Diploma applied computer science at the university of Duisburg-Essen Projectleader IT-Architect and Developer working with Oracle Databases and Oracle Application Express since 2007
Blog httpoliverlemmblogspotde Twitter httpstwittercomOliverLemm
APEX Connect26th ndash 28th April 2016 in Berlin
Get your early-bird ticket now
APEXDOAGORG
APEXCONN16
5
Agenda
1 Motivation
2 Jira
3 Webservices
4 JSON
5 Livedemo
6
Motivation
bdquoWorking with one tool to handle the developing process controlling and all other processes in one projectldquo
bdquoCalculating key figures based on Jira values which are not delivered by Jira itselfldquo
bdquoUsing integrated Jira Plugins and adding additional functionality by using APEX as known technologyldquo
requirements
7
Jira
httpswwwatlassiancomJIRA
Issue tracking and code integration Supporting Dashboards amp Plugins perfect integration from Confluence (wiki)
and Subversion (versioning)
supporting complex workflows
Issue import from Bugzilla Mantis GitHub hellip
Supporting von REST-Webservices
8
9
JiraWorkflow
10
Jira
supporting a huge number of attributes time tracking (estimated time spent remaining) Components (can be used for APEX pages and database objects) versions
fields and screens adjustable per project external issue numbers date of commision date of payment
Supporting own workflows Describing a whole process usable for non developing processes Every step can be defined by user rights or issue dependencies
Using bdquoJIRA Timesheet Reports and Gadgets Pluginldquo
Integrated features
11
Jira
key figures not in desired aggregation time per yearmonth
no further support for SOAP Webservices in Jira SOAP Interface doesnlsquot return all values
Using Jira-Plugins Listed Plugins not fullfilling all requiremends Developing own Jira-Plugins is complex and time consuming
lack of features
12
Jira
API documentation for Jira REST-WebserviceshttpsdocsatlassiancomjiraRESTlatest
URL structure httphostportcontextrestapi-nameapi-versionresource-name
Using an issue identfiied by the key JRA-9 would be like httpsjiraatlassiancomrestapilatestissueJRA-9
Using JQL Language (syntax)httpsjiramt-agcomrestapi2searchjql=project=BP
Returning values in JSON Format (testable also in browser)
REST-Webservice
13
JiraJQL
httpsjiramt-agcomrestapi2searchjql=project=BP
14
Jira
addional information when getting REST-Webservice Result
Default max 50 entries 1 solution add parameter ampmaxResults=XXX
2 solution add Parameter ampstartAt=50
Sort the results
If no Authentication needed donlsquot submit usernamepassword -gt you get Unauthorized (401)
REST-Webservice
expandschemanamesstartAt0maxResults50total827issues[hellip]
httpsjiramt-agcomrestapilatestsearchjql=project=BPampmaxResults=1000
httpsjiramt-agcomrestapilatestsearchjql=project=BPampstartAt=50
httpsjiramt-agcomrestapilatestsearchjql=project=BP+order+by+duedate
15
Webservices
getting Error
Example httpsjiraatlassiancomrestapilatestissueJRA-9
ACL
ORA-29273 HTTP request failed ORA-24247 network access denied by access control list (ACL)
begin dbms_network_acl_admincreate_acl(acl =gt jiraatlassiancomxml description =gt An ACL for Calling REST Webservices principal =gt l_principal is_grant =gt true privilege =gt connect start_date =gt systimestamp end_date =gt null)
dbms_network_acl_adminassign_acl(acl =gt jiraatlassiancomxml host =gt jiraatlassiancom lower_port =gt 443 upper_port =gt 443) commitend
16
Webservices
Getting existing ACL Entries
Important for ACL Using Web Service References (shared
components or the APEX_WEB_SERVICE (package) principal = APEX_050000
using utl_http or other packages calling external resources principal = my_schema_name
ACL select aacl ahost alower_port aupper_port pprincipal pprivilege pis_grant to_char(pstart_date DD-MON-YYYY) as start_date to_char(pend_date DD-MON-YYYY) as end_datefrom dba_network_acl_privileges pleft join dba_network_acls a on aacl = pacl
17
Webservicesexporting certificate
18
Webservices
calling https
To solve this problem you have to get the certificates which are used by the server which runs Jira
Getting certificate use your browser and call the URL from the REST-Webservice or even from Jira click on the lock symbol click show certificate
exporting certificate
ORA-29273 HTTP request failed ORA-29024 Certificate validation failure
19
Webservicesimporting certificate
20
Webservices
use the Oracle Wallet Manager (OWM) to import the certificate run ORACLE_HOMEbinowmcl (on windows a link is created)
Import of the certificate is also possible using the command line
create a wallet for the certificate using a path like thisORACLE_BASEadminltSIDgtltname_walletgt
Use automatic login for your wallet (otherwise you have to use the wallet always with your password in your plsql code)
importing certificate
21
Webservice
APEX documentationhttpdocsoraclecomcdE59726_01doc50e39151adm_wrkspc002htmBABHEHAG
Login into your INTERNAL WorkspaceManage InstanceInstance SettingsWallet
certificate in APEX
23
Webservices
Shared Components Web Service References Create
Problems based on single items authentification result as CLOB
only in Collection No support in apex_items report columns
JSON Format
Web Service Reference
24
WebservicesWeb Service Reference
25
Webservice
Call REST
p_http_method GET HEAD POST PUT DELETE Username amp Password supporting Basic Authentication Parameter if parameter beside the URL itself are needed
APEX_WEB_SERVICE
l_clob = apex_web_servicemake_rest_request( p_url =gt
httpsjiraatlassiancomrestapilatestissueJRA-9p_http_method =gt GETp_wallet_path =gt fileCoracleadminorclmein_walletp_username =gt lemmop_password =gt 123456 sbquop_parm_name =gt apex_utilstring_to_table(param1param2)p_parm_value =gt apex_utilstring_to_table(val1val2)
)
26
JSON
Datentypen String
QS - Demo Feature 2015-11-03T134816630+0100
Number 20
Boolean true false
Null null
Array [ hellip hellip]
format
id 17149 self httpsjiramt-agcomrestapilatestissue17149 key BP-7 fields ldquosummary QS - Demo Feature progress progress 19800 total 19800 percent 100 created 2015-11-03T134816630+0100 worklog startAt 0 maxResults 20 total 2 worklogs [ ]
27
JSON
convert clob to JSON object
looping entries
get value
processingl_values apex_jsont_valueshellipapex_jsonparse(p_values =gt l_values p_source =gt l_clob)
for i in 1 apex_jsonget_count(p_values =gt l_values p_path =gt )loop hellip end loop
l_jira_issuekey = apex_jsonget_varchar2(p_values =gt pi_json_issue p_path =gt key)
l_jira_issuetimespent = apex_jsonget_number(p_values =gt pi_json_issue p_path =gt fieldstimespent)
28
JSON
Number as String you have to convert
Datetime as String Converting with
apex_jsonget_datedoesnlsquot work because of format
custom fieldsin Jira are named likecustomfield_xxxxx
special cases
id 17149
created 2015-11-03T134816630+0100l_timestamp = to_timestamp_tz(pi_string YYYY-MM-DDThh24missFF3TZHTZM) l_string = to_char(l_timestamp yyyymmdd hh24miss)l_date = to_date(l_string yyyymmdd hh24miss)apex_jsonget_varchar2(p_values =gt pi_json_issue p_path =gt fieldscustomfield_10000)
29
JSON
Time worked Worklog not with information by day encapsuleted in issue you have call the worklog for every single ticket by one REST Call
special cases
for i in 1 apex_jsonget_count(p_values =gt l_values p_path =gt issues)loop l_rest_response = make_rest_request(pi_url =gt pi_jira_base_url || c_jira_rest_base_path || issue || apex_jsonget_varchar2(p_values =gt l_values p_path =gt issues[ || i || ]key) pi_username =gt pi_username pi_password =gt pi_password) apex_jsonparse(p_values =gt l_values_issue p_source =gt l_rest_response) l_jira_issue = get_issue_from_json(pi_json_issue =gt l_values_issue) for j in 1 apex_jsonget_count(p_values =gt l_values_issue p_path =gt fieldsworklogworklogs) loop l_jira_issue_worklog = get_issue_worklog_from_json(pi_json_issue_worklog =gt l_values_issue pi_path =gt fieldsworklogworklogs[ || j || ] pi_jira_issue_id =gt l_jira_issueid pi_jira_issue_key =gt l_jira_issuekey) pipe row(l_jira_issue_worklog)
30
JSON
transform JSON into type easier to use Transformation in package instead APEX testing possible by using sql Entities defined as column names documentation von
CollectionSpalte ndash JSON ndash Spaltenname im Type
using table function based on defined types
processing create or replace type t_jira_issue force as object(-- id 16276-- c001 id number -- Jira Issue ID
-- self httpsjiramt-agcomrestapi2issue16276-- c003 url_json varchar2(32767) -- c003 - JSON URL
-- key UITFPP-1057bdquo-- c001 key varchar2(32767) -- Issue Keyselect
from table(jira_rest_ws_pkgget_projects(pi_base_url =gt httpsjiraatlassiancom))
31
APEX
using APEX_COLLECTIONS not every search means new webservice call loading page doesnlsquot call a webservice APEX itself relies also on collections when working with Web Service References
problem authentication for webservice call every call needs a username amp password using Web Service Reference itlsquos inconvenient using Application Items instead
when logging into the apex application password is saved on server-side by application item attention the password value is visible in session state
32
APEXLivedemo
33
Conclusion
complexity is huge because of many different technical aspects
all important key facts are calculateable
transforming JSON in JavaScript or PLSQL is not easy in the beginning
first time parsing JSON even with APEX_JSON needs practiceremember in 12c you can directly parse JSON by SQL
Using APEX integrated bdquoWeb Service Referenceldquo only for simple examples
OliverLemm
httpoliverlemmblogspotde
httpdelinkedincominOliverLemm
httpswwwxingcomprofileOliver_Lemm
Thanks
- APEX connects Jira
- Facts amp Figures
- about me
- Slide 4
- Agenda
- Motivation
- Jira
- Slide 8
- Jira (2)
- Jira (3)
- Jira (4)
- Jira (5)
- Jira (6)
- Jira (7)
- Webservices
- Webservices (2)
- Webservices (3)
- Webservices (4)
- Webservices (5)
- Webservices (6)
- Webservice
- Webservices (8)
- Webservices (9)
- Webservice (2)
- JSON
- JSON
- JSON (2)
- JSON (3)
- JSON (4)
- APEX
- APEX (2)
- Conclusion
- Slide 34
-
3
about me
Oliver Lemm since february 2007 working for MT AG in Ratingen
Junior Consultant gt Consultant gt Senior Consultant gt Competence Center Leader APEX amp Service Center Leader APEX
Diploma applied computer science at the university of Duisburg-Essen Projectleader IT-Architect and Developer working with Oracle Databases and Oracle Application Express since 2007
Blog httpoliverlemmblogspotde Twitter httpstwittercomOliverLemm
APEX Connect26th ndash 28th April 2016 in Berlin
Get your early-bird ticket now
APEXDOAGORG
APEXCONN16
5
Agenda
1 Motivation
2 Jira
3 Webservices
4 JSON
5 Livedemo
6
Motivation
bdquoWorking with one tool to handle the developing process controlling and all other processes in one projectldquo
bdquoCalculating key figures based on Jira values which are not delivered by Jira itselfldquo
bdquoUsing integrated Jira Plugins and adding additional functionality by using APEX as known technologyldquo
requirements
7
Jira
httpswwwatlassiancomJIRA
Issue tracking and code integration Supporting Dashboards amp Plugins perfect integration from Confluence (wiki)
and Subversion (versioning)
supporting complex workflows
Issue import from Bugzilla Mantis GitHub hellip
Supporting von REST-Webservices
8
9
JiraWorkflow
10
Jira
supporting a huge number of attributes time tracking (estimated time spent remaining) Components (can be used for APEX pages and database objects) versions
fields and screens adjustable per project external issue numbers date of commision date of payment
Supporting own workflows Describing a whole process usable for non developing processes Every step can be defined by user rights or issue dependencies
Using bdquoJIRA Timesheet Reports and Gadgets Pluginldquo
Integrated features
11
Jira
key figures not in desired aggregation time per yearmonth
no further support for SOAP Webservices in Jira SOAP Interface doesnlsquot return all values
Using Jira-Plugins Listed Plugins not fullfilling all requiremends Developing own Jira-Plugins is complex and time consuming
lack of features
12
Jira
API documentation for Jira REST-WebserviceshttpsdocsatlassiancomjiraRESTlatest
URL structure httphostportcontextrestapi-nameapi-versionresource-name
Using an issue identfiied by the key JRA-9 would be like httpsjiraatlassiancomrestapilatestissueJRA-9
Using JQL Language (syntax)httpsjiramt-agcomrestapi2searchjql=project=BP
Returning values in JSON Format (testable also in browser)
REST-Webservice
13
JiraJQL
httpsjiramt-agcomrestapi2searchjql=project=BP
14
Jira
addional information when getting REST-Webservice Result
Default max 50 entries 1 solution add parameter ampmaxResults=XXX
2 solution add Parameter ampstartAt=50
Sort the results
If no Authentication needed donlsquot submit usernamepassword -gt you get Unauthorized (401)
REST-Webservice
expandschemanamesstartAt0maxResults50total827issues[hellip]
httpsjiramt-agcomrestapilatestsearchjql=project=BPampmaxResults=1000
httpsjiramt-agcomrestapilatestsearchjql=project=BPampstartAt=50
httpsjiramt-agcomrestapilatestsearchjql=project=BP+order+by+duedate
15
Webservices
getting Error
Example httpsjiraatlassiancomrestapilatestissueJRA-9
ACL
ORA-29273 HTTP request failed ORA-24247 network access denied by access control list (ACL)
begin dbms_network_acl_admincreate_acl(acl =gt jiraatlassiancomxml description =gt An ACL for Calling REST Webservices principal =gt l_principal is_grant =gt true privilege =gt connect start_date =gt systimestamp end_date =gt null)
dbms_network_acl_adminassign_acl(acl =gt jiraatlassiancomxml host =gt jiraatlassiancom lower_port =gt 443 upper_port =gt 443) commitend
16
Webservices
Getting existing ACL Entries
Important for ACL Using Web Service References (shared
components or the APEX_WEB_SERVICE (package) principal = APEX_050000
using utl_http or other packages calling external resources principal = my_schema_name
ACL select aacl ahost alower_port aupper_port pprincipal pprivilege pis_grant to_char(pstart_date DD-MON-YYYY) as start_date to_char(pend_date DD-MON-YYYY) as end_datefrom dba_network_acl_privileges pleft join dba_network_acls a on aacl = pacl
17
Webservicesexporting certificate
18
Webservices
calling https
To solve this problem you have to get the certificates which are used by the server which runs Jira
Getting certificate use your browser and call the URL from the REST-Webservice or even from Jira click on the lock symbol click show certificate
exporting certificate
ORA-29273 HTTP request failed ORA-29024 Certificate validation failure
19
Webservicesimporting certificate
20
Webservices
use the Oracle Wallet Manager (OWM) to import the certificate run ORACLE_HOMEbinowmcl (on windows a link is created)
Import of the certificate is also possible using the command line
create a wallet for the certificate using a path like thisORACLE_BASEadminltSIDgtltname_walletgt
Use automatic login for your wallet (otherwise you have to use the wallet always with your password in your plsql code)
importing certificate
21
Webservice
APEX documentationhttpdocsoraclecomcdE59726_01doc50e39151adm_wrkspc002htmBABHEHAG
Login into your INTERNAL WorkspaceManage InstanceInstance SettingsWallet
certificate in APEX
23
Webservices
Shared Components Web Service References Create
Problems based on single items authentification result as CLOB
only in Collection No support in apex_items report columns
JSON Format
Web Service Reference
24
WebservicesWeb Service Reference
25
Webservice
Call REST
p_http_method GET HEAD POST PUT DELETE Username amp Password supporting Basic Authentication Parameter if parameter beside the URL itself are needed
APEX_WEB_SERVICE
l_clob = apex_web_servicemake_rest_request( p_url =gt
httpsjiraatlassiancomrestapilatestissueJRA-9p_http_method =gt GETp_wallet_path =gt fileCoracleadminorclmein_walletp_username =gt lemmop_password =gt 123456 sbquop_parm_name =gt apex_utilstring_to_table(param1param2)p_parm_value =gt apex_utilstring_to_table(val1val2)
)
26
JSON
Datentypen String
QS - Demo Feature 2015-11-03T134816630+0100
Number 20
Boolean true false
Null null
Array [ hellip hellip]
format
id 17149 self httpsjiramt-agcomrestapilatestissue17149 key BP-7 fields ldquosummary QS - Demo Feature progress progress 19800 total 19800 percent 100 created 2015-11-03T134816630+0100 worklog startAt 0 maxResults 20 total 2 worklogs [ ]
27
JSON
convert clob to JSON object
looping entries
get value
processingl_values apex_jsont_valueshellipapex_jsonparse(p_values =gt l_values p_source =gt l_clob)
for i in 1 apex_jsonget_count(p_values =gt l_values p_path =gt )loop hellip end loop
l_jira_issuekey = apex_jsonget_varchar2(p_values =gt pi_json_issue p_path =gt key)
l_jira_issuetimespent = apex_jsonget_number(p_values =gt pi_json_issue p_path =gt fieldstimespent)
28
JSON
Number as String you have to convert
Datetime as String Converting with
apex_jsonget_datedoesnlsquot work because of format
custom fieldsin Jira are named likecustomfield_xxxxx
special cases
id 17149
created 2015-11-03T134816630+0100l_timestamp = to_timestamp_tz(pi_string YYYY-MM-DDThh24missFF3TZHTZM) l_string = to_char(l_timestamp yyyymmdd hh24miss)l_date = to_date(l_string yyyymmdd hh24miss)apex_jsonget_varchar2(p_values =gt pi_json_issue p_path =gt fieldscustomfield_10000)
29
JSON
Time worked Worklog not with information by day encapsuleted in issue you have call the worklog for every single ticket by one REST Call
special cases
for i in 1 apex_jsonget_count(p_values =gt l_values p_path =gt issues)loop l_rest_response = make_rest_request(pi_url =gt pi_jira_base_url || c_jira_rest_base_path || issue || apex_jsonget_varchar2(p_values =gt l_values p_path =gt issues[ || i || ]key) pi_username =gt pi_username pi_password =gt pi_password) apex_jsonparse(p_values =gt l_values_issue p_source =gt l_rest_response) l_jira_issue = get_issue_from_json(pi_json_issue =gt l_values_issue) for j in 1 apex_jsonget_count(p_values =gt l_values_issue p_path =gt fieldsworklogworklogs) loop l_jira_issue_worklog = get_issue_worklog_from_json(pi_json_issue_worklog =gt l_values_issue pi_path =gt fieldsworklogworklogs[ || j || ] pi_jira_issue_id =gt l_jira_issueid pi_jira_issue_key =gt l_jira_issuekey) pipe row(l_jira_issue_worklog)
30
JSON
transform JSON into type easier to use Transformation in package instead APEX testing possible by using sql Entities defined as column names documentation von
CollectionSpalte ndash JSON ndash Spaltenname im Type
using table function based on defined types
processing create or replace type t_jira_issue force as object(-- id 16276-- c001 id number -- Jira Issue ID
-- self httpsjiramt-agcomrestapi2issue16276-- c003 url_json varchar2(32767) -- c003 - JSON URL
-- key UITFPP-1057bdquo-- c001 key varchar2(32767) -- Issue Keyselect
from table(jira_rest_ws_pkgget_projects(pi_base_url =gt httpsjiraatlassiancom))
31
APEX
using APEX_COLLECTIONS not every search means new webservice call loading page doesnlsquot call a webservice APEX itself relies also on collections when working with Web Service References
problem authentication for webservice call every call needs a username amp password using Web Service Reference itlsquos inconvenient using Application Items instead
when logging into the apex application password is saved on server-side by application item attention the password value is visible in session state
32
APEXLivedemo
33
Conclusion
complexity is huge because of many different technical aspects
all important key facts are calculateable
transforming JSON in JavaScript or PLSQL is not easy in the beginning
first time parsing JSON even with APEX_JSON needs practiceremember in 12c you can directly parse JSON by SQL
Using APEX integrated bdquoWeb Service Referenceldquo only for simple examples
OliverLemm
httpoliverlemmblogspotde
httpdelinkedincominOliverLemm
httpswwwxingcomprofileOliver_Lemm
Thanks
- APEX connects Jira
- Facts amp Figures
- about me
- Slide 4
- Agenda
- Motivation
- Jira
- Slide 8
- Jira (2)
- Jira (3)
- Jira (4)
- Jira (5)
- Jira (6)
- Jira (7)
- Webservices
- Webservices (2)
- Webservices (3)
- Webservices (4)
- Webservices (5)
- Webservices (6)
- Webservice
- Webservices (8)
- Webservices (9)
- Webservice (2)
- JSON
- JSON
- JSON (2)
- JSON (3)
- JSON (4)
- APEX
- APEX (2)
- Conclusion
- Slide 34
-
APEX Connect26th ndash 28th April 2016 in Berlin
Get your early-bird ticket now
APEXDOAGORG
APEXCONN16
5
Agenda
1 Motivation
2 Jira
3 Webservices
4 JSON
5 Livedemo
6
Motivation
bdquoWorking with one tool to handle the developing process controlling and all other processes in one projectldquo
bdquoCalculating key figures based on Jira values which are not delivered by Jira itselfldquo
bdquoUsing integrated Jira Plugins and adding additional functionality by using APEX as known technologyldquo
requirements
7
Jira
httpswwwatlassiancomJIRA
Issue tracking and code integration Supporting Dashboards amp Plugins perfect integration from Confluence (wiki)
and Subversion (versioning)
supporting complex workflows
Issue import from Bugzilla Mantis GitHub hellip
Supporting von REST-Webservices
8
9
JiraWorkflow
10
Jira
supporting a huge number of attributes time tracking (estimated time spent remaining) Components (can be used for APEX pages and database objects) versions
fields and screens adjustable per project external issue numbers date of commision date of payment
Supporting own workflows Describing a whole process usable for non developing processes Every step can be defined by user rights or issue dependencies
Using bdquoJIRA Timesheet Reports and Gadgets Pluginldquo
Integrated features
11
Jira
key figures not in desired aggregation time per yearmonth
no further support for SOAP Webservices in Jira SOAP Interface doesnlsquot return all values
Using Jira-Plugins Listed Plugins not fullfilling all requiremends Developing own Jira-Plugins is complex and time consuming
lack of features
12
Jira
API documentation for Jira REST-WebserviceshttpsdocsatlassiancomjiraRESTlatest
URL structure httphostportcontextrestapi-nameapi-versionresource-name
Using an issue identfiied by the key JRA-9 would be like httpsjiraatlassiancomrestapilatestissueJRA-9
Using JQL Language (syntax)httpsjiramt-agcomrestapi2searchjql=project=BP
Returning values in JSON Format (testable also in browser)
REST-Webservice
13
JiraJQL
httpsjiramt-agcomrestapi2searchjql=project=BP
14
Jira
addional information when getting REST-Webservice Result
Default max 50 entries 1 solution add parameter ampmaxResults=XXX
2 solution add Parameter ampstartAt=50
Sort the results
If no Authentication needed donlsquot submit usernamepassword -gt you get Unauthorized (401)
REST-Webservice
expandschemanamesstartAt0maxResults50total827issues[hellip]
httpsjiramt-agcomrestapilatestsearchjql=project=BPampmaxResults=1000
httpsjiramt-agcomrestapilatestsearchjql=project=BPampstartAt=50
httpsjiramt-agcomrestapilatestsearchjql=project=BP+order+by+duedate
15
Webservices
getting Error
Example httpsjiraatlassiancomrestapilatestissueJRA-9
ACL
ORA-29273 HTTP request failed ORA-24247 network access denied by access control list (ACL)
begin dbms_network_acl_admincreate_acl(acl =gt jiraatlassiancomxml description =gt An ACL for Calling REST Webservices principal =gt l_principal is_grant =gt true privilege =gt connect start_date =gt systimestamp end_date =gt null)
dbms_network_acl_adminassign_acl(acl =gt jiraatlassiancomxml host =gt jiraatlassiancom lower_port =gt 443 upper_port =gt 443) commitend
16
Webservices
Getting existing ACL Entries
Important for ACL Using Web Service References (shared
components or the APEX_WEB_SERVICE (package) principal = APEX_050000
using utl_http or other packages calling external resources principal = my_schema_name
ACL select aacl ahost alower_port aupper_port pprincipal pprivilege pis_grant to_char(pstart_date DD-MON-YYYY) as start_date to_char(pend_date DD-MON-YYYY) as end_datefrom dba_network_acl_privileges pleft join dba_network_acls a on aacl = pacl
17
Webservicesexporting certificate
18
Webservices
calling https
To solve this problem you have to get the certificates which are used by the server which runs Jira
Getting certificate use your browser and call the URL from the REST-Webservice or even from Jira click on the lock symbol click show certificate
exporting certificate
ORA-29273 HTTP request failed ORA-29024 Certificate validation failure
19
Webservicesimporting certificate
20
Webservices
use the Oracle Wallet Manager (OWM) to import the certificate run ORACLE_HOMEbinowmcl (on windows a link is created)
Import of the certificate is also possible using the command line
create a wallet for the certificate using a path like thisORACLE_BASEadminltSIDgtltname_walletgt
Use automatic login for your wallet (otherwise you have to use the wallet always with your password in your plsql code)
importing certificate
21
Webservice
APEX documentationhttpdocsoraclecomcdE59726_01doc50e39151adm_wrkspc002htmBABHEHAG
Login into your INTERNAL WorkspaceManage InstanceInstance SettingsWallet
certificate in APEX
23
Webservices
Shared Components Web Service References Create
Problems based on single items authentification result as CLOB
only in Collection No support in apex_items report columns
JSON Format
Web Service Reference
24
WebservicesWeb Service Reference
25
Webservice
Call REST
p_http_method GET HEAD POST PUT DELETE Username amp Password supporting Basic Authentication Parameter if parameter beside the URL itself are needed
APEX_WEB_SERVICE
l_clob = apex_web_servicemake_rest_request( p_url =gt
httpsjiraatlassiancomrestapilatestissueJRA-9p_http_method =gt GETp_wallet_path =gt fileCoracleadminorclmein_walletp_username =gt lemmop_password =gt 123456 sbquop_parm_name =gt apex_utilstring_to_table(param1param2)p_parm_value =gt apex_utilstring_to_table(val1val2)
)
26
JSON
Datentypen String
QS - Demo Feature 2015-11-03T134816630+0100
Number 20
Boolean true false
Null null
Array [ hellip hellip]
format
id 17149 self httpsjiramt-agcomrestapilatestissue17149 key BP-7 fields ldquosummary QS - Demo Feature progress progress 19800 total 19800 percent 100 created 2015-11-03T134816630+0100 worklog startAt 0 maxResults 20 total 2 worklogs [ ]
27
JSON
convert clob to JSON object
looping entries
get value
processingl_values apex_jsont_valueshellipapex_jsonparse(p_values =gt l_values p_source =gt l_clob)
for i in 1 apex_jsonget_count(p_values =gt l_values p_path =gt )loop hellip end loop
l_jira_issuekey = apex_jsonget_varchar2(p_values =gt pi_json_issue p_path =gt key)
l_jira_issuetimespent = apex_jsonget_number(p_values =gt pi_json_issue p_path =gt fieldstimespent)
28
JSON
Number as String you have to convert
Datetime as String Converting with
apex_jsonget_datedoesnlsquot work because of format
custom fieldsin Jira are named likecustomfield_xxxxx
special cases
id 17149
created 2015-11-03T134816630+0100l_timestamp = to_timestamp_tz(pi_string YYYY-MM-DDThh24missFF3TZHTZM) l_string = to_char(l_timestamp yyyymmdd hh24miss)l_date = to_date(l_string yyyymmdd hh24miss)apex_jsonget_varchar2(p_values =gt pi_json_issue p_path =gt fieldscustomfield_10000)
29
JSON
Time worked Worklog not with information by day encapsuleted in issue you have call the worklog for every single ticket by one REST Call
special cases
for i in 1 apex_jsonget_count(p_values =gt l_values p_path =gt issues)loop l_rest_response = make_rest_request(pi_url =gt pi_jira_base_url || c_jira_rest_base_path || issue || apex_jsonget_varchar2(p_values =gt l_values p_path =gt issues[ || i || ]key) pi_username =gt pi_username pi_password =gt pi_password) apex_jsonparse(p_values =gt l_values_issue p_source =gt l_rest_response) l_jira_issue = get_issue_from_json(pi_json_issue =gt l_values_issue) for j in 1 apex_jsonget_count(p_values =gt l_values_issue p_path =gt fieldsworklogworklogs) loop l_jira_issue_worklog = get_issue_worklog_from_json(pi_json_issue_worklog =gt l_values_issue pi_path =gt fieldsworklogworklogs[ || j || ] pi_jira_issue_id =gt l_jira_issueid pi_jira_issue_key =gt l_jira_issuekey) pipe row(l_jira_issue_worklog)
30
JSON
transform JSON into type easier to use Transformation in package instead APEX testing possible by using sql Entities defined as column names documentation von
CollectionSpalte ndash JSON ndash Spaltenname im Type
using table function based on defined types
processing create or replace type t_jira_issue force as object(-- id 16276-- c001 id number -- Jira Issue ID
-- self httpsjiramt-agcomrestapi2issue16276-- c003 url_json varchar2(32767) -- c003 - JSON URL
-- key UITFPP-1057bdquo-- c001 key varchar2(32767) -- Issue Keyselect
from table(jira_rest_ws_pkgget_projects(pi_base_url =gt httpsjiraatlassiancom))
31
APEX
using APEX_COLLECTIONS not every search means new webservice call loading page doesnlsquot call a webservice APEX itself relies also on collections when working with Web Service References
problem authentication for webservice call every call needs a username amp password using Web Service Reference itlsquos inconvenient using Application Items instead
when logging into the apex application password is saved on server-side by application item attention the password value is visible in session state
32
APEXLivedemo
33
Conclusion
complexity is huge because of many different technical aspects
all important key facts are calculateable
transforming JSON in JavaScript or PLSQL is not easy in the beginning
first time parsing JSON even with APEX_JSON needs practiceremember in 12c you can directly parse JSON by SQL
Using APEX integrated bdquoWeb Service Referenceldquo only for simple examples
OliverLemm
httpoliverlemmblogspotde
httpdelinkedincominOliverLemm
httpswwwxingcomprofileOliver_Lemm
Thanks
- APEX connects Jira
- Facts amp Figures
- about me
- Slide 4
- Agenda
- Motivation
- Jira
- Slide 8
- Jira (2)
- Jira (3)
- Jira (4)
- Jira (5)
- Jira (6)
- Jira (7)
- Webservices
- Webservices (2)
- Webservices (3)
- Webservices (4)
- Webservices (5)
- Webservices (6)
- Webservice
- Webservices (8)
- Webservices (9)
- Webservice (2)
- JSON
- JSON
- JSON (2)
- JSON (3)
- JSON (4)
- APEX
- APEX (2)
- Conclusion
- Slide 34
-
5
Agenda
1 Motivation
2 Jira
3 Webservices
4 JSON
5 Livedemo
6
Motivation
bdquoWorking with one tool to handle the developing process controlling and all other processes in one projectldquo
bdquoCalculating key figures based on Jira values which are not delivered by Jira itselfldquo
bdquoUsing integrated Jira Plugins and adding additional functionality by using APEX as known technologyldquo
requirements
7
Jira
httpswwwatlassiancomJIRA
Issue tracking and code integration Supporting Dashboards amp Plugins perfect integration from Confluence (wiki)
and Subversion (versioning)
supporting complex workflows
Issue import from Bugzilla Mantis GitHub hellip
Supporting von REST-Webservices
8
9
JiraWorkflow
10
Jira
supporting a huge number of attributes time tracking (estimated time spent remaining) Components (can be used for APEX pages and database objects) versions
fields and screens adjustable per project external issue numbers date of commision date of payment
Supporting own workflows Describing a whole process usable for non developing processes Every step can be defined by user rights or issue dependencies
Using bdquoJIRA Timesheet Reports and Gadgets Pluginldquo
Integrated features
11
Jira
key figures not in desired aggregation time per yearmonth
no further support for SOAP Webservices in Jira SOAP Interface doesnlsquot return all values
Using Jira-Plugins Listed Plugins not fullfilling all requiremends Developing own Jira-Plugins is complex and time consuming
lack of features
12
Jira
API documentation for Jira REST-WebserviceshttpsdocsatlassiancomjiraRESTlatest
URL structure httphostportcontextrestapi-nameapi-versionresource-name
Using an issue identfiied by the key JRA-9 would be like httpsjiraatlassiancomrestapilatestissueJRA-9
Using JQL Language (syntax)httpsjiramt-agcomrestapi2searchjql=project=BP
Returning values in JSON Format (testable also in browser)
REST-Webservice
13
JiraJQL
httpsjiramt-agcomrestapi2searchjql=project=BP
14
Jira
addional information when getting REST-Webservice Result
Default max 50 entries 1 solution add parameter ampmaxResults=XXX
2 solution add Parameter ampstartAt=50
Sort the results
If no Authentication needed donlsquot submit usernamepassword -gt you get Unauthorized (401)
REST-Webservice
expandschemanamesstartAt0maxResults50total827issues[hellip]
httpsjiramt-agcomrestapilatestsearchjql=project=BPampmaxResults=1000
httpsjiramt-agcomrestapilatestsearchjql=project=BPampstartAt=50
httpsjiramt-agcomrestapilatestsearchjql=project=BP+order+by+duedate
15
Webservices
getting Error
Example httpsjiraatlassiancomrestapilatestissueJRA-9
ACL
ORA-29273 HTTP request failed ORA-24247 network access denied by access control list (ACL)
begin dbms_network_acl_admincreate_acl(acl =gt jiraatlassiancomxml description =gt An ACL for Calling REST Webservices principal =gt l_principal is_grant =gt true privilege =gt connect start_date =gt systimestamp end_date =gt null)
dbms_network_acl_adminassign_acl(acl =gt jiraatlassiancomxml host =gt jiraatlassiancom lower_port =gt 443 upper_port =gt 443) commitend
16
Webservices
Getting existing ACL Entries
Important for ACL Using Web Service References (shared
components or the APEX_WEB_SERVICE (package) principal = APEX_050000
using utl_http or other packages calling external resources principal = my_schema_name
ACL select aacl ahost alower_port aupper_port pprincipal pprivilege pis_grant to_char(pstart_date DD-MON-YYYY) as start_date to_char(pend_date DD-MON-YYYY) as end_datefrom dba_network_acl_privileges pleft join dba_network_acls a on aacl = pacl
17
Webservicesexporting certificate
18
Webservices
calling https
To solve this problem you have to get the certificates which are used by the server which runs Jira
Getting certificate use your browser and call the URL from the REST-Webservice or even from Jira click on the lock symbol click show certificate
exporting certificate
ORA-29273 HTTP request failed ORA-29024 Certificate validation failure
19
Webservicesimporting certificate
20
Webservices
use the Oracle Wallet Manager (OWM) to import the certificate run ORACLE_HOMEbinowmcl (on windows a link is created)
Import of the certificate is also possible using the command line
create a wallet for the certificate using a path like thisORACLE_BASEadminltSIDgtltname_walletgt
Use automatic login for your wallet (otherwise you have to use the wallet always with your password in your plsql code)
importing certificate
21
Webservice
APEX documentationhttpdocsoraclecomcdE59726_01doc50e39151adm_wrkspc002htmBABHEHAG
Login into your INTERNAL WorkspaceManage InstanceInstance SettingsWallet
certificate in APEX
23
Webservices
Shared Components Web Service References Create
Problems based on single items authentification result as CLOB
only in Collection No support in apex_items report columns
JSON Format
Web Service Reference
24
WebservicesWeb Service Reference
25
Webservice
Call REST
p_http_method GET HEAD POST PUT DELETE Username amp Password supporting Basic Authentication Parameter if parameter beside the URL itself are needed
APEX_WEB_SERVICE
l_clob = apex_web_servicemake_rest_request( p_url =gt
httpsjiraatlassiancomrestapilatestissueJRA-9p_http_method =gt GETp_wallet_path =gt fileCoracleadminorclmein_walletp_username =gt lemmop_password =gt 123456 sbquop_parm_name =gt apex_utilstring_to_table(param1param2)p_parm_value =gt apex_utilstring_to_table(val1val2)
)
26
JSON
Datentypen String
QS - Demo Feature 2015-11-03T134816630+0100
Number 20
Boolean true false
Null null
Array [ hellip hellip]
format
id 17149 self httpsjiramt-agcomrestapilatestissue17149 key BP-7 fields ldquosummary QS - Demo Feature progress progress 19800 total 19800 percent 100 created 2015-11-03T134816630+0100 worklog startAt 0 maxResults 20 total 2 worklogs [ ]
27
JSON
convert clob to JSON object
looping entries
get value
processingl_values apex_jsont_valueshellipapex_jsonparse(p_values =gt l_values p_source =gt l_clob)
for i in 1 apex_jsonget_count(p_values =gt l_values p_path =gt )loop hellip end loop
l_jira_issuekey = apex_jsonget_varchar2(p_values =gt pi_json_issue p_path =gt key)
l_jira_issuetimespent = apex_jsonget_number(p_values =gt pi_json_issue p_path =gt fieldstimespent)
28
JSON
Number as String you have to convert
Datetime as String Converting with
apex_jsonget_datedoesnlsquot work because of format
custom fieldsin Jira are named likecustomfield_xxxxx
special cases
id 17149
created 2015-11-03T134816630+0100l_timestamp = to_timestamp_tz(pi_string YYYY-MM-DDThh24missFF3TZHTZM) l_string = to_char(l_timestamp yyyymmdd hh24miss)l_date = to_date(l_string yyyymmdd hh24miss)apex_jsonget_varchar2(p_values =gt pi_json_issue p_path =gt fieldscustomfield_10000)
29
JSON
Time worked Worklog not with information by day encapsuleted in issue you have call the worklog for every single ticket by one REST Call
special cases
for i in 1 apex_jsonget_count(p_values =gt l_values p_path =gt issues)loop l_rest_response = make_rest_request(pi_url =gt pi_jira_base_url || c_jira_rest_base_path || issue || apex_jsonget_varchar2(p_values =gt l_values p_path =gt issues[ || i || ]key) pi_username =gt pi_username pi_password =gt pi_password) apex_jsonparse(p_values =gt l_values_issue p_source =gt l_rest_response) l_jira_issue = get_issue_from_json(pi_json_issue =gt l_values_issue) for j in 1 apex_jsonget_count(p_values =gt l_values_issue p_path =gt fieldsworklogworklogs) loop l_jira_issue_worklog = get_issue_worklog_from_json(pi_json_issue_worklog =gt l_values_issue pi_path =gt fieldsworklogworklogs[ || j || ] pi_jira_issue_id =gt l_jira_issueid pi_jira_issue_key =gt l_jira_issuekey) pipe row(l_jira_issue_worklog)
30
JSON
transform JSON into type easier to use Transformation in package instead APEX testing possible by using sql Entities defined as column names documentation von
CollectionSpalte ndash JSON ndash Spaltenname im Type
using table function based on defined types
processing create or replace type t_jira_issue force as object(-- id 16276-- c001 id number -- Jira Issue ID
-- self httpsjiramt-agcomrestapi2issue16276-- c003 url_json varchar2(32767) -- c003 - JSON URL
-- key UITFPP-1057bdquo-- c001 key varchar2(32767) -- Issue Keyselect
from table(jira_rest_ws_pkgget_projects(pi_base_url =gt httpsjiraatlassiancom))
31
APEX
using APEX_COLLECTIONS not every search means new webservice call loading page doesnlsquot call a webservice APEX itself relies also on collections when working with Web Service References
problem authentication for webservice call every call needs a username amp password using Web Service Reference itlsquos inconvenient using Application Items instead
when logging into the apex application password is saved on server-side by application item attention the password value is visible in session state
32
APEXLivedemo
33
Conclusion
complexity is huge because of many different technical aspects
all important key facts are calculateable
transforming JSON in JavaScript or PLSQL is not easy in the beginning
first time parsing JSON even with APEX_JSON needs practiceremember in 12c you can directly parse JSON by SQL
Using APEX integrated bdquoWeb Service Referenceldquo only for simple examples
OliverLemm
httpoliverlemmblogspotde
httpdelinkedincominOliverLemm
httpswwwxingcomprofileOliver_Lemm
Thanks
- APEX connects Jira
- Facts amp Figures
- about me
- Slide 4
- Agenda
- Motivation
- Jira
- Slide 8
- Jira (2)
- Jira (3)
- Jira (4)
- Jira (5)
- Jira (6)
- Jira (7)
- Webservices
- Webservices (2)
- Webservices (3)
- Webservices (4)
- Webservices (5)
- Webservices (6)
- Webservice
- Webservices (8)
- Webservices (9)
- Webservice (2)
- JSON
- JSON
- JSON (2)
- JSON (3)
- JSON (4)
- APEX
- APEX (2)
- Conclusion
- Slide 34
-
6
Motivation
bdquoWorking with one tool to handle the developing process controlling and all other processes in one projectldquo
bdquoCalculating key figures based on Jira values which are not delivered by Jira itselfldquo
bdquoUsing integrated Jira Plugins and adding additional functionality by using APEX as known technologyldquo
requirements
7
Jira
httpswwwatlassiancomJIRA
Issue tracking and code integration Supporting Dashboards amp Plugins perfect integration from Confluence (wiki)
and Subversion (versioning)
supporting complex workflows
Issue import from Bugzilla Mantis GitHub hellip
Supporting von REST-Webservices
8
9
JiraWorkflow
10
Jira
supporting a huge number of attributes time tracking (estimated time spent remaining) Components (can be used for APEX pages and database objects) versions
fields and screens adjustable per project external issue numbers date of commision date of payment
Supporting own workflows Describing a whole process usable for non developing processes Every step can be defined by user rights or issue dependencies
Using bdquoJIRA Timesheet Reports and Gadgets Pluginldquo
Integrated features
11
Jira
key figures not in desired aggregation time per yearmonth
no further support for SOAP Webservices in Jira SOAP Interface doesnlsquot return all values
Using Jira-Plugins Listed Plugins not fullfilling all requiremends Developing own Jira-Plugins is complex and time consuming
lack of features
12
Jira
API documentation for Jira REST-WebserviceshttpsdocsatlassiancomjiraRESTlatest
URL structure httphostportcontextrestapi-nameapi-versionresource-name
Using an issue identfiied by the key JRA-9 would be like httpsjiraatlassiancomrestapilatestissueJRA-9
Using JQL Language (syntax)httpsjiramt-agcomrestapi2searchjql=project=BP
Returning values in JSON Format (testable also in browser)
REST-Webservice
13
JiraJQL
httpsjiramt-agcomrestapi2searchjql=project=BP
14
Jira
addional information when getting REST-Webservice Result
Default max 50 entries 1 solution add parameter ampmaxResults=XXX
2 solution add Parameter ampstartAt=50
Sort the results
If no Authentication needed donlsquot submit usernamepassword -gt you get Unauthorized (401)
REST-Webservice
expandschemanamesstartAt0maxResults50total827issues[hellip]
httpsjiramt-agcomrestapilatestsearchjql=project=BPampmaxResults=1000
httpsjiramt-agcomrestapilatestsearchjql=project=BPampstartAt=50
httpsjiramt-agcomrestapilatestsearchjql=project=BP+order+by+duedate
15
Webservices
getting Error
Example httpsjiraatlassiancomrestapilatestissueJRA-9
ACL
ORA-29273 HTTP request failed ORA-24247 network access denied by access control list (ACL)
begin dbms_network_acl_admincreate_acl(acl =gt jiraatlassiancomxml description =gt An ACL for Calling REST Webservices principal =gt l_principal is_grant =gt true privilege =gt connect start_date =gt systimestamp end_date =gt null)
dbms_network_acl_adminassign_acl(acl =gt jiraatlassiancomxml host =gt jiraatlassiancom lower_port =gt 443 upper_port =gt 443) commitend
16
Webservices
Getting existing ACL Entries
Important for ACL Using Web Service References (shared
components or the APEX_WEB_SERVICE (package) principal = APEX_050000
using utl_http or other packages calling external resources principal = my_schema_name
ACL select aacl ahost alower_port aupper_port pprincipal pprivilege pis_grant to_char(pstart_date DD-MON-YYYY) as start_date to_char(pend_date DD-MON-YYYY) as end_datefrom dba_network_acl_privileges pleft join dba_network_acls a on aacl = pacl
17
Webservicesexporting certificate
18
Webservices
calling https
To solve this problem you have to get the certificates which are used by the server which runs Jira
Getting certificate use your browser and call the URL from the REST-Webservice or even from Jira click on the lock symbol click show certificate
exporting certificate
ORA-29273 HTTP request failed ORA-29024 Certificate validation failure
19
Webservicesimporting certificate
20
Webservices
use the Oracle Wallet Manager (OWM) to import the certificate run ORACLE_HOMEbinowmcl (on windows a link is created)
Import of the certificate is also possible using the command line
create a wallet for the certificate using a path like thisORACLE_BASEadminltSIDgtltname_walletgt
Use automatic login for your wallet (otherwise you have to use the wallet always with your password in your plsql code)
importing certificate
21
Webservice
APEX documentationhttpdocsoraclecomcdE59726_01doc50e39151adm_wrkspc002htmBABHEHAG
Login into your INTERNAL WorkspaceManage InstanceInstance SettingsWallet
certificate in APEX
23
Webservices
Shared Components Web Service References Create
Problems based on single items authentification result as CLOB
only in Collection No support in apex_items report columns
JSON Format
Web Service Reference
24
WebservicesWeb Service Reference
25
Webservice
Call REST
p_http_method GET HEAD POST PUT DELETE Username amp Password supporting Basic Authentication Parameter if parameter beside the URL itself are needed
APEX_WEB_SERVICE
l_clob = apex_web_servicemake_rest_request( p_url =gt
httpsjiraatlassiancomrestapilatestissueJRA-9p_http_method =gt GETp_wallet_path =gt fileCoracleadminorclmein_walletp_username =gt lemmop_password =gt 123456 sbquop_parm_name =gt apex_utilstring_to_table(param1param2)p_parm_value =gt apex_utilstring_to_table(val1val2)
)
26
JSON
Datentypen String
QS - Demo Feature 2015-11-03T134816630+0100
Number 20
Boolean true false
Null null
Array [ hellip hellip]
format
id 17149 self httpsjiramt-agcomrestapilatestissue17149 key BP-7 fields ldquosummary QS - Demo Feature progress progress 19800 total 19800 percent 100 created 2015-11-03T134816630+0100 worklog startAt 0 maxResults 20 total 2 worklogs [ ]
27
JSON
convert clob to JSON object
looping entries
get value
processingl_values apex_jsont_valueshellipapex_jsonparse(p_values =gt l_values p_source =gt l_clob)
for i in 1 apex_jsonget_count(p_values =gt l_values p_path =gt )loop hellip end loop
l_jira_issuekey = apex_jsonget_varchar2(p_values =gt pi_json_issue p_path =gt key)
l_jira_issuetimespent = apex_jsonget_number(p_values =gt pi_json_issue p_path =gt fieldstimespent)
28
JSON
Number as String you have to convert
Datetime as String Converting with
apex_jsonget_datedoesnlsquot work because of format
custom fieldsin Jira are named likecustomfield_xxxxx
special cases
id 17149
created 2015-11-03T134816630+0100l_timestamp = to_timestamp_tz(pi_string YYYY-MM-DDThh24missFF3TZHTZM) l_string = to_char(l_timestamp yyyymmdd hh24miss)l_date = to_date(l_string yyyymmdd hh24miss)apex_jsonget_varchar2(p_values =gt pi_json_issue p_path =gt fieldscustomfield_10000)
29
JSON
Time worked Worklog not with information by day encapsuleted in issue you have call the worklog for every single ticket by one REST Call
special cases
for i in 1 apex_jsonget_count(p_values =gt l_values p_path =gt issues)loop l_rest_response = make_rest_request(pi_url =gt pi_jira_base_url || c_jira_rest_base_path || issue || apex_jsonget_varchar2(p_values =gt l_values p_path =gt issues[ || i || ]key) pi_username =gt pi_username pi_password =gt pi_password) apex_jsonparse(p_values =gt l_values_issue p_source =gt l_rest_response) l_jira_issue = get_issue_from_json(pi_json_issue =gt l_values_issue) for j in 1 apex_jsonget_count(p_values =gt l_values_issue p_path =gt fieldsworklogworklogs) loop l_jira_issue_worklog = get_issue_worklog_from_json(pi_json_issue_worklog =gt l_values_issue pi_path =gt fieldsworklogworklogs[ || j || ] pi_jira_issue_id =gt l_jira_issueid pi_jira_issue_key =gt l_jira_issuekey) pipe row(l_jira_issue_worklog)
30
JSON
transform JSON into type easier to use Transformation in package instead APEX testing possible by using sql Entities defined as column names documentation von
CollectionSpalte ndash JSON ndash Spaltenname im Type
using table function based on defined types
processing create or replace type t_jira_issue force as object(-- id 16276-- c001 id number -- Jira Issue ID
-- self httpsjiramt-agcomrestapi2issue16276-- c003 url_json varchar2(32767) -- c003 - JSON URL
-- key UITFPP-1057bdquo-- c001 key varchar2(32767) -- Issue Keyselect
from table(jira_rest_ws_pkgget_projects(pi_base_url =gt httpsjiraatlassiancom))
31
APEX
using APEX_COLLECTIONS not every search means new webservice call loading page doesnlsquot call a webservice APEX itself relies also on collections when working with Web Service References
problem authentication for webservice call every call needs a username amp password using Web Service Reference itlsquos inconvenient using Application Items instead
when logging into the apex application password is saved on server-side by application item attention the password value is visible in session state
32
APEXLivedemo
33
Conclusion
complexity is huge because of many different technical aspects
all important key facts are calculateable
transforming JSON in JavaScript or PLSQL is not easy in the beginning
first time parsing JSON even with APEX_JSON needs practiceremember in 12c you can directly parse JSON by SQL
Using APEX integrated bdquoWeb Service Referenceldquo only for simple examples
OliverLemm
httpoliverlemmblogspotde
httpdelinkedincominOliverLemm
httpswwwxingcomprofileOliver_Lemm
Thanks
- APEX connects Jira
- Facts amp Figures
- about me
- Slide 4
- Agenda
- Motivation
- Jira
- Slide 8
- Jira (2)
- Jira (3)
- Jira (4)
- Jira (5)
- Jira (6)
- Jira (7)
- Webservices
- Webservices (2)
- Webservices (3)
- Webservices (4)
- Webservices (5)
- Webservices (6)
- Webservice
- Webservices (8)
- Webservices (9)
- Webservice (2)
- JSON
- JSON
- JSON (2)
- JSON (3)
- JSON (4)
- APEX
- APEX (2)
- Conclusion
- Slide 34
-
7
Jira
httpswwwatlassiancomJIRA
Issue tracking and code integration Supporting Dashboards amp Plugins perfect integration from Confluence (wiki)
and Subversion (versioning)
supporting complex workflows
Issue import from Bugzilla Mantis GitHub hellip
Supporting von REST-Webservices
8
9
JiraWorkflow
10
Jira
supporting a huge number of attributes time tracking (estimated time spent remaining) Components (can be used for APEX pages and database objects) versions
fields and screens adjustable per project external issue numbers date of commision date of payment
Supporting own workflows Describing a whole process usable for non developing processes Every step can be defined by user rights or issue dependencies
Using bdquoJIRA Timesheet Reports and Gadgets Pluginldquo
Integrated features
11
Jira
key figures not in desired aggregation time per yearmonth
no further support for SOAP Webservices in Jira SOAP Interface doesnlsquot return all values
Using Jira-Plugins Listed Plugins not fullfilling all requiremends Developing own Jira-Plugins is complex and time consuming
lack of features
12
Jira
API documentation for Jira REST-WebserviceshttpsdocsatlassiancomjiraRESTlatest
URL structure httphostportcontextrestapi-nameapi-versionresource-name
Using an issue identfiied by the key JRA-9 would be like httpsjiraatlassiancomrestapilatestissueJRA-9
Using JQL Language (syntax)httpsjiramt-agcomrestapi2searchjql=project=BP
Returning values in JSON Format (testable also in browser)
REST-Webservice
13
JiraJQL
httpsjiramt-agcomrestapi2searchjql=project=BP
14
Jira
addional information when getting REST-Webservice Result
Default max 50 entries 1 solution add parameter ampmaxResults=XXX
2 solution add Parameter ampstartAt=50
Sort the results
If no Authentication needed donlsquot submit usernamepassword -gt you get Unauthorized (401)
REST-Webservice
expandschemanamesstartAt0maxResults50total827issues[hellip]
httpsjiramt-agcomrestapilatestsearchjql=project=BPampmaxResults=1000
httpsjiramt-agcomrestapilatestsearchjql=project=BPampstartAt=50
httpsjiramt-agcomrestapilatestsearchjql=project=BP+order+by+duedate
15
Webservices
getting Error
Example httpsjiraatlassiancomrestapilatestissueJRA-9
ACL
ORA-29273 HTTP request failed ORA-24247 network access denied by access control list (ACL)
begin dbms_network_acl_admincreate_acl(acl =gt jiraatlassiancomxml description =gt An ACL for Calling REST Webservices principal =gt l_principal is_grant =gt true privilege =gt connect start_date =gt systimestamp end_date =gt null)
dbms_network_acl_adminassign_acl(acl =gt jiraatlassiancomxml host =gt jiraatlassiancom lower_port =gt 443 upper_port =gt 443) commitend
16
Webservices
Getting existing ACL Entries
Important for ACL Using Web Service References (shared
components or the APEX_WEB_SERVICE (package) principal = APEX_050000
using utl_http or other packages calling external resources principal = my_schema_name
ACL select aacl ahost alower_port aupper_port pprincipal pprivilege pis_grant to_char(pstart_date DD-MON-YYYY) as start_date to_char(pend_date DD-MON-YYYY) as end_datefrom dba_network_acl_privileges pleft join dba_network_acls a on aacl = pacl
17
Webservicesexporting certificate
18
Webservices
calling https
To solve this problem you have to get the certificates which are used by the server which runs Jira
Getting certificate use your browser and call the URL from the REST-Webservice or even from Jira click on the lock symbol click show certificate
exporting certificate
ORA-29273 HTTP request failed ORA-29024 Certificate validation failure
19
Webservicesimporting certificate
20
Webservices
use the Oracle Wallet Manager (OWM) to import the certificate run ORACLE_HOMEbinowmcl (on windows a link is created)
Import of the certificate is also possible using the command line
create a wallet for the certificate using a path like thisORACLE_BASEadminltSIDgtltname_walletgt
Use automatic login for your wallet (otherwise you have to use the wallet always with your password in your plsql code)
importing certificate
21
Webservice
APEX documentationhttpdocsoraclecomcdE59726_01doc50e39151adm_wrkspc002htmBABHEHAG
Login into your INTERNAL WorkspaceManage InstanceInstance SettingsWallet
certificate in APEX
23
Webservices
Shared Components Web Service References Create
Problems based on single items authentification result as CLOB
only in Collection No support in apex_items report columns
JSON Format
Web Service Reference
24
WebservicesWeb Service Reference
25
Webservice
Call REST
p_http_method GET HEAD POST PUT DELETE Username amp Password supporting Basic Authentication Parameter if parameter beside the URL itself are needed
APEX_WEB_SERVICE
l_clob = apex_web_servicemake_rest_request( p_url =gt
httpsjiraatlassiancomrestapilatestissueJRA-9p_http_method =gt GETp_wallet_path =gt fileCoracleadminorclmein_walletp_username =gt lemmop_password =gt 123456 sbquop_parm_name =gt apex_utilstring_to_table(param1param2)p_parm_value =gt apex_utilstring_to_table(val1val2)
)
26
JSON
Datentypen String
QS - Demo Feature 2015-11-03T134816630+0100
Number 20
Boolean true false
Null null
Array [ hellip hellip]
format
id 17149 self httpsjiramt-agcomrestapilatestissue17149 key BP-7 fields ldquosummary QS - Demo Feature progress progress 19800 total 19800 percent 100 created 2015-11-03T134816630+0100 worklog startAt 0 maxResults 20 total 2 worklogs [ ]
27
JSON
convert clob to JSON object
looping entries
get value
processingl_values apex_jsont_valueshellipapex_jsonparse(p_values =gt l_values p_source =gt l_clob)
for i in 1 apex_jsonget_count(p_values =gt l_values p_path =gt )loop hellip end loop
l_jira_issuekey = apex_jsonget_varchar2(p_values =gt pi_json_issue p_path =gt key)
l_jira_issuetimespent = apex_jsonget_number(p_values =gt pi_json_issue p_path =gt fieldstimespent)
28
JSON
Number as String you have to convert
Datetime as String Converting with
apex_jsonget_datedoesnlsquot work because of format
custom fieldsin Jira are named likecustomfield_xxxxx
special cases
id 17149
created 2015-11-03T134816630+0100l_timestamp = to_timestamp_tz(pi_string YYYY-MM-DDThh24missFF3TZHTZM) l_string = to_char(l_timestamp yyyymmdd hh24miss)l_date = to_date(l_string yyyymmdd hh24miss)apex_jsonget_varchar2(p_values =gt pi_json_issue p_path =gt fieldscustomfield_10000)
29
JSON
Time worked Worklog not with information by day encapsuleted in issue you have call the worklog for every single ticket by one REST Call
special cases
for i in 1 apex_jsonget_count(p_values =gt l_values p_path =gt issues)loop l_rest_response = make_rest_request(pi_url =gt pi_jira_base_url || c_jira_rest_base_path || issue || apex_jsonget_varchar2(p_values =gt l_values p_path =gt issues[ || i || ]key) pi_username =gt pi_username pi_password =gt pi_password) apex_jsonparse(p_values =gt l_values_issue p_source =gt l_rest_response) l_jira_issue = get_issue_from_json(pi_json_issue =gt l_values_issue) for j in 1 apex_jsonget_count(p_values =gt l_values_issue p_path =gt fieldsworklogworklogs) loop l_jira_issue_worklog = get_issue_worklog_from_json(pi_json_issue_worklog =gt l_values_issue pi_path =gt fieldsworklogworklogs[ || j || ] pi_jira_issue_id =gt l_jira_issueid pi_jira_issue_key =gt l_jira_issuekey) pipe row(l_jira_issue_worklog)
30
JSON
transform JSON into type easier to use Transformation in package instead APEX testing possible by using sql Entities defined as column names documentation von
CollectionSpalte ndash JSON ndash Spaltenname im Type
using table function based on defined types
processing create or replace type t_jira_issue force as object(-- id 16276-- c001 id number -- Jira Issue ID
-- self httpsjiramt-agcomrestapi2issue16276-- c003 url_json varchar2(32767) -- c003 - JSON URL
-- key UITFPP-1057bdquo-- c001 key varchar2(32767) -- Issue Keyselect
from table(jira_rest_ws_pkgget_projects(pi_base_url =gt httpsjiraatlassiancom))
31
APEX
using APEX_COLLECTIONS not every search means new webservice call loading page doesnlsquot call a webservice APEX itself relies also on collections when working with Web Service References
problem authentication for webservice call every call needs a username amp password using Web Service Reference itlsquos inconvenient using Application Items instead
when logging into the apex application password is saved on server-side by application item attention the password value is visible in session state
32
APEXLivedemo
33
Conclusion
complexity is huge because of many different technical aspects
all important key facts are calculateable
transforming JSON in JavaScript or PLSQL is not easy in the beginning
first time parsing JSON even with APEX_JSON needs practiceremember in 12c you can directly parse JSON by SQL
Using APEX integrated bdquoWeb Service Referenceldquo only for simple examples
OliverLemm
httpoliverlemmblogspotde
httpdelinkedincominOliverLemm
httpswwwxingcomprofileOliver_Lemm
Thanks
- APEX connects Jira
- Facts amp Figures
- about me
- Slide 4
- Agenda
- Motivation
- Jira
- Slide 8
- Jira (2)
- Jira (3)
- Jira (4)
- Jira (5)
- Jira (6)
- Jira (7)
- Webservices
- Webservices (2)
- Webservices (3)
- Webservices (4)
- Webservices (5)
- Webservices (6)
- Webservice
- Webservices (8)
- Webservices (9)
- Webservice (2)
- JSON
- JSON
- JSON (2)
- JSON (3)
- JSON (4)
- APEX
- APEX (2)
- Conclusion
- Slide 34
-
8
9
JiraWorkflow
10
Jira
supporting a huge number of attributes time tracking (estimated time spent remaining) Components (can be used for APEX pages and database objects) versions
fields and screens adjustable per project external issue numbers date of commision date of payment
Supporting own workflows Describing a whole process usable for non developing processes Every step can be defined by user rights or issue dependencies
Using bdquoJIRA Timesheet Reports and Gadgets Pluginldquo
Integrated features
11
Jira
key figures not in desired aggregation time per yearmonth
no further support for SOAP Webservices in Jira SOAP Interface doesnlsquot return all values
Using Jira-Plugins Listed Plugins not fullfilling all requiremends Developing own Jira-Plugins is complex and time consuming
lack of features
12
Jira
API documentation for Jira REST-WebserviceshttpsdocsatlassiancomjiraRESTlatest
URL structure httphostportcontextrestapi-nameapi-versionresource-name
Using an issue identfiied by the key JRA-9 would be like httpsjiraatlassiancomrestapilatestissueJRA-9
Using JQL Language (syntax)httpsjiramt-agcomrestapi2searchjql=project=BP
Returning values in JSON Format (testable also in browser)
REST-Webservice
13
JiraJQL
httpsjiramt-agcomrestapi2searchjql=project=BP
14
Jira
addional information when getting REST-Webservice Result
Default max 50 entries 1 solution add parameter ampmaxResults=XXX
2 solution add Parameter ampstartAt=50
Sort the results
If no Authentication needed donlsquot submit usernamepassword -gt you get Unauthorized (401)
REST-Webservice
expandschemanamesstartAt0maxResults50total827issues[hellip]
httpsjiramt-agcomrestapilatestsearchjql=project=BPampmaxResults=1000
httpsjiramt-agcomrestapilatestsearchjql=project=BPampstartAt=50
httpsjiramt-agcomrestapilatestsearchjql=project=BP+order+by+duedate
15
Webservices
getting Error
Example httpsjiraatlassiancomrestapilatestissueJRA-9
ACL
ORA-29273 HTTP request failed ORA-24247 network access denied by access control list (ACL)
begin dbms_network_acl_admincreate_acl(acl =gt jiraatlassiancomxml description =gt An ACL for Calling REST Webservices principal =gt l_principal is_grant =gt true privilege =gt connect start_date =gt systimestamp end_date =gt null)
dbms_network_acl_adminassign_acl(acl =gt jiraatlassiancomxml host =gt jiraatlassiancom lower_port =gt 443 upper_port =gt 443) commitend
16
Webservices
Getting existing ACL Entries
Important for ACL Using Web Service References (shared
components or the APEX_WEB_SERVICE (package) principal = APEX_050000
using utl_http or other packages calling external resources principal = my_schema_name
ACL select aacl ahost alower_port aupper_port pprincipal pprivilege pis_grant to_char(pstart_date DD-MON-YYYY) as start_date to_char(pend_date DD-MON-YYYY) as end_datefrom dba_network_acl_privileges pleft join dba_network_acls a on aacl = pacl
17
Webservicesexporting certificate
18
Webservices
calling https
To solve this problem you have to get the certificates which are used by the server which runs Jira
Getting certificate use your browser and call the URL from the REST-Webservice or even from Jira click on the lock symbol click show certificate
exporting certificate
ORA-29273 HTTP request failed ORA-29024 Certificate validation failure
19
Webservicesimporting certificate
20
Webservices
use the Oracle Wallet Manager (OWM) to import the certificate run ORACLE_HOMEbinowmcl (on windows a link is created)
Import of the certificate is also possible using the command line
create a wallet for the certificate using a path like thisORACLE_BASEadminltSIDgtltname_walletgt
Use automatic login for your wallet (otherwise you have to use the wallet always with your password in your plsql code)
importing certificate
21
Webservice
APEX documentationhttpdocsoraclecomcdE59726_01doc50e39151adm_wrkspc002htmBABHEHAG
Login into your INTERNAL WorkspaceManage InstanceInstance SettingsWallet
certificate in APEX
23
Webservices
Shared Components Web Service References Create
Problems based on single items authentification result as CLOB
only in Collection No support in apex_items report columns
JSON Format
Web Service Reference
24
WebservicesWeb Service Reference
25
Webservice
Call REST
p_http_method GET HEAD POST PUT DELETE Username amp Password supporting Basic Authentication Parameter if parameter beside the URL itself are needed
APEX_WEB_SERVICE
l_clob = apex_web_servicemake_rest_request( p_url =gt
httpsjiraatlassiancomrestapilatestissueJRA-9p_http_method =gt GETp_wallet_path =gt fileCoracleadminorclmein_walletp_username =gt lemmop_password =gt 123456 sbquop_parm_name =gt apex_utilstring_to_table(param1param2)p_parm_value =gt apex_utilstring_to_table(val1val2)
)
26
JSON
Datentypen String
QS - Demo Feature 2015-11-03T134816630+0100
Number 20
Boolean true false
Null null
Array [ hellip hellip]
format
id 17149 self httpsjiramt-agcomrestapilatestissue17149 key BP-7 fields ldquosummary QS - Demo Feature progress progress 19800 total 19800 percent 100 created 2015-11-03T134816630+0100 worklog startAt 0 maxResults 20 total 2 worklogs [ ]
27
JSON
convert clob to JSON object
looping entries
get value
processingl_values apex_jsont_valueshellipapex_jsonparse(p_values =gt l_values p_source =gt l_clob)
for i in 1 apex_jsonget_count(p_values =gt l_values p_path =gt )loop hellip end loop
l_jira_issuekey = apex_jsonget_varchar2(p_values =gt pi_json_issue p_path =gt key)
l_jira_issuetimespent = apex_jsonget_number(p_values =gt pi_json_issue p_path =gt fieldstimespent)
28
JSON
Number as String you have to convert
Datetime as String Converting with
apex_jsonget_datedoesnlsquot work because of format
custom fieldsin Jira are named likecustomfield_xxxxx
special cases
id 17149
created 2015-11-03T134816630+0100l_timestamp = to_timestamp_tz(pi_string YYYY-MM-DDThh24missFF3TZHTZM) l_string = to_char(l_timestamp yyyymmdd hh24miss)l_date = to_date(l_string yyyymmdd hh24miss)apex_jsonget_varchar2(p_values =gt pi_json_issue p_path =gt fieldscustomfield_10000)
29
JSON
Time worked Worklog not with information by day encapsuleted in issue you have call the worklog for every single ticket by one REST Call
special cases
for i in 1 apex_jsonget_count(p_values =gt l_values p_path =gt issues)loop l_rest_response = make_rest_request(pi_url =gt pi_jira_base_url || c_jira_rest_base_path || issue || apex_jsonget_varchar2(p_values =gt l_values p_path =gt issues[ || i || ]key) pi_username =gt pi_username pi_password =gt pi_password) apex_jsonparse(p_values =gt l_values_issue p_source =gt l_rest_response) l_jira_issue = get_issue_from_json(pi_json_issue =gt l_values_issue) for j in 1 apex_jsonget_count(p_values =gt l_values_issue p_path =gt fieldsworklogworklogs) loop l_jira_issue_worklog = get_issue_worklog_from_json(pi_json_issue_worklog =gt l_values_issue pi_path =gt fieldsworklogworklogs[ || j || ] pi_jira_issue_id =gt l_jira_issueid pi_jira_issue_key =gt l_jira_issuekey) pipe row(l_jira_issue_worklog)
30
JSON
transform JSON into type easier to use Transformation in package instead APEX testing possible by using sql Entities defined as column names documentation von
CollectionSpalte ndash JSON ndash Spaltenname im Type
using table function based on defined types
processing create or replace type t_jira_issue force as object(-- id 16276-- c001 id number -- Jira Issue ID
-- self httpsjiramt-agcomrestapi2issue16276-- c003 url_json varchar2(32767) -- c003 - JSON URL
-- key UITFPP-1057bdquo-- c001 key varchar2(32767) -- Issue Keyselect
from table(jira_rest_ws_pkgget_projects(pi_base_url =gt httpsjiraatlassiancom))
31
APEX
using APEX_COLLECTIONS not every search means new webservice call loading page doesnlsquot call a webservice APEX itself relies also on collections when working with Web Service References
problem authentication for webservice call every call needs a username amp password using Web Service Reference itlsquos inconvenient using Application Items instead
when logging into the apex application password is saved on server-side by application item attention the password value is visible in session state
32
APEXLivedemo
33
Conclusion
complexity is huge because of many different technical aspects
all important key facts are calculateable
transforming JSON in JavaScript or PLSQL is not easy in the beginning
first time parsing JSON even with APEX_JSON needs practiceremember in 12c you can directly parse JSON by SQL
Using APEX integrated bdquoWeb Service Referenceldquo only for simple examples
OliverLemm
httpoliverlemmblogspotde
httpdelinkedincominOliverLemm
httpswwwxingcomprofileOliver_Lemm
Thanks
- APEX connects Jira
- Facts amp Figures
- about me
- Slide 4
- Agenda
- Motivation
- Jira
- Slide 8
- Jira (2)
- Jira (3)
- Jira (4)
- Jira (5)
- Jira (6)
- Jira (7)
- Webservices
- Webservices (2)
- Webservices (3)
- Webservices (4)
- Webservices (5)
- Webservices (6)
- Webservice
- Webservices (8)
- Webservices (9)
- Webservice (2)
- JSON
- JSON
- JSON (2)
- JSON (3)
- JSON (4)
- APEX
- APEX (2)
- Conclusion
- Slide 34
-
9
JiraWorkflow
10
Jira
supporting a huge number of attributes time tracking (estimated time spent remaining) Components (can be used for APEX pages and database objects) versions
fields and screens adjustable per project external issue numbers date of commision date of payment
Supporting own workflows Describing a whole process usable for non developing processes Every step can be defined by user rights or issue dependencies
Using bdquoJIRA Timesheet Reports and Gadgets Pluginldquo
Integrated features
11
Jira
key figures not in desired aggregation time per yearmonth
no further support for SOAP Webservices in Jira SOAP Interface doesnlsquot return all values
Using Jira-Plugins Listed Plugins not fullfilling all requiremends Developing own Jira-Plugins is complex and time consuming
lack of features
12
Jira
API documentation for Jira REST-WebserviceshttpsdocsatlassiancomjiraRESTlatest
URL structure httphostportcontextrestapi-nameapi-versionresource-name
Using an issue identfiied by the key JRA-9 would be like httpsjiraatlassiancomrestapilatestissueJRA-9
Using JQL Language (syntax)httpsjiramt-agcomrestapi2searchjql=project=BP
Returning values in JSON Format (testable also in browser)
REST-Webservice
13
JiraJQL
httpsjiramt-agcomrestapi2searchjql=project=BP
14
Jira
addional information when getting REST-Webservice Result
Default max 50 entries 1 solution add parameter ampmaxResults=XXX
2 solution add Parameter ampstartAt=50
Sort the results
If no Authentication needed donlsquot submit usernamepassword -gt you get Unauthorized (401)
REST-Webservice
expandschemanamesstartAt0maxResults50total827issues[hellip]
httpsjiramt-agcomrestapilatestsearchjql=project=BPampmaxResults=1000
httpsjiramt-agcomrestapilatestsearchjql=project=BPampstartAt=50
httpsjiramt-agcomrestapilatestsearchjql=project=BP+order+by+duedate
15
Webservices
getting Error
Example httpsjiraatlassiancomrestapilatestissueJRA-9
ACL
ORA-29273 HTTP request failed ORA-24247 network access denied by access control list (ACL)
begin dbms_network_acl_admincreate_acl(acl =gt jiraatlassiancomxml description =gt An ACL for Calling REST Webservices principal =gt l_principal is_grant =gt true privilege =gt connect start_date =gt systimestamp end_date =gt null)
dbms_network_acl_adminassign_acl(acl =gt jiraatlassiancomxml host =gt jiraatlassiancom lower_port =gt 443 upper_port =gt 443) commitend
16
Webservices
Getting existing ACL Entries
Important for ACL Using Web Service References (shared
components or the APEX_WEB_SERVICE (package) principal = APEX_050000
using utl_http or other packages calling external resources principal = my_schema_name
ACL select aacl ahost alower_port aupper_port pprincipal pprivilege pis_grant to_char(pstart_date DD-MON-YYYY) as start_date to_char(pend_date DD-MON-YYYY) as end_datefrom dba_network_acl_privileges pleft join dba_network_acls a on aacl = pacl
17
Webservicesexporting certificate
18
Webservices
calling https
To solve this problem you have to get the certificates which are used by the server which runs Jira
Getting certificate use your browser and call the URL from the REST-Webservice or even from Jira click on the lock symbol click show certificate
exporting certificate
ORA-29273 HTTP request failed ORA-29024 Certificate validation failure
19
Webservicesimporting certificate
20
Webservices
use the Oracle Wallet Manager (OWM) to import the certificate run ORACLE_HOMEbinowmcl (on windows a link is created)
Import of the certificate is also possible using the command line
create a wallet for the certificate using a path like thisORACLE_BASEadminltSIDgtltname_walletgt
Use automatic login for your wallet (otherwise you have to use the wallet always with your password in your plsql code)
importing certificate
21
Webservice
APEX documentationhttpdocsoraclecomcdE59726_01doc50e39151adm_wrkspc002htmBABHEHAG
Login into your INTERNAL WorkspaceManage InstanceInstance SettingsWallet
certificate in APEX
23
Webservices
Shared Components Web Service References Create
Problems based on single items authentification result as CLOB
only in Collection No support in apex_items report columns
JSON Format
Web Service Reference
24
WebservicesWeb Service Reference
25
Webservice
Call REST
p_http_method GET HEAD POST PUT DELETE Username amp Password supporting Basic Authentication Parameter if parameter beside the URL itself are needed
APEX_WEB_SERVICE
l_clob = apex_web_servicemake_rest_request( p_url =gt
httpsjiraatlassiancomrestapilatestissueJRA-9p_http_method =gt GETp_wallet_path =gt fileCoracleadminorclmein_walletp_username =gt lemmop_password =gt 123456 sbquop_parm_name =gt apex_utilstring_to_table(param1param2)p_parm_value =gt apex_utilstring_to_table(val1val2)
)
26
JSON
Datentypen String
QS - Demo Feature 2015-11-03T134816630+0100
Number 20
Boolean true false
Null null
Array [ hellip hellip]
format
id 17149 self httpsjiramt-agcomrestapilatestissue17149 key BP-7 fields ldquosummary QS - Demo Feature progress progress 19800 total 19800 percent 100 created 2015-11-03T134816630+0100 worklog startAt 0 maxResults 20 total 2 worklogs [ ]
27
JSON
convert clob to JSON object
looping entries
get value
processingl_values apex_jsont_valueshellipapex_jsonparse(p_values =gt l_values p_source =gt l_clob)
for i in 1 apex_jsonget_count(p_values =gt l_values p_path =gt )loop hellip end loop
l_jira_issuekey = apex_jsonget_varchar2(p_values =gt pi_json_issue p_path =gt key)
l_jira_issuetimespent = apex_jsonget_number(p_values =gt pi_json_issue p_path =gt fieldstimespent)
28
JSON
Number as String you have to convert
Datetime as String Converting with
apex_jsonget_datedoesnlsquot work because of format
custom fieldsin Jira are named likecustomfield_xxxxx
special cases
id 17149
created 2015-11-03T134816630+0100l_timestamp = to_timestamp_tz(pi_string YYYY-MM-DDThh24missFF3TZHTZM) l_string = to_char(l_timestamp yyyymmdd hh24miss)l_date = to_date(l_string yyyymmdd hh24miss)apex_jsonget_varchar2(p_values =gt pi_json_issue p_path =gt fieldscustomfield_10000)
29
JSON
Time worked Worklog not with information by day encapsuleted in issue you have call the worklog for every single ticket by one REST Call
special cases
for i in 1 apex_jsonget_count(p_values =gt l_values p_path =gt issues)loop l_rest_response = make_rest_request(pi_url =gt pi_jira_base_url || c_jira_rest_base_path || issue || apex_jsonget_varchar2(p_values =gt l_values p_path =gt issues[ || i || ]key) pi_username =gt pi_username pi_password =gt pi_password) apex_jsonparse(p_values =gt l_values_issue p_source =gt l_rest_response) l_jira_issue = get_issue_from_json(pi_json_issue =gt l_values_issue) for j in 1 apex_jsonget_count(p_values =gt l_values_issue p_path =gt fieldsworklogworklogs) loop l_jira_issue_worklog = get_issue_worklog_from_json(pi_json_issue_worklog =gt l_values_issue pi_path =gt fieldsworklogworklogs[ || j || ] pi_jira_issue_id =gt l_jira_issueid pi_jira_issue_key =gt l_jira_issuekey) pipe row(l_jira_issue_worklog)
30
JSON
transform JSON into type easier to use Transformation in package instead APEX testing possible by using sql Entities defined as column names documentation von
CollectionSpalte ndash JSON ndash Spaltenname im Type
using table function based on defined types
processing create or replace type t_jira_issue force as object(-- id 16276-- c001 id number -- Jira Issue ID
-- self httpsjiramt-agcomrestapi2issue16276-- c003 url_json varchar2(32767) -- c003 - JSON URL
-- key UITFPP-1057bdquo-- c001 key varchar2(32767) -- Issue Keyselect
from table(jira_rest_ws_pkgget_projects(pi_base_url =gt httpsjiraatlassiancom))
31
APEX
using APEX_COLLECTIONS not every search means new webservice call loading page doesnlsquot call a webservice APEX itself relies also on collections when working with Web Service References
problem authentication for webservice call every call needs a username amp password using Web Service Reference itlsquos inconvenient using Application Items instead
when logging into the apex application password is saved on server-side by application item attention the password value is visible in session state
32
APEXLivedemo
33
Conclusion
complexity is huge because of many different technical aspects
all important key facts are calculateable
transforming JSON in JavaScript or PLSQL is not easy in the beginning
first time parsing JSON even with APEX_JSON needs practiceremember in 12c you can directly parse JSON by SQL
Using APEX integrated bdquoWeb Service Referenceldquo only for simple examples
OliverLemm
httpoliverlemmblogspotde
httpdelinkedincominOliverLemm
httpswwwxingcomprofileOliver_Lemm
Thanks
- APEX connects Jira
- Facts amp Figures
- about me
- Slide 4
- Agenda
- Motivation
- Jira
- Slide 8
- Jira (2)
- Jira (3)
- Jira (4)
- Jira (5)
- Jira (6)
- Jira (7)
- Webservices
- Webservices (2)
- Webservices (3)
- Webservices (4)
- Webservices (5)
- Webservices (6)
- Webservice
- Webservices (8)
- Webservices (9)
- Webservice (2)
- JSON
- JSON
- JSON (2)
- JSON (3)
- JSON (4)
- APEX
- APEX (2)
- Conclusion
- Slide 34
-
10
Jira
supporting a huge number of attributes time tracking (estimated time spent remaining) Components (can be used for APEX pages and database objects) versions
fields and screens adjustable per project external issue numbers date of commision date of payment
Supporting own workflows Describing a whole process usable for non developing processes Every step can be defined by user rights or issue dependencies
Using bdquoJIRA Timesheet Reports and Gadgets Pluginldquo
Integrated features
11
Jira
key figures not in desired aggregation time per yearmonth
no further support for SOAP Webservices in Jira SOAP Interface doesnlsquot return all values
Using Jira-Plugins Listed Plugins not fullfilling all requiremends Developing own Jira-Plugins is complex and time consuming
lack of features
12
Jira
API documentation for Jira REST-WebserviceshttpsdocsatlassiancomjiraRESTlatest
URL structure httphostportcontextrestapi-nameapi-versionresource-name
Using an issue identfiied by the key JRA-9 would be like httpsjiraatlassiancomrestapilatestissueJRA-9
Using JQL Language (syntax)httpsjiramt-agcomrestapi2searchjql=project=BP
Returning values in JSON Format (testable also in browser)
REST-Webservice
13
JiraJQL
httpsjiramt-agcomrestapi2searchjql=project=BP
14
Jira
addional information when getting REST-Webservice Result
Default max 50 entries 1 solution add parameter ampmaxResults=XXX
2 solution add Parameter ampstartAt=50
Sort the results
If no Authentication needed donlsquot submit usernamepassword -gt you get Unauthorized (401)
REST-Webservice
expandschemanamesstartAt0maxResults50total827issues[hellip]
httpsjiramt-agcomrestapilatestsearchjql=project=BPampmaxResults=1000
httpsjiramt-agcomrestapilatestsearchjql=project=BPampstartAt=50
httpsjiramt-agcomrestapilatestsearchjql=project=BP+order+by+duedate
15
Webservices
getting Error
Example httpsjiraatlassiancomrestapilatestissueJRA-9
ACL
ORA-29273 HTTP request failed ORA-24247 network access denied by access control list (ACL)
begin dbms_network_acl_admincreate_acl(acl =gt jiraatlassiancomxml description =gt An ACL for Calling REST Webservices principal =gt l_principal is_grant =gt true privilege =gt connect start_date =gt systimestamp end_date =gt null)
dbms_network_acl_adminassign_acl(acl =gt jiraatlassiancomxml host =gt jiraatlassiancom lower_port =gt 443 upper_port =gt 443) commitend
16
Webservices
Getting existing ACL Entries
Important for ACL Using Web Service References (shared
components or the APEX_WEB_SERVICE (package) principal = APEX_050000
using utl_http or other packages calling external resources principal = my_schema_name
ACL select aacl ahost alower_port aupper_port pprincipal pprivilege pis_grant to_char(pstart_date DD-MON-YYYY) as start_date to_char(pend_date DD-MON-YYYY) as end_datefrom dba_network_acl_privileges pleft join dba_network_acls a on aacl = pacl
17
Webservicesexporting certificate
18
Webservices
calling https
To solve this problem you have to get the certificates which are used by the server which runs Jira
Getting certificate use your browser and call the URL from the REST-Webservice or even from Jira click on the lock symbol click show certificate
exporting certificate
ORA-29273 HTTP request failed ORA-29024 Certificate validation failure
19
Webservicesimporting certificate
20
Webservices
use the Oracle Wallet Manager (OWM) to import the certificate run ORACLE_HOMEbinowmcl (on windows a link is created)
Import of the certificate is also possible using the command line
create a wallet for the certificate using a path like thisORACLE_BASEadminltSIDgtltname_walletgt
Use automatic login for your wallet (otherwise you have to use the wallet always with your password in your plsql code)
importing certificate
21
Webservice
APEX documentationhttpdocsoraclecomcdE59726_01doc50e39151adm_wrkspc002htmBABHEHAG
Login into your INTERNAL WorkspaceManage InstanceInstance SettingsWallet
certificate in APEX
23
Webservices
Shared Components Web Service References Create
Problems based on single items authentification result as CLOB
only in Collection No support in apex_items report columns
JSON Format
Web Service Reference
24
WebservicesWeb Service Reference
25
Webservice
Call REST
p_http_method GET HEAD POST PUT DELETE Username amp Password supporting Basic Authentication Parameter if parameter beside the URL itself are needed
APEX_WEB_SERVICE
l_clob = apex_web_servicemake_rest_request( p_url =gt
httpsjiraatlassiancomrestapilatestissueJRA-9p_http_method =gt GETp_wallet_path =gt fileCoracleadminorclmein_walletp_username =gt lemmop_password =gt 123456 sbquop_parm_name =gt apex_utilstring_to_table(param1param2)p_parm_value =gt apex_utilstring_to_table(val1val2)
)
26
JSON
Datentypen String
QS - Demo Feature 2015-11-03T134816630+0100
Number 20
Boolean true false
Null null
Array [ hellip hellip]
format
id 17149 self httpsjiramt-agcomrestapilatestissue17149 key BP-7 fields ldquosummary QS - Demo Feature progress progress 19800 total 19800 percent 100 created 2015-11-03T134816630+0100 worklog startAt 0 maxResults 20 total 2 worklogs [ ]
27
JSON
convert clob to JSON object
looping entries
get value
processingl_values apex_jsont_valueshellipapex_jsonparse(p_values =gt l_values p_source =gt l_clob)
for i in 1 apex_jsonget_count(p_values =gt l_values p_path =gt )loop hellip end loop
l_jira_issuekey = apex_jsonget_varchar2(p_values =gt pi_json_issue p_path =gt key)
l_jira_issuetimespent = apex_jsonget_number(p_values =gt pi_json_issue p_path =gt fieldstimespent)
28
JSON
Number as String you have to convert
Datetime as String Converting with
apex_jsonget_datedoesnlsquot work because of format
custom fieldsin Jira are named likecustomfield_xxxxx
special cases
id 17149
created 2015-11-03T134816630+0100l_timestamp = to_timestamp_tz(pi_string YYYY-MM-DDThh24missFF3TZHTZM) l_string = to_char(l_timestamp yyyymmdd hh24miss)l_date = to_date(l_string yyyymmdd hh24miss)apex_jsonget_varchar2(p_values =gt pi_json_issue p_path =gt fieldscustomfield_10000)
29
JSON
Time worked Worklog not with information by day encapsuleted in issue you have call the worklog for every single ticket by one REST Call
special cases
for i in 1 apex_jsonget_count(p_values =gt l_values p_path =gt issues)loop l_rest_response = make_rest_request(pi_url =gt pi_jira_base_url || c_jira_rest_base_path || issue || apex_jsonget_varchar2(p_values =gt l_values p_path =gt issues[ || i || ]key) pi_username =gt pi_username pi_password =gt pi_password) apex_jsonparse(p_values =gt l_values_issue p_source =gt l_rest_response) l_jira_issue = get_issue_from_json(pi_json_issue =gt l_values_issue) for j in 1 apex_jsonget_count(p_values =gt l_values_issue p_path =gt fieldsworklogworklogs) loop l_jira_issue_worklog = get_issue_worklog_from_json(pi_json_issue_worklog =gt l_values_issue pi_path =gt fieldsworklogworklogs[ || j || ] pi_jira_issue_id =gt l_jira_issueid pi_jira_issue_key =gt l_jira_issuekey) pipe row(l_jira_issue_worklog)
30
JSON
transform JSON into type easier to use Transformation in package instead APEX testing possible by using sql Entities defined as column names documentation von
CollectionSpalte ndash JSON ndash Spaltenname im Type
using table function based on defined types
processing create or replace type t_jira_issue force as object(-- id 16276-- c001 id number -- Jira Issue ID
-- self httpsjiramt-agcomrestapi2issue16276-- c003 url_json varchar2(32767) -- c003 - JSON URL
-- key UITFPP-1057bdquo-- c001 key varchar2(32767) -- Issue Keyselect
from table(jira_rest_ws_pkgget_projects(pi_base_url =gt httpsjiraatlassiancom))
31
APEX
using APEX_COLLECTIONS not every search means new webservice call loading page doesnlsquot call a webservice APEX itself relies also on collections when working with Web Service References
problem authentication for webservice call every call needs a username amp password using Web Service Reference itlsquos inconvenient using Application Items instead
when logging into the apex application password is saved on server-side by application item attention the password value is visible in session state
32
APEXLivedemo
33
Conclusion
complexity is huge because of many different technical aspects
all important key facts are calculateable
transforming JSON in JavaScript or PLSQL is not easy in the beginning
first time parsing JSON even with APEX_JSON needs practiceremember in 12c you can directly parse JSON by SQL
Using APEX integrated bdquoWeb Service Referenceldquo only for simple examples
OliverLemm
httpoliverlemmblogspotde
httpdelinkedincominOliverLemm
httpswwwxingcomprofileOliver_Lemm
Thanks
- APEX connects Jira
- Facts amp Figures
- about me
- Slide 4
- Agenda
- Motivation
- Jira
- Slide 8
- Jira (2)
- Jira (3)
- Jira (4)
- Jira (5)
- Jira (6)
- Jira (7)
- Webservices
- Webservices (2)
- Webservices (3)
- Webservices (4)
- Webservices (5)
- Webservices (6)
- Webservice
- Webservices (8)
- Webservices (9)
- Webservice (2)
- JSON
- JSON
- JSON (2)
- JSON (3)
- JSON (4)
- APEX
- APEX (2)
- Conclusion
- Slide 34
-
11
Jira
key figures not in desired aggregation time per yearmonth
no further support for SOAP Webservices in Jira SOAP Interface doesnlsquot return all values
Using Jira-Plugins Listed Plugins not fullfilling all requiremends Developing own Jira-Plugins is complex and time consuming
lack of features
12
Jira
API documentation for Jira REST-WebserviceshttpsdocsatlassiancomjiraRESTlatest
URL structure httphostportcontextrestapi-nameapi-versionresource-name
Using an issue identfiied by the key JRA-9 would be like httpsjiraatlassiancomrestapilatestissueJRA-9
Using JQL Language (syntax)httpsjiramt-agcomrestapi2searchjql=project=BP
Returning values in JSON Format (testable also in browser)
REST-Webservice
13
JiraJQL
httpsjiramt-agcomrestapi2searchjql=project=BP
14
Jira
addional information when getting REST-Webservice Result
Default max 50 entries 1 solution add parameter ampmaxResults=XXX
2 solution add Parameter ampstartAt=50
Sort the results
If no Authentication needed donlsquot submit usernamepassword -gt you get Unauthorized (401)
REST-Webservice
expandschemanamesstartAt0maxResults50total827issues[hellip]
httpsjiramt-agcomrestapilatestsearchjql=project=BPampmaxResults=1000
httpsjiramt-agcomrestapilatestsearchjql=project=BPampstartAt=50
httpsjiramt-agcomrestapilatestsearchjql=project=BP+order+by+duedate
15
Webservices
getting Error
Example httpsjiraatlassiancomrestapilatestissueJRA-9
ACL
ORA-29273 HTTP request failed ORA-24247 network access denied by access control list (ACL)
begin dbms_network_acl_admincreate_acl(acl =gt jiraatlassiancomxml description =gt An ACL for Calling REST Webservices principal =gt l_principal is_grant =gt true privilege =gt connect start_date =gt systimestamp end_date =gt null)
dbms_network_acl_adminassign_acl(acl =gt jiraatlassiancomxml host =gt jiraatlassiancom lower_port =gt 443 upper_port =gt 443) commitend
16
Webservices
Getting existing ACL Entries
Important for ACL Using Web Service References (shared
components or the APEX_WEB_SERVICE (package) principal = APEX_050000
using utl_http or other packages calling external resources principal = my_schema_name
ACL select aacl ahost alower_port aupper_port pprincipal pprivilege pis_grant to_char(pstart_date DD-MON-YYYY) as start_date to_char(pend_date DD-MON-YYYY) as end_datefrom dba_network_acl_privileges pleft join dba_network_acls a on aacl = pacl
17
Webservicesexporting certificate
18
Webservices
calling https
To solve this problem you have to get the certificates which are used by the server which runs Jira
Getting certificate use your browser and call the URL from the REST-Webservice or even from Jira click on the lock symbol click show certificate
exporting certificate
ORA-29273 HTTP request failed ORA-29024 Certificate validation failure
19
Webservicesimporting certificate
20
Webservices
use the Oracle Wallet Manager (OWM) to import the certificate run ORACLE_HOMEbinowmcl (on windows a link is created)
Import of the certificate is also possible using the command line
create a wallet for the certificate using a path like thisORACLE_BASEadminltSIDgtltname_walletgt
Use automatic login for your wallet (otherwise you have to use the wallet always with your password in your plsql code)
importing certificate
21
Webservice
APEX documentationhttpdocsoraclecomcdE59726_01doc50e39151adm_wrkspc002htmBABHEHAG
Login into your INTERNAL WorkspaceManage InstanceInstance SettingsWallet
certificate in APEX
23
Webservices
Shared Components Web Service References Create
Problems based on single items authentification result as CLOB
only in Collection No support in apex_items report columns
JSON Format
Web Service Reference
24
WebservicesWeb Service Reference
25
Webservice
Call REST
p_http_method GET HEAD POST PUT DELETE Username amp Password supporting Basic Authentication Parameter if parameter beside the URL itself are needed
APEX_WEB_SERVICE
l_clob = apex_web_servicemake_rest_request( p_url =gt
httpsjiraatlassiancomrestapilatestissueJRA-9p_http_method =gt GETp_wallet_path =gt fileCoracleadminorclmein_walletp_username =gt lemmop_password =gt 123456 sbquop_parm_name =gt apex_utilstring_to_table(param1param2)p_parm_value =gt apex_utilstring_to_table(val1val2)
)
26
JSON
Datentypen String
QS - Demo Feature 2015-11-03T134816630+0100
Number 20
Boolean true false
Null null
Array [ hellip hellip]
format
id 17149 self httpsjiramt-agcomrestapilatestissue17149 key BP-7 fields ldquosummary QS - Demo Feature progress progress 19800 total 19800 percent 100 created 2015-11-03T134816630+0100 worklog startAt 0 maxResults 20 total 2 worklogs [ ]
27
JSON
convert clob to JSON object
looping entries
get value
processingl_values apex_jsont_valueshellipapex_jsonparse(p_values =gt l_values p_source =gt l_clob)
for i in 1 apex_jsonget_count(p_values =gt l_values p_path =gt )loop hellip end loop
l_jira_issuekey = apex_jsonget_varchar2(p_values =gt pi_json_issue p_path =gt key)
l_jira_issuetimespent = apex_jsonget_number(p_values =gt pi_json_issue p_path =gt fieldstimespent)
28
JSON
Number as String you have to convert
Datetime as String Converting with
apex_jsonget_datedoesnlsquot work because of format
custom fieldsin Jira are named likecustomfield_xxxxx
special cases
id 17149
created 2015-11-03T134816630+0100l_timestamp = to_timestamp_tz(pi_string YYYY-MM-DDThh24missFF3TZHTZM) l_string = to_char(l_timestamp yyyymmdd hh24miss)l_date = to_date(l_string yyyymmdd hh24miss)apex_jsonget_varchar2(p_values =gt pi_json_issue p_path =gt fieldscustomfield_10000)
29
JSON
Time worked Worklog not with information by day encapsuleted in issue you have call the worklog for every single ticket by one REST Call
special cases
for i in 1 apex_jsonget_count(p_values =gt l_values p_path =gt issues)loop l_rest_response = make_rest_request(pi_url =gt pi_jira_base_url || c_jira_rest_base_path || issue || apex_jsonget_varchar2(p_values =gt l_values p_path =gt issues[ || i || ]key) pi_username =gt pi_username pi_password =gt pi_password) apex_jsonparse(p_values =gt l_values_issue p_source =gt l_rest_response) l_jira_issue = get_issue_from_json(pi_json_issue =gt l_values_issue) for j in 1 apex_jsonget_count(p_values =gt l_values_issue p_path =gt fieldsworklogworklogs) loop l_jira_issue_worklog = get_issue_worklog_from_json(pi_json_issue_worklog =gt l_values_issue pi_path =gt fieldsworklogworklogs[ || j || ] pi_jira_issue_id =gt l_jira_issueid pi_jira_issue_key =gt l_jira_issuekey) pipe row(l_jira_issue_worklog)
30
JSON
transform JSON into type easier to use Transformation in package instead APEX testing possible by using sql Entities defined as column names documentation von
CollectionSpalte ndash JSON ndash Spaltenname im Type
using table function based on defined types
processing create or replace type t_jira_issue force as object(-- id 16276-- c001 id number -- Jira Issue ID
-- self httpsjiramt-agcomrestapi2issue16276-- c003 url_json varchar2(32767) -- c003 - JSON URL
-- key UITFPP-1057bdquo-- c001 key varchar2(32767) -- Issue Keyselect
from table(jira_rest_ws_pkgget_projects(pi_base_url =gt httpsjiraatlassiancom))
31
APEX
using APEX_COLLECTIONS not every search means new webservice call loading page doesnlsquot call a webservice APEX itself relies also on collections when working with Web Service References
problem authentication for webservice call every call needs a username amp password using Web Service Reference itlsquos inconvenient using Application Items instead
when logging into the apex application password is saved on server-side by application item attention the password value is visible in session state
32
APEXLivedemo
33
Conclusion
complexity is huge because of many different technical aspects
all important key facts are calculateable
transforming JSON in JavaScript or PLSQL is not easy in the beginning
first time parsing JSON even with APEX_JSON needs practiceremember in 12c you can directly parse JSON by SQL
Using APEX integrated bdquoWeb Service Referenceldquo only for simple examples
OliverLemm
httpoliverlemmblogspotde
httpdelinkedincominOliverLemm
httpswwwxingcomprofileOliver_Lemm
Thanks
- APEX connects Jira
- Facts amp Figures
- about me
- Slide 4
- Agenda
- Motivation
- Jira
- Slide 8
- Jira (2)
- Jira (3)
- Jira (4)
- Jira (5)
- Jira (6)
- Jira (7)
- Webservices
- Webservices (2)
- Webservices (3)
- Webservices (4)
- Webservices (5)
- Webservices (6)
- Webservice
- Webservices (8)
- Webservices (9)
- Webservice (2)
- JSON
- JSON
- JSON (2)
- JSON (3)
- JSON (4)
- APEX
- APEX (2)
- Conclusion
- Slide 34
-
12
Jira
API documentation for Jira REST-WebserviceshttpsdocsatlassiancomjiraRESTlatest
URL structure httphostportcontextrestapi-nameapi-versionresource-name
Using an issue identfiied by the key JRA-9 would be like httpsjiraatlassiancomrestapilatestissueJRA-9
Using JQL Language (syntax)httpsjiramt-agcomrestapi2searchjql=project=BP
Returning values in JSON Format (testable also in browser)
REST-Webservice
13
JiraJQL
httpsjiramt-agcomrestapi2searchjql=project=BP
14
Jira
addional information when getting REST-Webservice Result
Default max 50 entries 1 solution add parameter ampmaxResults=XXX
2 solution add Parameter ampstartAt=50
Sort the results
If no Authentication needed donlsquot submit usernamepassword -gt you get Unauthorized (401)
REST-Webservice
expandschemanamesstartAt0maxResults50total827issues[hellip]
httpsjiramt-agcomrestapilatestsearchjql=project=BPampmaxResults=1000
httpsjiramt-agcomrestapilatestsearchjql=project=BPampstartAt=50
httpsjiramt-agcomrestapilatestsearchjql=project=BP+order+by+duedate
15
Webservices
getting Error
Example httpsjiraatlassiancomrestapilatestissueJRA-9
ACL
ORA-29273 HTTP request failed ORA-24247 network access denied by access control list (ACL)
begin dbms_network_acl_admincreate_acl(acl =gt jiraatlassiancomxml description =gt An ACL for Calling REST Webservices principal =gt l_principal is_grant =gt true privilege =gt connect start_date =gt systimestamp end_date =gt null)
dbms_network_acl_adminassign_acl(acl =gt jiraatlassiancomxml host =gt jiraatlassiancom lower_port =gt 443 upper_port =gt 443) commitend
16
Webservices
Getting existing ACL Entries
Important for ACL Using Web Service References (shared
components or the APEX_WEB_SERVICE (package) principal = APEX_050000
using utl_http or other packages calling external resources principal = my_schema_name
ACL select aacl ahost alower_port aupper_port pprincipal pprivilege pis_grant to_char(pstart_date DD-MON-YYYY) as start_date to_char(pend_date DD-MON-YYYY) as end_datefrom dba_network_acl_privileges pleft join dba_network_acls a on aacl = pacl
17
Webservicesexporting certificate
18
Webservices
calling https
To solve this problem you have to get the certificates which are used by the server which runs Jira
Getting certificate use your browser and call the URL from the REST-Webservice or even from Jira click on the lock symbol click show certificate
exporting certificate
ORA-29273 HTTP request failed ORA-29024 Certificate validation failure
19
Webservicesimporting certificate
20
Webservices
use the Oracle Wallet Manager (OWM) to import the certificate run ORACLE_HOMEbinowmcl (on windows a link is created)
Import of the certificate is also possible using the command line
create a wallet for the certificate using a path like thisORACLE_BASEadminltSIDgtltname_walletgt
Use automatic login for your wallet (otherwise you have to use the wallet always with your password in your plsql code)
importing certificate
21
Webservice
APEX documentationhttpdocsoraclecomcdE59726_01doc50e39151adm_wrkspc002htmBABHEHAG
Login into your INTERNAL WorkspaceManage InstanceInstance SettingsWallet
certificate in APEX
23
Webservices
Shared Components Web Service References Create
Problems based on single items authentification result as CLOB
only in Collection No support in apex_items report columns
JSON Format
Web Service Reference
24
WebservicesWeb Service Reference
25
Webservice
Call REST
p_http_method GET HEAD POST PUT DELETE Username amp Password supporting Basic Authentication Parameter if parameter beside the URL itself are needed
APEX_WEB_SERVICE
l_clob = apex_web_servicemake_rest_request( p_url =gt
httpsjiraatlassiancomrestapilatestissueJRA-9p_http_method =gt GETp_wallet_path =gt fileCoracleadminorclmein_walletp_username =gt lemmop_password =gt 123456 sbquop_parm_name =gt apex_utilstring_to_table(param1param2)p_parm_value =gt apex_utilstring_to_table(val1val2)
)
26
JSON
Datentypen String
QS - Demo Feature 2015-11-03T134816630+0100
Number 20
Boolean true false
Null null
Array [ hellip hellip]
format
id 17149 self httpsjiramt-agcomrestapilatestissue17149 key BP-7 fields ldquosummary QS - Demo Feature progress progress 19800 total 19800 percent 100 created 2015-11-03T134816630+0100 worklog startAt 0 maxResults 20 total 2 worklogs [ ]
27
JSON
convert clob to JSON object
looping entries
get value
processingl_values apex_jsont_valueshellipapex_jsonparse(p_values =gt l_values p_source =gt l_clob)
for i in 1 apex_jsonget_count(p_values =gt l_values p_path =gt )loop hellip end loop
l_jira_issuekey = apex_jsonget_varchar2(p_values =gt pi_json_issue p_path =gt key)
l_jira_issuetimespent = apex_jsonget_number(p_values =gt pi_json_issue p_path =gt fieldstimespent)
28
JSON
Number as String you have to convert
Datetime as String Converting with
apex_jsonget_datedoesnlsquot work because of format
custom fieldsin Jira are named likecustomfield_xxxxx
special cases
id 17149
created 2015-11-03T134816630+0100l_timestamp = to_timestamp_tz(pi_string YYYY-MM-DDThh24missFF3TZHTZM) l_string = to_char(l_timestamp yyyymmdd hh24miss)l_date = to_date(l_string yyyymmdd hh24miss)apex_jsonget_varchar2(p_values =gt pi_json_issue p_path =gt fieldscustomfield_10000)
29
JSON
Time worked Worklog not with information by day encapsuleted in issue you have call the worklog for every single ticket by one REST Call
special cases
for i in 1 apex_jsonget_count(p_values =gt l_values p_path =gt issues)loop l_rest_response = make_rest_request(pi_url =gt pi_jira_base_url || c_jira_rest_base_path || issue || apex_jsonget_varchar2(p_values =gt l_values p_path =gt issues[ || i || ]key) pi_username =gt pi_username pi_password =gt pi_password) apex_jsonparse(p_values =gt l_values_issue p_source =gt l_rest_response) l_jira_issue = get_issue_from_json(pi_json_issue =gt l_values_issue) for j in 1 apex_jsonget_count(p_values =gt l_values_issue p_path =gt fieldsworklogworklogs) loop l_jira_issue_worklog = get_issue_worklog_from_json(pi_json_issue_worklog =gt l_values_issue pi_path =gt fieldsworklogworklogs[ || j || ] pi_jira_issue_id =gt l_jira_issueid pi_jira_issue_key =gt l_jira_issuekey) pipe row(l_jira_issue_worklog)
30
JSON
transform JSON into type easier to use Transformation in package instead APEX testing possible by using sql Entities defined as column names documentation von
CollectionSpalte ndash JSON ndash Spaltenname im Type
using table function based on defined types
processing create or replace type t_jira_issue force as object(-- id 16276-- c001 id number -- Jira Issue ID
-- self httpsjiramt-agcomrestapi2issue16276-- c003 url_json varchar2(32767) -- c003 - JSON URL
-- key UITFPP-1057bdquo-- c001 key varchar2(32767) -- Issue Keyselect
from table(jira_rest_ws_pkgget_projects(pi_base_url =gt httpsjiraatlassiancom))
31
APEX
using APEX_COLLECTIONS not every search means new webservice call loading page doesnlsquot call a webservice APEX itself relies also on collections when working with Web Service References
problem authentication for webservice call every call needs a username amp password using Web Service Reference itlsquos inconvenient using Application Items instead
when logging into the apex application password is saved on server-side by application item attention the password value is visible in session state
32
APEXLivedemo
33
Conclusion
complexity is huge because of many different technical aspects
all important key facts are calculateable
transforming JSON in JavaScript or PLSQL is not easy in the beginning
first time parsing JSON even with APEX_JSON needs practiceremember in 12c you can directly parse JSON by SQL
Using APEX integrated bdquoWeb Service Referenceldquo only for simple examples
OliverLemm
httpoliverlemmblogspotde
httpdelinkedincominOliverLemm
httpswwwxingcomprofileOliver_Lemm
Thanks
- APEX connects Jira
- Facts amp Figures
- about me
- Slide 4
- Agenda
- Motivation
- Jira
- Slide 8
- Jira (2)
- Jira (3)
- Jira (4)
- Jira (5)
- Jira (6)
- Jira (7)
- Webservices
- Webservices (2)
- Webservices (3)
- Webservices (4)
- Webservices (5)
- Webservices (6)
- Webservice
- Webservices (8)
- Webservices (9)
- Webservice (2)
- JSON
- JSON
- JSON (2)
- JSON (3)
- JSON (4)
- APEX
- APEX (2)
- Conclusion
- Slide 34
-
13
JiraJQL
httpsjiramt-agcomrestapi2searchjql=project=BP
14
Jira
addional information when getting REST-Webservice Result
Default max 50 entries 1 solution add parameter ampmaxResults=XXX
2 solution add Parameter ampstartAt=50
Sort the results
If no Authentication needed donlsquot submit usernamepassword -gt you get Unauthorized (401)
REST-Webservice
expandschemanamesstartAt0maxResults50total827issues[hellip]
httpsjiramt-agcomrestapilatestsearchjql=project=BPampmaxResults=1000
httpsjiramt-agcomrestapilatestsearchjql=project=BPampstartAt=50
httpsjiramt-agcomrestapilatestsearchjql=project=BP+order+by+duedate
15
Webservices
getting Error
Example httpsjiraatlassiancomrestapilatestissueJRA-9
ACL
ORA-29273 HTTP request failed ORA-24247 network access denied by access control list (ACL)
begin dbms_network_acl_admincreate_acl(acl =gt jiraatlassiancomxml description =gt An ACL for Calling REST Webservices principal =gt l_principal is_grant =gt true privilege =gt connect start_date =gt systimestamp end_date =gt null)
dbms_network_acl_adminassign_acl(acl =gt jiraatlassiancomxml host =gt jiraatlassiancom lower_port =gt 443 upper_port =gt 443) commitend
16
Webservices
Getting existing ACL Entries
Important for ACL Using Web Service References (shared
components or the APEX_WEB_SERVICE (package) principal = APEX_050000
using utl_http or other packages calling external resources principal = my_schema_name
ACL select aacl ahost alower_port aupper_port pprincipal pprivilege pis_grant to_char(pstart_date DD-MON-YYYY) as start_date to_char(pend_date DD-MON-YYYY) as end_datefrom dba_network_acl_privileges pleft join dba_network_acls a on aacl = pacl
17
Webservicesexporting certificate
18
Webservices
calling https
To solve this problem you have to get the certificates which are used by the server which runs Jira
Getting certificate use your browser and call the URL from the REST-Webservice or even from Jira click on the lock symbol click show certificate
exporting certificate
ORA-29273 HTTP request failed ORA-29024 Certificate validation failure
19
Webservicesimporting certificate
20
Webservices
use the Oracle Wallet Manager (OWM) to import the certificate run ORACLE_HOMEbinowmcl (on windows a link is created)
Import of the certificate is also possible using the command line
create a wallet for the certificate using a path like thisORACLE_BASEadminltSIDgtltname_walletgt
Use automatic login for your wallet (otherwise you have to use the wallet always with your password in your plsql code)
importing certificate
21
Webservice
APEX documentationhttpdocsoraclecomcdE59726_01doc50e39151adm_wrkspc002htmBABHEHAG
Login into your INTERNAL WorkspaceManage InstanceInstance SettingsWallet
certificate in APEX
23
Webservices
Shared Components Web Service References Create
Problems based on single items authentification result as CLOB
only in Collection No support in apex_items report columns
JSON Format
Web Service Reference
24
WebservicesWeb Service Reference
25
Webservice
Call REST
p_http_method GET HEAD POST PUT DELETE Username amp Password supporting Basic Authentication Parameter if parameter beside the URL itself are needed
APEX_WEB_SERVICE
l_clob = apex_web_servicemake_rest_request( p_url =gt
httpsjiraatlassiancomrestapilatestissueJRA-9p_http_method =gt GETp_wallet_path =gt fileCoracleadminorclmein_walletp_username =gt lemmop_password =gt 123456 sbquop_parm_name =gt apex_utilstring_to_table(param1param2)p_parm_value =gt apex_utilstring_to_table(val1val2)
)
26
JSON
Datentypen String
QS - Demo Feature 2015-11-03T134816630+0100
Number 20
Boolean true false
Null null
Array [ hellip hellip]
format
id 17149 self httpsjiramt-agcomrestapilatestissue17149 key BP-7 fields ldquosummary QS - Demo Feature progress progress 19800 total 19800 percent 100 created 2015-11-03T134816630+0100 worklog startAt 0 maxResults 20 total 2 worklogs [ ]
27
JSON
convert clob to JSON object
looping entries
get value
processingl_values apex_jsont_valueshellipapex_jsonparse(p_values =gt l_values p_source =gt l_clob)
for i in 1 apex_jsonget_count(p_values =gt l_values p_path =gt )loop hellip end loop
l_jira_issuekey = apex_jsonget_varchar2(p_values =gt pi_json_issue p_path =gt key)
l_jira_issuetimespent = apex_jsonget_number(p_values =gt pi_json_issue p_path =gt fieldstimespent)
28
JSON
Number as String you have to convert
Datetime as String Converting with
apex_jsonget_datedoesnlsquot work because of format
custom fieldsin Jira are named likecustomfield_xxxxx
special cases
id 17149
created 2015-11-03T134816630+0100l_timestamp = to_timestamp_tz(pi_string YYYY-MM-DDThh24missFF3TZHTZM) l_string = to_char(l_timestamp yyyymmdd hh24miss)l_date = to_date(l_string yyyymmdd hh24miss)apex_jsonget_varchar2(p_values =gt pi_json_issue p_path =gt fieldscustomfield_10000)
29
JSON
Time worked Worklog not with information by day encapsuleted in issue you have call the worklog for every single ticket by one REST Call
special cases
for i in 1 apex_jsonget_count(p_values =gt l_values p_path =gt issues)loop l_rest_response = make_rest_request(pi_url =gt pi_jira_base_url || c_jira_rest_base_path || issue || apex_jsonget_varchar2(p_values =gt l_values p_path =gt issues[ || i || ]key) pi_username =gt pi_username pi_password =gt pi_password) apex_jsonparse(p_values =gt l_values_issue p_source =gt l_rest_response) l_jira_issue = get_issue_from_json(pi_json_issue =gt l_values_issue) for j in 1 apex_jsonget_count(p_values =gt l_values_issue p_path =gt fieldsworklogworklogs) loop l_jira_issue_worklog = get_issue_worklog_from_json(pi_json_issue_worklog =gt l_values_issue pi_path =gt fieldsworklogworklogs[ || j || ] pi_jira_issue_id =gt l_jira_issueid pi_jira_issue_key =gt l_jira_issuekey) pipe row(l_jira_issue_worklog)
30
JSON
transform JSON into type easier to use Transformation in package instead APEX testing possible by using sql Entities defined as column names documentation von
CollectionSpalte ndash JSON ndash Spaltenname im Type
using table function based on defined types
processing create or replace type t_jira_issue force as object(-- id 16276-- c001 id number -- Jira Issue ID
-- self httpsjiramt-agcomrestapi2issue16276-- c003 url_json varchar2(32767) -- c003 - JSON URL
-- key UITFPP-1057bdquo-- c001 key varchar2(32767) -- Issue Keyselect
from table(jira_rest_ws_pkgget_projects(pi_base_url =gt httpsjiraatlassiancom))
31
APEX
using APEX_COLLECTIONS not every search means new webservice call loading page doesnlsquot call a webservice APEX itself relies also on collections when working with Web Service References
problem authentication for webservice call every call needs a username amp password using Web Service Reference itlsquos inconvenient using Application Items instead
when logging into the apex application password is saved on server-side by application item attention the password value is visible in session state
32
APEXLivedemo
33
Conclusion
complexity is huge because of many different technical aspects
all important key facts are calculateable
transforming JSON in JavaScript or PLSQL is not easy in the beginning
first time parsing JSON even with APEX_JSON needs practiceremember in 12c you can directly parse JSON by SQL
Using APEX integrated bdquoWeb Service Referenceldquo only for simple examples
OliverLemm
httpoliverlemmblogspotde
httpdelinkedincominOliverLemm
httpswwwxingcomprofileOliver_Lemm
Thanks
- APEX connects Jira
- Facts amp Figures
- about me
- Slide 4
- Agenda
- Motivation
- Jira
- Slide 8
- Jira (2)
- Jira (3)
- Jira (4)
- Jira (5)
- Jira (6)
- Jira (7)
- Webservices
- Webservices (2)
- Webservices (3)
- Webservices (4)
- Webservices (5)
- Webservices (6)
- Webservice
- Webservices (8)
- Webservices (9)
- Webservice (2)
- JSON
- JSON
- JSON (2)
- JSON (3)
- JSON (4)
- APEX
- APEX (2)
- Conclusion
- Slide 34
-
14
Jira
addional information when getting REST-Webservice Result
Default max 50 entries 1 solution add parameter ampmaxResults=XXX
2 solution add Parameter ampstartAt=50
Sort the results
If no Authentication needed donlsquot submit usernamepassword -gt you get Unauthorized (401)
REST-Webservice
expandschemanamesstartAt0maxResults50total827issues[hellip]
httpsjiramt-agcomrestapilatestsearchjql=project=BPampmaxResults=1000
httpsjiramt-agcomrestapilatestsearchjql=project=BPampstartAt=50
httpsjiramt-agcomrestapilatestsearchjql=project=BP+order+by+duedate
15
Webservices
getting Error
Example httpsjiraatlassiancomrestapilatestissueJRA-9
ACL
ORA-29273 HTTP request failed ORA-24247 network access denied by access control list (ACL)
begin dbms_network_acl_admincreate_acl(acl =gt jiraatlassiancomxml description =gt An ACL for Calling REST Webservices principal =gt l_principal is_grant =gt true privilege =gt connect start_date =gt systimestamp end_date =gt null)
dbms_network_acl_adminassign_acl(acl =gt jiraatlassiancomxml host =gt jiraatlassiancom lower_port =gt 443 upper_port =gt 443) commitend
16
Webservices
Getting existing ACL Entries
Important for ACL Using Web Service References (shared
components or the APEX_WEB_SERVICE (package) principal = APEX_050000
using utl_http or other packages calling external resources principal = my_schema_name
ACL select aacl ahost alower_port aupper_port pprincipal pprivilege pis_grant to_char(pstart_date DD-MON-YYYY) as start_date to_char(pend_date DD-MON-YYYY) as end_datefrom dba_network_acl_privileges pleft join dba_network_acls a on aacl = pacl
17
Webservicesexporting certificate
18
Webservices
calling https
To solve this problem you have to get the certificates which are used by the server which runs Jira
Getting certificate use your browser and call the URL from the REST-Webservice or even from Jira click on the lock symbol click show certificate
exporting certificate
ORA-29273 HTTP request failed ORA-29024 Certificate validation failure
19
Webservicesimporting certificate
20
Webservices
use the Oracle Wallet Manager (OWM) to import the certificate run ORACLE_HOMEbinowmcl (on windows a link is created)
Import of the certificate is also possible using the command line
create a wallet for the certificate using a path like thisORACLE_BASEadminltSIDgtltname_walletgt
Use automatic login for your wallet (otherwise you have to use the wallet always with your password in your plsql code)
importing certificate
21
Webservice
APEX documentationhttpdocsoraclecomcdE59726_01doc50e39151adm_wrkspc002htmBABHEHAG
Login into your INTERNAL WorkspaceManage InstanceInstance SettingsWallet
certificate in APEX
23
Webservices
Shared Components Web Service References Create
Problems based on single items authentification result as CLOB
only in Collection No support in apex_items report columns
JSON Format
Web Service Reference
24
WebservicesWeb Service Reference
25
Webservice
Call REST
p_http_method GET HEAD POST PUT DELETE Username amp Password supporting Basic Authentication Parameter if parameter beside the URL itself are needed
APEX_WEB_SERVICE
l_clob = apex_web_servicemake_rest_request( p_url =gt
httpsjiraatlassiancomrestapilatestissueJRA-9p_http_method =gt GETp_wallet_path =gt fileCoracleadminorclmein_walletp_username =gt lemmop_password =gt 123456 sbquop_parm_name =gt apex_utilstring_to_table(param1param2)p_parm_value =gt apex_utilstring_to_table(val1val2)
)
26
JSON
Datentypen String
QS - Demo Feature 2015-11-03T134816630+0100
Number 20
Boolean true false
Null null
Array [ hellip hellip]
format
id 17149 self httpsjiramt-agcomrestapilatestissue17149 key BP-7 fields ldquosummary QS - Demo Feature progress progress 19800 total 19800 percent 100 created 2015-11-03T134816630+0100 worklog startAt 0 maxResults 20 total 2 worklogs [ ]
27
JSON
convert clob to JSON object
looping entries
get value
processingl_values apex_jsont_valueshellipapex_jsonparse(p_values =gt l_values p_source =gt l_clob)
for i in 1 apex_jsonget_count(p_values =gt l_values p_path =gt )loop hellip end loop
l_jira_issuekey = apex_jsonget_varchar2(p_values =gt pi_json_issue p_path =gt key)
l_jira_issuetimespent = apex_jsonget_number(p_values =gt pi_json_issue p_path =gt fieldstimespent)
28
JSON
Number as String you have to convert
Datetime as String Converting with
apex_jsonget_datedoesnlsquot work because of format
custom fieldsin Jira are named likecustomfield_xxxxx
special cases
id 17149
created 2015-11-03T134816630+0100l_timestamp = to_timestamp_tz(pi_string YYYY-MM-DDThh24missFF3TZHTZM) l_string = to_char(l_timestamp yyyymmdd hh24miss)l_date = to_date(l_string yyyymmdd hh24miss)apex_jsonget_varchar2(p_values =gt pi_json_issue p_path =gt fieldscustomfield_10000)
29
JSON
Time worked Worklog not with information by day encapsuleted in issue you have call the worklog for every single ticket by one REST Call
special cases
for i in 1 apex_jsonget_count(p_values =gt l_values p_path =gt issues)loop l_rest_response = make_rest_request(pi_url =gt pi_jira_base_url || c_jira_rest_base_path || issue || apex_jsonget_varchar2(p_values =gt l_values p_path =gt issues[ || i || ]key) pi_username =gt pi_username pi_password =gt pi_password) apex_jsonparse(p_values =gt l_values_issue p_source =gt l_rest_response) l_jira_issue = get_issue_from_json(pi_json_issue =gt l_values_issue) for j in 1 apex_jsonget_count(p_values =gt l_values_issue p_path =gt fieldsworklogworklogs) loop l_jira_issue_worklog = get_issue_worklog_from_json(pi_json_issue_worklog =gt l_values_issue pi_path =gt fieldsworklogworklogs[ || j || ] pi_jira_issue_id =gt l_jira_issueid pi_jira_issue_key =gt l_jira_issuekey) pipe row(l_jira_issue_worklog)
30
JSON
transform JSON into type easier to use Transformation in package instead APEX testing possible by using sql Entities defined as column names documentation von
CollectionSpalte ndash JSON ndash Spaltenname im Type
using table function based on defined types
processing create or replace type t_jira_issue force as object(-- id 16276-- c001 id number -- Jira Issue ID
-- self httpsjiramt-agcomrestapi2issue16276-- c003 url_json varchar2(32767) -- c003 - JSON URL
-- key UITFPP-1057bdquo-- c001 key varchar2(32767) -- Issue Keyselect
from table(jira_rest_ws_pkgget_projects(pi_base_url =gt httpsjiraatlassiancom))
31
APEX
using APEX_COLLECTIONS not every search means new webservice call loading page doesnlsquot call a webservice APEX itself relies also on collections when working with Web Service References
problem authentication for webservice call every call needs a username amp password using Web Service Reference itlsquos inconvenient using Application Items instead
when logging into the apex application password is saved on server-side by application item attention the password value is visible in session state
32
APEXLivedemo
33
Conclusion
complexity is huge because of many different technical aspects
all important key facts are calculateable
transforming JSON in JavaScript or PLSQL is not easy in the beginning
first time parsing JSON even with APEX_JSON needs practiceremember in 12c you can directly parse JSON by SQL
Using APEX integrated bdquoWeb Service Referenceldquo only for simple examples
OliverLemm
httpoliverlemmblogspotde
httpdelinkedincominOliverLemm
httpswwwxingcomprofileOliver_Lemm
Thanks
- APEX connects Jira
- Facts amp Figures
- about me
- Slide 4
- Agenda
- Motivation
- Jira
- Slide 8
- Jira (2)
- Jira (3)
- Jira (4)
- Jira (5)
- Jira (6)
- Jira (7)
- Webservices
- Webservices (2)
- Webservices (3)
- Webservices (4)
- Webservices (5)
- Webservices (6)
- Webservice
- Webservices (8)
- Webservices (9)
- Webservice (2)
- JSON
- JSON
- JSON (2)
- JSON (3)
- JSON (4)
- APEX
- APEX (2)
- Conclusion
- Slide 34
-
15
Webservices
getting Error
Example httpsjiraatlassiancomrestapilatestissueJRA-9
ACL
ORA-29273 HTTP request failed ORA-24247 network access denied by access control list (ACL)
begin dbms_network_acl_admincreate_acl(acl =gt jiraatlassiancomxml description =gt An ACL for Calling REST Webservices principal =gt l_principal is_grant =gt true privilege =gt connect start_date =gt systimestamp end_date =gt null)
dbms_network_acl_adminassign_acl(acl =gt jiraatlassiancomxml host =gt jiraatlassiancom lower_port =gt 443 upper_port =gt 443) commitend
16
Webservices
Getting existing ACL Entries
Important for ACL Using Web Service References (shared
components or the APEX_WEB_SERVICE (package) principal = APEX_050000
using utl_http or other packages calling external resources principal = my_schema_name
ACL select aacl ahost alower_port aupper_port pprincipal pprivilege pis_grant to_char(pstart_date DD-MON-YYYY) as start_date to_char(pend_date DD-MON-YYYY) as end_datefrom dba_network_acl_privileges pleft join dba_network_acls a on aacl = pacl
17
Webservicesexporting certificate
18
Webservices
calling https
To solve this problem you have to get the certificates which are used by the server which runs Jira
Getting certificate use your browser and call the URL from the REST-Webservice or even from Jira click on the lock symbol click show certificate
exporting certificate
ORA-29273 HTTP request failed ORA-29024 Certificate validation failure
19
Webservicesimporting certificate
20
Webservices
use the Oracle Wallet Manager (OWM) to import the certificate run ORACLE_HOMEbinowmcl (on windows a link is created)
Import of the certificate is also possible using the command line
create a wallet for the certificate using a path like thisORACLE_BASEadminltSIDgtltname_walletgt
Use automatic login for your wallet (otherwise you have to use the wallet always with your password in your plsql code)
importing certificate
21
Webservice
APEX documentationhttpdocsoraclecomcdE59726_01doc50e39151adm_wrkspc002htmBABHEHAG
Login into your INTERNAL WorkspaceManage InstanceInstance SettingsWallet
certificate in APEX
23
Webservices
Shared Components Web Service References Create
Problems based on single items authentification result as CLOB
only in Collection No support in apex_items report columns
JSON Format
Web Service Reference
24
WebservicesWeb Service Reference
25
Webservice
Call REST
p_http_method GET HEAD POST PUT DELETE Username amp Password supporting Basic Authentication Parameter if parameter beside the URL itself are needed
APEX_WEB_SERVICE
l_clob = apex_web_servicemake_rest_request( p_url =gt
httpsjiraatlassiancomrestapilatestissueJRA-9p_http_method =gt GETp_wallet_path =gt fileCoracleadminorclmein_walletp_username =gt lemmop_password =gt 123456 sbquop_parm_name =gt apex_utilstring_to_table(param1param2)p_parm_value =gt apex_utilstring_to_table(val1val2)
)
26
JSON
Datentypen String
QS - Demo Feature 2015-11-03T134816630+0100
Number 20
Boolean true false
Null null
Array [ hellip hellip]
format
id 17149 self httpsjiramt-agcomrestapilatestissue17149 key BP-7 fields ldquosummary QS - Demo Feature progress progress 19800 total 19800 percent 100 created 2015-11-03T134816630+0100 worklog startAt 0 maxResults 20 total 2 worklogs [ ]
27
JSON
convert clob to JSON object
looping entries
get value
processingl_values apex_jsont_valueshellipapex_jsonparse(p_values =gt l_values p_source =gt l_clob)
for i in 1 apex_jsonget_count(p_values =gt l_values p_path =gt )loop hellip end loop
l_jira_issuekey = apex_jsonget_varchar2(p_values =gt pi_json_issue p_path =gt key)
l_jira_issuetimespent = apex_jsonget_number(p_values =gt pi_json_issue p_path =gt fieldstimespent)
28
JSON
Number as String you have to convert
Datetime as String Converting with
apex_jsonget_datedoesnlsquot work because of format
custom fieldsin Jira are named likecustomfield_xxxxx
special cases
id 17149
created 2015-11-03T134816630+0100l_timestamp = to_timestamp_tz(pi_string YYYY-MM-DDThh24missFF3TZHTZM) l_string = to_char(l_timestamp yyyymmdd hh24miss)l_date = to_date(l_string yyyymmdd hh24miss)apex_jsonget_varchar2(p_values =gt pi_json_issue p_path =gt fieldscustomfield_10000)
29
JSON
Time worked Worklog not with information by day encapsuleted in issue you have call the worklog for every single ticket by one REST Call
special cases
for i in 1 apex_jsonget_count(p_values =gt l_values p_path =gt issues)loop l_rest_response = make_rest_request(pi_url =gt pi_jira_base_url || c_jira_rest_base_path || issue || apex_jsonget_varchar2(p_values =gt l_values p_path =gt issues[ || i || ]key) pi_username =gt pi_username pi_password =gt pi_password) apex_jsonparse(p_values =gt l_values_issue p_source =gt l_rest_response) l_jira_issue = get_issue_from_json(pi_json_issue =gt l_values_issue) for j in 1 apex_jsonget_count(p_values =gt l_values_issue p_path =gt fieldsworklogworklogs) loop l_jira_issue_worklog = get_issue_worklog_from_json(pi_json_issue_worklog =gt l_values_issue pi_path =gt fieldsworklogworklogs[ || j || ] pi_jira_issue_id =gt l_jira_issueid pi_jira_issue_key =gt l_jira_issuekey) pipe row(l_jira_issue_worklog)
30
JSON
transform JSON into type easier to use Transformation in package instead APEX testing possible by using sql Entities defined as column names documentation von
CollectionSpalte ndash JSON ndash Spaltenname im Type
using table function based on defined types
processing create or replace type t_jira_issue force as object(-- id 16276-- c001 id number -- Jira Issue ID
-- self httpsjiramt-agcomrestapi2issue16276-- c003 url_json varchar2(32767) -- c003 - JSON URL
-- key UITFPP-1057bdquo-- c001 key varchar2(32767) -- Issue Keyselect
from table(jira_rest_ws_pkgget_projects(pi_base_url =gt httpsjiraatlassiancom))
31
APEX
using APEX_COLLECTIONS not every search means new webservice call loading page doesnlsquot call a webservice APEX itself relies also on collections when working with Web Service References
problem authentication for webservice call every call needs a username amp password using Web Service Reference itlsquos inconvenient using Application Items instead
when logging into the apex application password is saved on server-side by application item attention the password value is visible in session state
32
APEXLivedemo
33
Conclusion
complexity is huge because of many different technical aspects
all important key facts are calculateable
transforming JSON in JavaScript or PLSQL is not easy in the beginning
first time parsing JSON even with APEX_JSON needs practiceremember in 12c you can directly parse JSON by SQL
Using APEX integrated bdquoWeb Service Referenceldquo only for simple examples
OliverLemm
httpoliverlemmblogspotde
httpdelinkedincominOliverLemm
httpswwwxingcomprofileOliver_Lemm
Thanks
- APEX connects Jira
- Facts amp Figures
- about me
- Slide 4
- Agenda
- Motivation
- Jira
- Slide 8
- Jira (2)
- Jira (3)
- Jira (4)
- Jira (5)
- Jira (6)
- Jira (7)
- Webservices
- Webservices (2)
- Webservices (3)
- Webservices (4)
- Webservices (5)
- Webservices (6)
- Webservice
- Webservices (8)
- Webservices (9)
- Webservice (2)
- JSON
- JSON
- JSON (2)
- JSON (3)
- JSON (4)
- APEX
- APEX (2)
- Conclusion
- Slide 34
-
16
Webservices
Getting existing ACL Entries
Important for ACL Using Web Service References (shared
components or the APEX_WEB_SERVICE (package) principal = APEX_050000
using utl_http or other packages calling external resources principal = my_schema_name
ACL select aacl ahost alower_port aupper_port pprincipal pprivilege pis_grant to_char(pstart_date DD-MON-YYYY) as start_date to_char(pend_date DD-MON-YYYY) as end_datefrom dba_network_acl_privileges pleft join dba_network_acls a on aacl = pacl
17
Webservicesexporting certificate
18
Webservices
calling https
To solve this problem you have to get the certificates which are used by the server which runs Jira
Getting certificate use your browser and call the URL from the REST-Webservice or even from Jira click on the lock symbol click show certificate
exporting certificate
ORA-29273 HTTP request failed ORA-29024 Certificate validation failure
19
Webservicesimporting certificate
20
Webservices
use the Oracle Wallet Manager (OWM) to import the certificate run ORACLE_HOMEbinowmcl (on windows a link is created)
Import of the certificate is also possible using the command line
create a wallet for the certificate using a path like thisORACLE_BASEadminltSIDgtltname_walletgt
Use automatic login for your wallet (otherwise you have to use the wallet always with your password in your plsql code)
importing certificate
21
Webservice
APEX documentationhttpdocsoraclecomcdE59726_01doc50e39151adm_wrkspc002htmBABHEHAG
Login into your INTERNAL WorkspaceManage InstanceInstance SettingsWallet
certificate in APEX
23
Webservices
Shared Components Web Service References Create
Problems based on single items authentification result as CLOB
only in Collection No support in apex_items report columns
JSON Format
Web Service Reference
24
WebservicesWeb Service Reference
25
Webservice
Call REST
p_http_method GET HEAD POST PUT DELETE Username amp Password supporting Basic Authentication Parameter if parameter beside the URL itself are needed
APEX_WEB_SERVICE
l_clob = apex_web_servicemake_rest_request( p_url =gt
httpsjiraatlassiancomrestapilatestissueJRA-9p_http_method =gt GETp_wallet_path =gt fileCoracleadminorclmein_walletp_username =gt lemmop_password =gt 123456 sbquop_parm_name =gt apex_utilstring_to_table(param1param2)p_parm_value =gt apex_utilstring_to_table(val1val2)
)
26
JSON
Datentypen String
QS - Demo Feature 2015-11-03T134816630+0100
Number 20
Boolean true false
Null null
Array [ hellip hellip]
format
id 17149 self httpsjiramt-agcomrestapilatestissue17149 key BP-7 fields ldquosummary QS - Demo Feature progress progress 19800 total 19800 percent 100 created 2015-11-03T134816630+0100 worklog startAt 0 maxResults 20 total 2 worklogs [ ]
27
JSON
convert clob to JSON object
looping entries
get value
processingl_values apex_jsont_valueshellipapex_jsonparse(p_values =gt l_values p_source =gt l_clob)
for i in 1 apex_jsonget_count(p_values =gt l_values p_path =gt )loop hellip end loop
l_jira_issuekey = apex_jsonget_varchar2(p_values =gt pi_json_issue p_path =gt key)
l_jira_issuetimespent = apex_jsonget_number(p_values =gt pi_json_issue p_path =gt fieldstimespent)
28
JSON
Number as String you have to convert
Datetime as String Converting with
apex_jsonget_datedoesnlsquot work because of format
custom fieldsin Jira are named likecustomfield_xxxxx
special cases
id 17149
created 2015-11-03T134816630+0100l_timestamp = to_timestamp_tz(pi_string YYYY-MM-DDThh24missFF3TZHTZM) l_string = to_char(l_timestamp yyyymmdd hh24miss)l_date = to_date(l_string yyyymmdd hh24miss)apex_jsonget_varchar2(p_values =gt pi_json_issue p_path =gt fieldscustomfield_10000)
29
JSON
Time worked Worklog not with information by day encapsuleted in issue you have call the worklog for every single ticket by one REST Call
special cases
for i in 1 apex_jsonget_count(p_values =gt l_values p_path =gt issues)loop l_rest_response = make_rest_request(pi_url =gt pi_jira_base_url || c_jira_rest_base_path || issue || apex_jsonget_varchar2(p_values =gt l_values p_path =gt issues[ || i || ]key) pi_username =gt pi_username pi_password =gt pi_password) apex_jsonparse(p_values =gt l_values_issue p_source =gt l_rest_response) l_jira_issue = get_issue_from_json(pi_json_issue =gt l_values_issue) for j in 1 apex_jsonget_count(p_values =gt l_values_issue p_path =gt fieldsworklogworklogs) loop l_jira_issue_worklog = get_issue_worklog_from_json(pi_json_issue_worklog =gt l_values_issue pi_path =gt fieldsworklogworklogs[ || j || ] pi_jira_issue_id =gt l_jira_issueid pi_jira_issue_key =gt l_jira_issuekey) pipe row(l_jira_issue_worklog)
30
JSON
transform JSON into type easier to use Transformation in package instead APEX testing possible by using sql Entities defined as column names documentation von
CollectionSpalte ndash JSON ndash Spaltenname im Type
using table function based on defined types
processing create or replace type t_jira_issue force as object(-- id 16276-- c001 id number -- Jira Issue ID
-- self httpsjiramt-agcomrestapi2issue16276-- c003 url_json varchar2(32767) -- c003 - JSON URL
-- key UITFPP-1057bdquo-- c001 key varchar2(32767) -- Issue Keyselect
from table(jira_rest_ws_pkgget_projects(pi_base_url =gt httpsjiraatlassiancom))
31
APEX
using APEX_COLLECTIONS not every search means new webservice call loading page doesnlsquot call a webservice APEX itself relies also on collections when working with Web Service References
problem authentication for webservice call every call needs a username amp password using Web Service Reference itlsquos inconvenient using Application Items instead
when logging into the apex application password is saved on server-side by application item attention the password value is visible in session state
32
APEXLivedemo
33
Conclusion
complexity is huge because of many different technical aspects
all important key facts are calculateable
transforming JSON in JavaScript or PLSQL is not easy in the beginning
first time parsing JSON even with APEX_JSON needs practiceremember in 12c you can directly parse JSON by SQL
Using APEX integrated bdquoWeb Service Referenceldquo only for simple examples
OliverLemm
httpoliverlemmblogspotde
httpdelinkedincominOliverLemm
httpswwwxingcomprofileOliver_Lemm
Thanks
- APEX connects Jira
- Facts amp Figures
- about me
- Slide 4
- Agenda
- Motivation
- Jira
- Slide 8
- Jira (2)
- Jira (3)
- Jira (4)
- Jira (5)
- Jira (6)
- Jira (7)
- Webservices
- Webservices (2)
- Webservices (3)
- Webservices (4)
- Webservices (5)
- Webservices (6)
- Webservice
- Webservices (8)
- Webservices (9)
- Webservice (2)
- JSON
- JSON
- JSON (2)
- JSON (3)
- JSON (4)
- APEX
- APEX (2)
- Conclusion
- Slide 34
-
17
Webservicesexporting certificate
18
Webservices
calling https
To solve this problem you have to get the certificates which are used by the server which runs Jira
Getting certificate use your browser and call the URL from the REST-Webservice or even from Jira click on the lock symbol click show certificate
exporting certificate
ORA-29273 HTTP request failed ORA-29024 Certificate validation failure
19
Webservicesimporting certificate
20
Webservices
use the Oracle Wallet Manager (OWM) to import the certificate run ORACLE_HOMEbinowmcl (on windows a link is created)
Import of the certificate is also possible using the command line
create a wallet for the certificate using a path like thisORACLE_BASEadminltSIDgtltname_walletgt
Use automatic login for your wallet (otherwise you have to use the wallet always with your password in your plsql code)
importing certificate
21
Webservice
APEX documentationhttpdocsoraclecomcdE59726_01doc50e39151adm_wrkspc002htmBABHEHAG
Login into your INTERNAL WorkspaceManage InstanceInstance SettingsWallet
certificate in APEX
23
Webservices
Shared Components Web Service References Create
Problems based on single items authentification result as CLOB
only in Collection No support in apex_items report columns
JSON Format
Web Service Reference
24
WebservicesWeb Service Reference
25
Webservice
Call REST
p_http_method GET HEAD POST PUT DELETE Username amp Password supporting Basic Authentication Parameter if parameter beside the URL itself are needed
APEX_WEB_SERVICE
l_clob = apex_web_servicemake_rest_request( p_url =gt
httpsjiraatlassiancomrestapilatestissueJRA-9p_http_method =gt GETp_wallet_path =gt fileCoracleadminorclmein_walletp_username =gt lemmop_password =gt 123456 sbquop_parm_name =gt apex_utilstring_to_table(param1param2)p_parm_value =gt apex_utilstring_to_table(val1val2)
)
26
JSON
Datentypen String
QS - Demo Feature 2015-11-03T134816630+0100
Number 20
Boolean true false
Null null
Array [ hellip hellip]
format
id 17149 self httpsjiramt-agcomrestapilatestissue17149 key BP-7 fields ldquosummary QS - Demo Feature progress progress 19800 total 19800 percent 100 created 2015-11-03T134816630+0100 worklog startAt 0 maxResults 20 total 2 worklogs [ ]
27
JSON
convert clob to JSON object
looping entries
get value
processingl_values apex_jsont_valueshellipapex_jsonparse(p_values =gt l_values p_source =gt l_clob)
for i in 1 apex_jsonget_count(p_values =gt l_values p_path =gt )loop hellip end loop
l_jira_issuekey = apex_jsonget_varchar2(p_values =gt pi_json_issue p_path =gt key)
l_jira_issuetimespent = apex_jsonget_number(p_values =gt pi_json_issue p_path =gt fieldstimespent)
28
JSON
Number as String you have to convert
Datetime as String Converting with
apex_jsonget_datedoesnlsquot work because of format
custom fieldsin Jira are named likecustomfield_xxxxx
special cases
id 17149
created 2015-11-03T134816630+0100l_timestamp = to_timestamp_tz(pi_string YYYY-MM-DDThh24missFF3TZHTZM) l_string = to_char(l_timestamp yyyymmdd hh24miss)l_date = to_date(l_string yyyymmdd hh24miss)apex_jsonget_varchar2(p_values =gt pi_json_issue p_path =gt fieldscustomfield_10000)
29
JSON
Time worked Worklog not with information by day encapsuleted in issue you have call the worklog for every single ticket by one REST Call
special cases
for i in 1 apex_jsonget_count(p_values =gt l_values p_path =gt issues)loop l_rest_response = make_rest_request(pi_url =gt pi_jira_base_url || c_jira_rest_base_path || issue || apex_jsonget_varchar2(p_values =gt l_values p_path =gt issues[ || i || ]key) pi_username =gt pi_username pi_password =gt pi_password) apex_jsonparse(p_values =gt l_values_issue p_source =gt l_rest_response) l_jira_issue = get_issue_from_json(pi_json_issue =gt l_values_issue) for j in 1 apex_jsonget_count(p_values =gt l_values_issue p_path =gt fieldsworklogworklogs) loop l_jira_issue_worklog = get_issue_worklog_from_json(pi_json_issue_worklog =gt l_values_issue pi_path =gt fieldsworklogworklogs[ || j || ] pi_jira_issue_id =gt l_jira_issueid pi_jira_issue_key =gt l_jira_issuekey) pipe row(l_jira_issue_worklog)
30
JSON
transform JSON into type easier to use Transformation in package instead APEX testing possible by using sql Entities defined as column names documentation von
CollectionSpalte ndash JSON ndash Spaltenname im Type
using table function based on defined types
processing create or replace type t_jira_issue force as object(-- id 16276-- c001 id number -- Jira Issue ID
-- self httpsjiramt-agcomrestapi2issue16276-- c003 url_json varchar2(32767) -- c003 - JSON URL
-- key UITFPP-1057bdquo-- c001 key varchar2(32767) -- Issue Keyselect
from table(jira_rest_ws_pkgget_projects(pi_base_url =gt httpsjiraatlassiancom))
31
APEX
using APEX_COLLECTIONS not every search means new webservice call loading page doesnlsquot call a webservice APEX itself relies also on collections when working with Web Service References
problem authentication for webservice call every call needs a username amp password using Web Service Reference itlsquos inconvenient using Application Items instead
when logging into the apex application password is saved on server-side by application item attention the password value is visible in session state
32
APEXLivedemo
33
Conclusion
complexity is huge because of many different technical aspects
all important key facts are calculateable
transforming JSON in JavaScript or PLSQL is not easy in the beginning
first time parsing JSON even with APEX_JSON needs practiceremember in 12c you can directly parse JSON by SQL
Using APEX integrated bdquoWeb Service Referenceldquo only for simple examples
OliverLemm
httpoliverlemmblogspotde
httpdelinkedincominOliverLemm
httpswwwxingcomprofileOliver_Lemm
Thanks
- APEX connects Jira
- Facts amp Figures
- about me
- Slide 4
- Agenda
- Motivation
- Jira
- Slide 8
- Jira (2)
- Jira (3)
- Jira (4)
- Jira (5)
- Jira (6)
- Jira (7)
- Webservices
- Webservices (2)
- Webservices (3)
- Webservices (4)
- Webservices (5)
- Webservices (6)
- Webservice
- Webservices (8)
- Webservices (9)
- Webservice (2)
- JSON
- JSON
- JSON (2)
- JSON (3)
- JSON (4)
- APEX
- APEX (2)
- Conclusion
- Slide 34
-
18
Webservices
calling https
To solve this problem you have to get the certificates which are used by the server which runs Jira
Getting certificate use your browser and call the URL from the REST-Webservice or even from Jira click on the lock symbol click show certificate
exporting certificate
ORA-29273 HTTP request failed ORA-29024 Certificate validation failure
19
Webservicesimporting certificate
20
Webservices
use the Oracle Wallet Manager (OWM) to import the certificate run ORACLE_HOMEbinowmcl (on windows a link is created)
Import of the certificate is also possible using the command line
create a wallet for the certificate using a path like thisORACLE_BASEadminltSIDgtltname_walletgt
Use automatic login for your wallet (otherwise you have to use the wallet always with your password in your plsql code)
importing certificate
21
Webservice
APEX documentationhttpdocsoraclecomcdE59726_01doc50e39151adm_wrkspc002htmBABHEHAG
Login into your INTERNAL WorkspaceManage InstanceInstance SettingsWallet
certificate in APEX
23
Webservices
Shared Components Web Service References Create
Problems based on single items authentification result as CLOB
only in Collection No support in apex_items report columns
JSON Format
Web Service Reference
24
WebservicesWeb Service Reference
25
Webservice
Call REST
p_http_method GET HEAD POST PUT DELETE Username amp Password supporting Basic Authentication Parameter if parameter beside the URL itself are needed
APEX_WEB_SERVICE
l_clob = apex_web_servicemake_rest_request( p_url =gt
httpsjiraatlassiancomrestapilatestissueJRA-9p_http_method =gt GETp_wallet_path =gt fileCoracleadminorclmein_walletp_username =gt lemmop_password =gt 123456 sbquop_parm_name =gt apex_utilstring_to_table(param1param2)p_parm_value =gt apex_utilstring_to_table(val1val2)
)
26
JSON
Datentypen String
QS - Demo Feature 2015-11-03T134816630+0100
Number 20
Boolean true false
Null null
Array [ hellip hellip]
format
id 17149 self httpsjiramt-agcomrestapilatestissue17149 key BP-7 fields ldquosummary QS - Demo Feature progress progress 19800 total 19800 percent 100 created 2015-11-03T134816630+0100 worklog startAt 0 maxResults 20 total 2 worklogs [ ]
27
JSON
convert clob to JSON object
looping entries
get value
processingl_values apex_jsont_valueshellipapex_jsonparse(p_values =gt l_values p_source =gt l_clob)
for i in 1 apex_jsonget_count(p_values =gt l_values p_path =gt )loop hellip end loop
l_jira_issuekey = apex_jsonget_varchar2(p_values =gt pi_json_issue p_path =gt key)
l_jira_issuetimespent = apex_jsonget_number(p_values =gt pi_json_issue p_path =gt fieldstimespent)
28
JSON
Number as String you have to convert
Datetime as String Converting with
apex_jsonget_datedoesnlsquot work because of format
custom fieldsin Jira are named likecustomfield_xxxxx
special cases
id 17149
created 2015-11-03T134816630+0100l_timestamp = to_timestamp_tz(pi_string YYYY-MM-DDThh24missFF3TZHTZM) l_string = to_char(l_timestamp yyyymmdd hh24miss)l_date = to_date(l_string yyyymmdd hh24miss)apex_jsonget_varchar2(p_values =gt pi_json_issue p_path =gt fieldscustomfield_10000)
29
JSON
Time worked Worklog not with information by day encapsuleted in issue you have call the worklog for every single ticket by one REST Call
special cases
for i in 1 apex_jsonget_count(p_values =gt l_values p_path =gt issues)loop l_rest_response = make_rest_request(pi_url =gt pi_jira_base_url || c_jira_rest_base_path || issue || apex_jsonget_varchar2(p_values =gt l_values p_path =gt issues[ || i || ]key) pi_username =gt pi_username pi_password =gt pi_password) apex_jsonparse(p_values =gt l_values_issue p_source =gt l_rest_response) l_jira_issue = get_issue_from_json(pi_json_issue =gt l_values_issue) for j in 1 apex_jsonget_count(p_values =gt l_values_issue p_path =gt fieldsworklogworklogs) loop l_jira_issue_worklog = get_issue_worklog_from_json(pi_json_issue_worklog =gt l_values_issue pi_path =gt fieldsworklogworklogs[ || j || ] pi_jira_issue_id =gt l_jira_issueid pi_jira_issue_key =gt l_jira_issuekey) pipe row(l_jira_issue_worklog)
30
JSON
transform JSON into type easier to use Transformation in package instead APEX testing possible by using sql Entities defined as column names documentation von
CollectionSpalte ndash JSON ndash Spaltenname im Type
using table function based on defined types
processing create or replace type t_jira_issue force as object(-- id 16276-- c001 id number -- Jira Issue ID
-- self httpsjiramt-agcomrestapi2issue16276-- c003 url_json varchar2(32767) -- c003 - JSON URL
-- key UITFPP-1057bdquo-- c001 key varchar2(32767) -- Issue Keyselect
from table(jira_rest_ws_pkgget_projects(pi_base_url =gt httpsjiraatlassiancom))
31
APEX
using APEX_COLLECTIONS not every search means new webservice call loading page doesnlsquot call a webservice APEX itself relies also on collections when working with Web Service References
problem authentication for webservice call every call needs a username amp password using Web Service Reference itlsquos inconvenient using Application Items instead
when logging into the apex application password is saved on server-side by application item attention the password value is visible in session state
32
APEXLivedemo
33
Conclusion
complexity is huge because of many different technical aspects
all important key facts are calculateable
transforming JSON in JavaScript or PLSQL is not easy in the beginning
first time parsing JSON even with APEX_JSON needs practiceremember in 12c you can directly parse JSON by SQL
Using APEX integrated bdquoWeb Service Referenceldquo only for simple examples
OliverLemm
httpoliverlemmblogspotde
httpdelinkedincominOliverLemm
httpswwwxingcomprofileOliver_Lemm
Thanks
- APEX connects Jira
- Facts amp Figures
- about me
- Slide 4
- Agenda
- Motivation
- Jira
- Slide 8
- Jira (2)
- Jira (3)
- Jira (4)
- Jira (5)
- Jira (6)
- Jira (7)
- Webservices
- Webservices (2)
- Webservices (3)
- Webservices (4)
- Webservices (5)
- Webservices (6)
- Webservice
- Webservices (8)
- Webservices (9)
- Webservice (2)
- JSON
- JSON
- JSON (2)
- JSON (3)
- JSON (4)
- APEX
- APEX (2)
- Conclusion
- Slide 34
-
19
Webservicesimporting certificate
20
Webservices
use the Oracle Wallet Manager (OWM) to import the certificate run ORACLE_HOMEbinowmcl (on windows a link is created)
Import of the certificate is also possible using the command line
create a wallet for the certificate using a path like thisORACLE_BASEadminltSIDgtltname_walletgt
Use automatic login for your wallet (otherwise you have to use the wallet always with your password in your plsql code)
importing certificate
21
Webservice
APEX documentationhttpdocsoraclecomcdE59726_01doc50e39151adm_wrkspc002htmBABHEHAG
Login into your INTERNAL WorkspaceManage InstanceInstance SettingsWallet
certificate in APEX
23
Webservices
Shared Components Web Service References Create
Problems based on single items authentification result as CLOB
only in Collection No support in apex_items report columns
JSON Format
Web Service Reference
24
WebservicesWeb Service Reference
25
Webservice
Call REST
p_http_method GET HEAD POST PUT DELETE Username amp Password supporting Basic Authentication Parameter if parameter beside the URL itself are needed
APEX_WEB_SERVICE
l_clob = apex_web_servicemake_rest_request( p_url =gt
httpsjiraatlassiancomrestapilatestissueJRA-9p_http_method =gt GETp_wallet_path =gt fileCoracleadminorclmein_walletp_username =gt lemmop_password =gt 123456 sbquop_parm_name =gt apex_utilstring_to_table(param1param2)p_parm_value =gt apex_utilstring_to_table(val1val2)
)
26
JSON
Datentypen String
QS - Demo Feature 2015-11-03T134816630+0100
Number 20
Boolean true false
Null null
Array [ hellip hellip]
format
id 17149 self httpsjiramt-agcomrestapilatestissue17149 key BP-7 fields ldquosummary QS - Demo Feature progress progress 19800 total 19800 percent 100 created 2015-11-03T134816630+0100 worklog startAt 0 maxResults 20 total 2 worklogs [ ]
27
JSON
convert clob to JSON object
looping entries
get value
processingl_values apex_jsont_valueshellipapex_jsonparse(p_values =gt l_values p_source =gt l_clob)
for i in 1 apex_jsonget_count(p_values =gt l_values p_path =gt )loop hellip end loop
l_jira_issuekey = apex_jsonget_varchar2(p_values =gt pi_json_issue p_path =gt key)
l_jira_issuetimespent = apex_jsonget_number(p_values =gt pi_json_issue p_path =gt fieldstimespent)
28
JSON
Number as String you have to convert
Datetime as String Converting with
apex_jsonget_datedoesnlsquot work because of format
custom fieldsin Jira are named likecustomfield_xxxxx
special cases
id 17149
created 2015-11-03T134816630+0100l_timestamp = to_timestamp_tz(pi_string YYYY-MM-DDThh24missFF3TZHTZM) l_string = to_char(l_timestamp yyyymmdd hh24miss)l_date = to_date(l_string yyyymmdd hh24miss)apex_jsonget_varchar2(p_values =gt pi_json_issue p_path =gt fieldscustomfield_10000)
29
JSON
Time worked Worklog not with information by day encapsuleted in issue you have call the worklog for every single ticket by one REST Call
special cases
for i in 1 apex_jsonget_count(p_values =gt l_values p_path =gt issues)loop l_rest_response = make_rest_request(pi_url =gt pi_jira_base_url || c_jira_rest_base_path || issue || apex_jsonget_varchar2(p_values =gt l_values p_path =gt issues[ || i || ]key) pi_username =gt pi_username pi_password =gt pi_password) apex_jsonparse(p_values =gt l_values_issue p_source =gt l_rest_response) l_jira_issue = get_issue_from_json(pi_json_issue =gt l_values_issue) for j in 1 apex_jsonget_count(p_values =gt l_values_issue p_path =gt fieldsworklogworklogs) loop l_jira_issue_worklog = get_issue_worklog_from_json(pi_json_issue_worklog =gt l_values_issue pi_path =gt fieldsworklogworklogs[ || j || ] pi_jira_issue_id =gt l_jira_issueid pi_jira_issue_key =gt l_jira_issuekey) pipe row(l_jira_issue_worklog)
30
JSON
transform JSON into type easier to use Transformation in package instead APEX testing possible by using sql Entities defined as column names documentation von
CollectionSpalte ndash JSON ndash Spaltenname im Type
using table function based on defined types
processing create or replace type t_jira_issue force as object(-- id 16276-- c001 id number -- Jira Issue ID
-- self httpsjiramt-agcomrestapi2issue16276-- c003 url_json varchar2(32767) -- c003 - JSON URL
-- key UITFPP-1057bdquo-- c001 key varchar2(32767) -- Issue Keyselect
from table(jira_rest_ws_pkgget_projects(pi_base_url =gt httpsjiraatlassiancom))
31
APEX
using APEX_COLLECTIONS not every search means new webservice call loading page doesnlsquot call a webservice APEX itself relies also on collections when working with Web Service References
problem authentication for webservice call every call needs a username amp password using Web Service Reference itlsquos inconvenient using Application Items instead
when logging into the apex application password is saved on server-side by application item attention the password value is visible in session state
32
APEXLivedemo
33
Conclusion
complexity is huge because of many different technical aspects
all important key facts are calculateable
transforming JSON in JavaScript or PLSQL is not easy in the beginning
first time parsing JSON even with APEX_JSON needs practiceremember in 12c you can directly parse JSON by SQL
Using APEX integrated bdquoWeb Service Referenceldquo only for simple examples
OliverLemm
httpoliverlemmblogspotde
httpdelinkedincominOliverLemm
httpswwwxingcomprofileOliver_Lemm
Thanks
- APEX connects Jira
- Facts amp Figures
- about me
- Slide 4
- Agenda
- Motivation
- Jira
- Slide 8
- Jira (2)
- Jira (3)
- Jira (4)
- Jira (5)
- Jira (6)
- Jira (7)
- Webservices
- Webservices (2)
- Webservices (3)
- Webservices (4)
- Webservices (5)
- Webservices (6)
- Webservice
- Webservices (8)
- Webservices (9)
- Webservice (2)
- JSON
- JSON
- JSON (2)
- JSON (3)
- JSON (4)
- APEX
- APEX (2)
- Conclusion
- Slide 34
-
20
Webservices
use the Oracle Wallet Manager (OWM) to import the certificate run ORACLE_HOMEbinowmcl (on windows a link is created)
Import of the certificate is also possible using the command line
create a wallet for the certificate using a path like thisORACLE_BASEadminltSIDgtltname_walletgt
Use automatic login for your wallet (otherwise you have to use the wallet always with your password in your plsql code)
importing certificate
21
Webservice
APEX documentationhttpdocsoraclecomcdE59726_01doc50e39151adm_wrkspc002htmBABHEHAG
Login into your INTERNAL WorkspaceManage InstanceInstance SettingsWallet
certificate in APEX
23
Webservices
Shared Components Web Service References Create
Problems based on single items authentification result as CLOB
only in Collection No support in apex_items report columns
JSON Format
Web Service Reference
24
WebservicesWeb Service Reference
25
Webservice
Call REST
p_http_method GET HEAD POST PUT DELETE Username amp Password supporting Basic Authentication Parameter if parameter beside the URL itself are needed
APEX_WEB_SERVICE
l_clob = apex_web_servicemake_rest_request( p_url =gt
httpsjiraatlassiancomrestapilatestissueJRA-9p_http_method =gt GETp_wallet_path =gt fileCoracleadminorclmein_walletp_username =gt lemmop_password =gt 123456 sbquop_parm_name =gt apex_utilstring_to_table(param1param2)p_parm_value =gt apex_utilstring_to_table(val1val2)
)
26
JSON
Datentypen String
QS - Demo Feature 2015-11-03T134816630+0100
Number 20
Boolean true false
Null null
Array [ hellip hellip]
format
id 17149 self httpsjiramt-agcomrestapilatestissue17149 key BP-7 fields ldquosummary QS - Demo Feature progress progress 19800 total 19800 percent 100 created 2015-11-03T134816630+0100 worklog startAt 0 maxResults 20 total 2 worklogs [ ]
27
JSON
convert clob to JSON object
looping entries
get value
processingl_values apex_jsont_valueshellipapex_jsonparse(p_values =gt l_values p_source =gt l_clob)
for i in 1 apex_jsonget_count(p_values =gt l_values p_path =gt )loop hellip end loop
l_jira_issuekey = apex_jsonget_varchar2(p_values =gt pi_json_issue p_path =gt key)
l_jira_issuetimespent = apex_jsonget_number(p_values =gt pi_json_issue p_path =gt fieldstimespent)
28
JSON
Number as String you have to convert
Datetime as String Converting with
apex_jsonget_datedoesnlsquot work because of format
custom fieldsin Jira are named likecustomfield_xxxxx
special cases
id 17149
created 2015-11-03T134816630+0100l_timestamp = to_timestamp_tz(pi_string YYYY-MM-DDThh24missFF3TZHTZM) l_string = to_char(l_timestamp yyyymmdd hh24miss)l_date = to_date(l_string yyyymmdd hh24miss)apex_jsonget_varchar2(p_values =gt pi_json_issue p_path =gt fieldscustomfield_10000)
29
JSON
Time worked Worklog not with information by day encapsuleted in issue you have call the worklog for every single ticket by one REST Call
special cases
for i in 1 apex_jsonget_count(p_values =gt l_values p_path =gt issues)loop l_rest_response = make_rest_request(pi_url =gt pi_jira_base_url || c_jira_rest_base_path || issue || apex_jsonget_varchar2(p_values =gt l_values p_path =gt issues[ || i || ]key) pi_username =gt pi_username pi_password =gt pi_password) apex_jsonparse(p_values =gt l_values_issue p_source =gt l_rest_response) l_jira_issue = get_issue_from_json(pi_json_issue =gt l_values_issue) for j in 1 apex_jsonget_count(p_values =gt l_values_issue p_path =gt fieldsworklogworklogs) loop l_jira_issue_worklog = get_issue_worklog_from_json(pi_json_issue_worklog =gt l_values_issue pi_path =gt fieldsworklogworklogs[ || j || ] pi_jira_issue_id =gt l_jira_issueid pi_jira_issue_key =gt l_jira_issuekey) pipe row(l_jira_issue_worklog)
30
JSON
transform JSON into type easier to use Transformation in package instead APEX testing possible by using sql Entities defined as column names documentation von
CollectionSpalte ndash JSON ndash Spaltenname im Type
using table function based on defined types
processing create or replace type t_jira_issue force as object(-- id 16276-- c001 id number -- Jira Issue ID
-- self httpsjiramt-agcomrestapi2issue16276-- c003 url_json varchar2(32767) -- c003 - JSON URL
-- key UITFPP-1057bdquo-- c001 key varchar2(32767) -- Issue Keyselect
from table(jira_rest_ws_pkgget_projects(pi_base_url =gt httpsjiraatlassiancom))
31
APEX
using APEX_COLLECTIONS not every search means new webservice call loading page doesnlsquot call a webservice APEX itself relies also on collections when working with Web Service References
problem authentication for webservice call every call needs a username amp password using Web Service Reference itlsquos inconvenient using Application Items instead
when logging into the apex application password is saved on server-side by application item attention the password value is visible in session state
32
APEXLivedemo
33
Conclusion
complexity is huge because of many different technical aspects
all important key facts are calculateable
transforming JSON in JavaScript or PLSQL is not easy in the beginning
first time parsing JSON even with APEX_JSON needs practiceremember in 12c you can directly parse JSON by SQL
Using APEX integrated bdquoWeb Service Referenceldquo only for simple examples
OliverLemm
httpoliverlemmblogspotde
httpdelinkedincominOliverLemm
httpswwwxingcomprofileOliver_Lemm
Thanks
- APEX connects Jira
- Facts amp Figures
- about me
- Slide 4
- Agenda
- Motivation
- Jira
- Slide 8
- Jira (2)
- Jira (3)
- Jira (4)
- Jira (5)
- Jira (6)
- Jira (7)
- Webservices
- Webservices (2)
- Webservices (3)
- Webservices (4)
- Webservices (5)
- Webservices (6)
- Webservice
- Webservices (8)
- Webservices (9)
- Webservice (2)
- JSON
- JSON
- JSON (2)
- JSON (3)
- JSON (4)
- APEX
- APEX (2)
- Conclusion
- Slide 34
-
21
Webservice
APEX documentationhttpdocsoraclecomcdE59726_01doc50e39151adm_wrkspc002htmBABHEHAG
Login into your INTERNAL WorkspaceManage InstanceInstance SettingsWallet
certificate in APEX
23
Webservices
Shared Components Web Service References Create
Problems based on single items authentification result as CLOB
only in Collection No support in apex_items report columns
JSON Format
Web Service Reference
24
WebservicesWeb Service Reference
25
Webservice
Call REST
p_http_method GET HEAD POST PUT DELETE Username amp Password supporting Basic Authentication Parameter if parameter beside the URL itself are needed
APEX_WEB_SERVICE
l_clob = apex_web_servicemake_rest_request( p_url =gt
httpsjiraatlassiancomrestapilatestissueJRA-9p_http_method =gt GETp_wallet_path =gt fileCoracleadminorclmein_walletp_username =gt lemmop_password =gt 123456 sbquop_parm_name =gt apex_utilstring_to_table(param1param2)p_parm_value =gt apex_utilstring_to_table(val1val2)
)
26
JSON
Datentypen String
QS - Demo Feature 2015-11-03T134816630+0100
Number 20
Boolean true false
Null null
Array [ hellip hellip]
format
id 17149 self httpsjiramt-agcomrestapilatestissue17149 key BP-7 fields ldquosummary QS - Demo Feature progress progress 19800 total 19800 percent 100 created 2015-11-03T134816630+0100 worklog startAt 0 maxResults 20 total 2 worklogs [ ]
27
JSON
convert clob to JSON object
looping entries
get value
processingl_values apex_jsont_valueshellipapex_jsonparse(p_values =gt l_values p_source =gt l_clob)
for i in 1 apex_jsonget_count(p_values =gt l_values p_path =gt )loop hellip end loop
l_jira_issuekey = apex_jsonget_varchar2(p_values =gt pi_json_issue p_path =gt key)
l_jira_issuetimespent = apex_jsonget_number(p_values =gt pi_json_issue p_path =gt fieldstimespent)
28
JSON
Number as String you have to convert
Datetime as String Converting with
apex_jsonget_datedoesnlsquot work because of format
custom fieldsin Jira are named likecustomfield_xxxxx
special cases
id 17149
created 2015-11-03T134816630+0100l_timestamp = to_timestamp_tz(pi_string YYYY-MM-DDThh24missFF3TZHTZM) l_string = to_char(l_timestamp yyyymmdd hh24miss)l_date = to_date(l_string yyyymmdd hh24miss)apex_jsonget_varchar2(p_values =gt pi_json_issue p_path =gt fieldscustomfield_10000)
29
JSON
Time worked Worklog not with information by day encapsuleted in issue you have call the worklog for every single ticket by one REST Call
special cases
for i in 1 apex_jsonget_count(p_values =gt l_values p_path =gt issues)loop l_rest_response = make_rest_request(pi_url =gt pi_jira_base_url || c_jira_rest_base_path || issue || apex_jsonget_varchar2(p_values =gt l_values p_path =gt issues[ || i || ]key) pi_username =gt pi_username pi_password =gt pi_password) apex_jsonparse(p_values =gt l_values_issue p_source =gt l_rest_response) l_jira_issue = get_issue_from_json(pi_json_issue =gt l_values_issue) for j in 1 apex_jsonget_count(p_values =gt l_values_issue p_path =gt fieldsworklogworklogs) loop l_jira_issue_worklog = get_issue_worklog_from_json(pi_json_issue_worklog =gt l_values_issue pi_path =gt fieldsworklogworklogs[ || j || ] pi_jira_issue_id =gt l_jira_issueid pi_jira_issue_key =gt l_jira_issuekey) pipe row(l_jira_issue_worklog)
30
JSON
transform JSON into type easier to use Transformation in package instead APEX testing possible by using sql Entities defined as column names documentation von
CollectionSpalte ndash JSON ndash Spaltenname im Type
using table function based on defined types
processing create or replace type t_jira_issue force as object(-- id 16276-- c001 id number -- Jira Issue ID
-- self httpsjiramt-agcomrestapi2issue16276-- c003 url_json varchar2(32767) -- c003 - JSON URL
-- key UITFPP-1057bdquo-- c001 key varchar2(32767) -- Issue Keyselect
from table(jira_rest_ws_pkgget_projects(pi_base_url =gt httpsjiraatlassiancom))
31
APEX
using APEX_COLLECTIONS not every search means new webservice call loading page doesnlsquot call a webservice APEX itself relies also on collections when working with Web Service References
problem authentication for webservice call every call needs a username amp password using Web Service Reference itlsquos inconvenient using Application Items instead
when logging into the apex application password is saved on server-side by application item attention the password value is visible in session state
32
APEXLivedemo
33
Conclusion
complexity is huge because of many different technical aspects
all important key facts are calculateable
transforming JSON in JavaScript or PLSQL is not easy in the beginning
first time parsing JSON even with APEX_JSON needs practiceremember in 12c you can directly parse JSON by SQL
Using APEX integrated bdquoWeb Service Referenceldquo only for simple examples
OliverLemm
httpoliverlemmblogspotde
httpdelinkedincominOliverLemm
httpswwwxingcomprofileOliver_Lemm
Thanks
- APEX connects Jira
- Facts amp Figures
- about me
- Slide 4
- Agenda
- Motivation
- Jira
- Slide 8
- Jira (2)
- Jira (3)
- Jira (4)
- Jira (5)
- Jira (6)
- Jira (7)
- Webservices
- Webservices (2)
- Webservices (3)
- Webservices (4)
- Webservices (5)
- Webservices (6)
- Webservice
- Webservices (8)
- Webservices (9)
- Webservice (2)
- JSON
- JSON
- JSON (2)
- JSON (3)
- JSON (4)
- APEX
- APEX (2)
- Conclusion
- Slide 34
-
23
Webservices
Shared Components Web Service References Create
Problems based on single items authentification result as CLOB
only in Collection No support in apex_items report columns
JSON Format
Web Service Reference
24
WebservicesWeb Service Reference
25
Webservice
Call REST
p_http_method GET HEAD POST PUT DELETE Username amp Password supporting Basic Authentication Parameter if parameter beside the URL itself are needed
APEX_WEB_SERVICE
l_clob = apex_web_servicemake_rest_request( p_url =gt
httpsjiraatlassiancomrestapilatestissueJRA-9p_http_method =gt GETp_wallet_path =gt fileCoracleadminorclmein_walletp_username =gt lemmop_password =gt 123456 sbquop_parm_name =gt apex_utilstring_to_table(param1param2)p_parm_value =gt apex_utilstring_to_table(val1val2)
)
26
JSON
Datentypen String
QS - Demo Feature 2015-11-03T134816630+0100
Number 20
Boolean true false
Null null
Array [ hellip hellip]
format
id 17149 self httpsjiramt-agcomrestapilatestissue17149 key BP-7 fields ldquosummary QS - Demo Feature progress progress 19800 total 19800 percent 100 created 2015-11-03T134816630+0100 worklog startAt 0 maxResults 20 total 2 worklogs [ ]
27
JSON
convert clob to JSON object
looping entries
get value
processingl_values apex_jsont_valueshellipapex_jsonparse(p_values =gt l_values p_source =gt l_clob)
for i in 1 apex_jsonget_count(p_values =gt l_values p_path =gt )loop hellip end loop
l_jira_issuekey = apex_jsonget_varchar2(p_values =gt pi_json_issue p_path =gt key)
l_jira_issuetimespent = apex_jsonget_number(p_values =gt pi_json_issue p_path =gt fieldstimespent)
28
JSON
Number as String you have to convert
Datetime as String Converting with
apex_jsonget_datedoesnlsquot work because of format
custom fieldsin Jira are named likecustomfield_xxxxx
special cases
id 17149
created 2015-11-03T134816630+0100l_timestamp = to_timestamp_tz(pi_string YYYY-MM-DDThh24missFF3TZHTZM) l_string = to_char(l_timestamp yyyymmdd hh24miss)l_date = to_date(l_string yyyymmdd hh24miss)apex_jsonget_varchar2(p_values =gt pi_json_issue p_path =gt fieldscustomfield_10000)
29
JSON
Time worked Worklog not with information by day encapsuleted in issue you have call the worklog for every single ticket by one REST Call
special cases
for i in 1 apex_jsonget_count(p_values =gt l_values p_path =gt issues)loop l_rest_response = make_rest_request(pi_url =gt pi_jira_base_url || c_jira_rest_base_path || issue || apex_jsonget_varchar2(p_values =gt l_values p_path =gt issues[ || i || ]key) pi_username =gt pi_username pi_password =gt pi_password) apex_jsonparse(p_values =gt l_values_issue p_source =gt l_rest_response) l_jira_issue = get_issue_from_json(pi_json_issue =gt l_values_issue) for j in 1 apex_jsonget_count(p_values =gt l_values_issue p_path =gt fieldsworklogworklogs) loop l_jira_issue_worklog = get_issue_worklog_from_json(pi_json_issue_worklog =gt l_values_issue pi_path =gt fieldsworklogworklogs[ || j || ] pi_jira_issue_id =gt l_jira_issueid pi_jira_issue_key =gt l_jira_issuekey) pipe row(l_jira_issue_worklog)
30
JSON
transform JSON into type easier to use Transformation in package instead APEX testing possible by using sql Entities defined as column names documentation von
CollectionSpalte ndash JSON ndash Spaltenname im Type
using table function based on defined types
processing create or replace type t_jira_issue force as object(-- id 16276-- c001 id number -- Jira Issue ID
-- self httpsjiramt-agcomrestapi2issue16276-- c003 url_json varchar2(32767) -- c003 - JSON URL
-- key UITFPP-1057bdquo-- c001 key varchar2(32767) -- Issue Keyselect
from table(jira_rest_ws_pkgget_projects(pi_base_url =gt httpsjiraatlassiancom))
31
APEX
using APEX_COLLECTIONS not every search means new webservice call loading page doesnlsquot call a webservice APEX itself relies also on collections when working with Web Service References
problem authentication for webservice call every call needs a username amp password using Web Service Reference itlsquos inconvenient using Application Items instead
when logging into the apex application password is saved on server-side by application item attention the password value is visible in session state
32
APEXLivedemo
33
Conclusion
complexity is huge because of many different technical aspects
all important key facts are calculateable
transforming JSON in JavaScript or PLSQL is not easy in the beginning
first time parsing JSON even with APEX_JSON needs practiceremember in 12c you can directly parse JSON by SQL
Using APEX integrated bdquoWeb Service Referenceldquo only for simple examples
OliverLemm
httpoliverlemmblogspotde
httpdelinkedincominOliverLemm
httpswwwxingcomprofileOliver_Lemm
Thanks
- APEX connects Jira
- Facts amp Figures
- about me
- Slide 4
- Agenda
- Motivation
- Jira
- Slide 8
- Jira (2)
- Jira (3)
- Jira (4)
- Jira (5)
- Jira (6)
- Jira (7)
- Webservices
- Webservices (2)
- Webservices (3)
- Webservices (4)
- Webservices (5)
- Webservices (6)
- Webservice
- Webservices (8)
- Webservices (9)
- Webservice (2)
- JSON
- JSON
- JSON (2)
- JSON (3)
- JSON (4)
- APEX
- APEX (2)
- Conclusion
- Slide 34
-
24
WebservicesWeb Service Reference
25
Webservice
Call REST
p_http_method GET HEAD POST PUT DELETE Username amp Password supporting Basic Authentication Parameter if parameter beside the URL itself are needed
APEX_WEB_SERVICE
l_clob = apex_web_servicemake_rest_request( p_url =gt
httpsjiraatlassiancomrestapilatestissueJRA-9p_http_method =gt GETp_wallet_path =gt fileCoracleadminorclmein_walletp_username =gt lemmop_password =gt 123456 sbquop_parm_name =gt apex_utilstring_to_table(param1param2)p_parm_value =gt apex_utilstring_to_table(val1val2)
)
26
JSON
Datentypen String
QS - Demo Feature 2015-11-03T134816630+0100
Number 20
Boolean true false
Null null
Array [ hellip hellip]
format
id 17149 self httpsjiramt-agcomrestapilatestissue17149 key BP-7 fields ldquosummary QS - Demo Feature progress progress 19800 total 19800 percent 100 created 2015-11-03T134816630+0100 worklog startAt 0 maxResults 20 total 2 worklogs [ ]
27
JSON
convert clob to JSON object
looping entries
get value
processingl_values apex_jsont_valueshellipapex_jsonparse(p_values =gt l_values p_source =gt l_clob)
for i in 1 apex_jsonget_count(p_values =gt l_values p_path =gt )loop hellip end loop
l_jira_issuekey = apex_jsonget_varchar2(p_values =gt pi_json_issue p_path =gt key)
l_jira_issuetimespent = apex_jsonget_number(p_values =gt pi_json_issue p_path =gt fieldstimespent)
28
JSON
Number as String you have to convert
Datetime as String Converting with
apex_jsonget_datedoesnlsquot work because of format
custom fieldsin Jira are named likecustomfield_xxxxx
special cases
id 17149
created 2015-11-03T134816630+0100l_timestamp = to_timestamp_tz(pi_string YYYY-MM-DDThh24missFF3TZHTZM) l_string = to_char(l_timestamp yyyymmdd hh24miss)l_date = to_date(l_string yyyymmdd hh24miss)apex_jsonget_varchar2(p_values =gt pi_json_issue p_path =gt fieldscustomfield_10000)
29
JSON
Time worked Worklog not with information by day encapsuleted in issue you have call the worklog for every single ticket by one REST Call
special cases
for i in 1 apex_jsonget_count(p_values =gt l_values p_path =gt issues)loop l_rest_response = make_rest_request(pi_url =gt pi_jira_base_url || c_jira_rest_base_path || issue || apex_jsonget_varchar2(p_values =gt l_values p_path =gt issues[ || i || ]key) pi_username =gt pi_username pi_password =gt pi_password) apex_jsonparse(p_values =gt l_values_issue p_source =gt l_rest_response) l_jira_issue = get_issue_from_json(pi_json_issue =gt l_values_issue) for j in 1 apex_jsonget_count(p_values =gt l_values_issue p_path =gt fieldsworklogworklogs) loop l_jira_issue_worklog = get_issue_worklog_from_json(pi_json_issue_worklog =gt l_values_issue pi_path =gt fieldsworklogworklogs[ || j || ] pi_jira_issue_id =gt l_jira_issueid pi_jira_issue_key =gt l_jira_issuekey) pipe row(l_jira_issue_worklog)
30
JSON
transform JSON into type easier to use Transformation in package instead APEX testing possible by using sql Entities defined as column names documentation von
CollectionSpalte ndash JSON ndash Spaltenname im Type
using table function based on defined types
processing create or replace type t_jira_issue force as object(-- id 16276-- c001 id number -- Jira Issue ID
-- self httpsjiramt-agcomrestapi2issue16276-- c003 url_json varchar2(32767) -- c003 - JSON URL
-- key UITFPP-1057bdquo-- c001 key varchar2(32767) -- Issue Keyselect
from table(jira_rest_ws_pkgget_projects(pi_base_url =gt httpsjiraatlassiancom))
31
APEX
using APEX_COLLECTIONS not every search means new webservice call loading page doesnlsquot call a webservice APEX itself relies also on collections when working with Web Service References
problem authentication for webservice call every call needs a username amp password using Web Service Reference itlsquos inconvenient using Application Items instead
when logging into the apex application password is saved on server-side by application item attention the password value is visible in session state
32
APEXLivedemo
33
Conclusion
complexity is huge because of many different technical aspects
all important key facts are calculateable
transforming JSON in JavaScript or PLSQL is not easy in the beginning
first time parsing JSON even with APEX_JSON needs practiceremember in 12c you can directly parse JSON by SQL
Using APEX integrated bdquoWeb Service Referenceldquo only for simple examples
OliverLemm
httpoliverlemmblogspotde
httpdelinkedincominOliverLemm
httpswwwxingcomprofileOliver_Lemm
Thanks
- APEX connects Jira
- Facts amp Figures
- about me
- Slide 4
- Agenda
- Motivation
- Jira
- Slide 8
- Jira (2)
- Jira (3)
- Jira (4)
- Jira (5)
- Jira (6)
- Jira (7)
- Webservices
- Webservices (2)
- Webservices (3)
- Webservices (4)
- Webservices (5)
- Webservices (6)
- Webservice
- Webservices (8)
- Webservices (9)
- Webservice (2)
- JSON
- JSON
- JSON (2)
- JSON (3)
- JSON (4)
- APEX
- APEX (2)
- Conclusion
- Slide 34
-
25
Webservice
Call REST
p_http_method GET HEAD POST PUT DELETE Username amp Password supporting Basic Authentication Parameter if parameter beside the URL itself are needed
APEX_WEB_SERVICE
l_clob = apex_web_servicemake_rest_request( p_url =gt
httpsjiraatlassiancomrestapilatestissueJRA-9p_http_method =gt GETp_wallet_path =gt fileCoracleadminorclmein_walletp_username =gt lemmop_password =gt 123456 sbquop_parm_name =gt apex_utilstring_to_table(param1param2)p_parm_value =gt apex_utilstring_to_table(val1val2)
)
26
JSON
Datentypen String
QS - Demo Feature 2015-11-03T134816630+0100
Number 20
Boolean true false
Null null
Array [ hellip hellip]
format
id 17149 self httpsjiramt-agcomrestapilatestissue17149 key BP-7 fields ldquosummary QS - Demo Feature progress progress 19800 total 19800 percent 100 created 2015-11-03T134816630+0100 worklog startAt 0 maxResults 20 total 2 worklogs [ ]
27
JSON
convert clob to JSON object
looping entries
get value
processingl_values apex_jsont_valueshellipapex_jsonparse(p_values =gt l_values p_source =gt l_clob)
for i in 1 apex_jsonget_count(p_values =gt l_values p_path =gt )loop hellip end loop
l_jira_issuekey = apex_jsonget_varchar2(p_values =gt pi_json_issue p_path =gt key)
l_jira_issuetimespent = apex_jsonget_number(p_values =gt pi_json_issue p_path =gt fieldstimespent)
28
JSON
Number as String you have to convert
Datetime as String Converting with
apex_jsonget_datedoesnlsquot work because of format
custom fieldsin Jira are named likecustomfield_xxxxx
special cases
id 17149
created 2015-11-03T134816630+0100l_timestamp = to_timestamp_tz(pi_string YYYY-MM-DDThh24missFF3TZHTZM) l_string = to_char(l_timestamp yyyymmdd hh24miss)l_date = to_date(l_string yyyymmdd hh24miss)apex_jsonget_varchar2(p_values =gt pi_json_issue p_path =gt fieldscustomfield_10000)
29
JSON
Time worked Worklog not with information by day encapsuleted in issue you have call the worklog for every single ticket by one REST Call
special cases
for i in 1 apex_jsonget_count(p_values =gt l_values p_path =gt issues)loop l_rest_response = make_rest_request(pi_url =gt pi_jira_base_url || c_jira_rest_base_path || issue || apex_jsonget_varchar2(p_values =gt l_values p_path =gt issues[ || i || ]key) pi_username =gt pi_username pi_password =gt pi_password) apex_jsonparse(p_values =gt l_values_issue p_source =gt l_rest_response) l_jira_issue = get_issue_from_json(pi_json_issue =gt l_values_issue) for j in 1 apex_jsonget_count(p_values =gt l_values_issue p_path =gt fieldsworklogworklogs) loop l_jira_issue_worklog = get_issue_worklog_from_json(pi_json_issue_worklog =gt l_values_issue pi_path =gt fieldsworklogworklogs[ || j || ] pi_jira_issue_id =gt l_jira_issueid pi_jira_issue_key =gt l_jira_issuekey) pipe row(l_jira_issue_worklog)
30
JSON
transform JSON into type easier to use Transformation in package instead APEX testing possible by using sql Entities defined as column names documentation von
CollectionSpalte ndash JSON ndash Spaltenname im Type
using table function based on defined types
processing create or replace type t_jira_issue force as object(-- id 16276-- c001 id number -- Jira Issue ID
-- self httpsjiramt-agcomrestapi2issue16276-- c003 url_json varchar2(32767) -- c003 - JSON URL
-- key UITFPP-1057bdquo-- c001 key varchar2(32767) -- Issue Keyselect
from table(jira_rest_ws_pkgget_projects(pi_base_url =gt httpsjiraatlassiancom))
31
APEX
using APEX_COLLECTIONS not every search means new webservice call loading page doesnlsquot call a webservice APEX itself relies also on collections when working with Web Service References
problem authentication for webservice call every call needs a username amp password using Web Service Reference itlsquos inconvenient using Application Items instead
when logging into the apex application password is saved on server-side by application item attention the password value is visible in session state
32
APEXLivedemo
33
Conclusion
complexity is huge because of many different technical aspects
all important key facts are calculateable
transforming JSON in JavaScript or PLSQL is not easy in the beginning
first time parsing JSON even with APEX_JSON needs practiceremember in 12c you can directly parse JSON by SQL
Using APEX integrated bdquoWeb Service Referenceldquo only for simple examples
OliverLemm
httpoliverlemmblogspotde
httpdelinkedincominOliverLemm
httpswwwxingcomprofileOliver_Lemm
Thanks
- APEX connects Jira
- Facts amp Figures
- about me
- Slide 4
- Agenda
- Motivation
- Jira
- Slide 8
- Jira (2)
- Jira (3)
- Jira (4)
- Jira (5)
- Jira (6)
- Jira (7)
- Webservices
- Webservices (2)
- Webservices (3)
- Webservices (4)
- Webservices (5)
- Webservices (6)
- Webservice
- Webservices (8)
- Webservices (9)
- Webservice (2)
- JSON
- JSON
- JSON (2)
- JSON (3)
- JSON (4)
- APEX
- APEX (2)
- Conclusion
- Slide 34
-
26
JSON
Datentypen String
QS - Demo Feature 2015-11-03T134816630+0100
Number 20
Boolean true false
Null null
Array [ hellip hellip]
format
id 17149 self httpsjiramt-agcomrestapilatestissue17149 key BP-7 fields ldquosummary QS - Demo Feature progress progress 19800 total 19800 percent 100 created 2015-11-03T134816630+0100 worklog startAt 0 maxResults 20 total 2 worklogs [ ]
27
JSON
convert clob to JSON object
looping entries
get value
processingl_values apex_jsont_valueshellipapex_jsonparse(p_values =gt l_values p_source =gt l_clob)
for i in 1 apex_jsonget_count(p_values =gt l_values p_path =gt )loop hellip end loop
l_jira_issuekey = apex_jsonget_varchar2(p_values =gt pi_json_issue p_path =gt key)
l_jira_issuetimespent = apex_jsonget_number(p_values =gt pi_json_issue p_path =gt fieldstimespent)
28
JSON
Number as String you have to convert
Datetime as String Converting with
apex_jsonget_datedoesnlsquot work because of format
custom fieldsin Jira are named likecustomfield_xxxxx
special cases
id 17149
created 2015-11-03T134816630+0100l_timestamp = to_timestamp_tz(pi_string YYYY-MM-DDThh24missFF3TZHTZM) l_string = to_char(l_timestamp yyyymmdd hh24miss)l_date = to_date(l_string yyyymmdd hh24miss)apex_jsonget_varchar2(p_values =gt pi_json_issue p_path =gt fieldscustomfield_10000)
29
JSON
Time worked Worklog not with information by day encapsuleted in issue you have call the worklog for every single ticket by one REST Call
special cases
for i in 1 apex_jsonget_count(p_values =gt l_values p_path =gt issues)loop l_rest_response = make_rest_request(pi_url =gt pi_jira_base_url || c_jira_rest_base_path || issue || apex_jsonget_varchar2(p_values =gt l_values p_path =gt issues[ || i || ]key) pi_username =gt pi_username pi_password =gt pi_password) apex_jsonparse(p_values =gt l_values_issue p_source =gt l_rest_response) l_jira_issue = get_issue_from_json(pi_json_issue =gt l_values_issue) for j in 1 apex_jsonget_count(p_values =gt l_values_issue p_path =gt fieldsworklogworklogs) loop l_jira_issue_worklog = get_issue_worklog_from_json(pi_json_issue_worklog =gt l_values_issue pi_path =gt fieldsworklogworklogs[ || j || ] pi_jira_issue_id =gt l_jira_issueid pi_jira_issue_key =gt l_jira_issuekey) pipe row(l_jira_issue_worklog)
30
JSON
transform JSON into type easier to use Transformation in package instead APEX testing possible by using sql Entities defined as column names documentation von
CollectionSpalte ndash JSON ndash Spaltenname im Type
using table function based on defined types
processing create or replace type t_jira_issue force as object(-- id 16276-- c001 id number -- Jira Issue ID
-- self httpsjiramt-agcomrestapi2issue16276-- c003 url_json varchar2(32767) -- c003 - JSON URL
-- key UITFPP-1057bdquo-- c001 key varchar2(32767) -- Issue Keyselect
from table(jira_rest_ws_pkgget_projects(pi_base_url =gt httpsjiraatlassiancom))
31
APEX
using APEX_COLLECTIONS not every search means new webservice call loading page doesnlsquot call a webservice APEX itself relies also on collections when working with Web Service References
problem authentication for webservice call every call needs a username amp password using Web Service Reference itlsquos inconvenient using Application Items instead
when logging into the apex application password is saved on server-side by application item attention the password value is visible in session state
32
APEXLivedemo
33
Conclusion
complexity is huge because of many different technical aspects
all important key facts are calculateable
transforming JSON in JavaScript or PLSQL is not easy in the beginning
first time parsing JSON even with APEX_JSON needs practiceremember in 12c you can directly parse JSON by SQL
Using APEX integrated bdquoWeb Service Referenceldquo only for simple examples
OliverLemm
httpoliverlemmblogspotde
httpdelinkedincominOliverLemm
httpswwwxingcomprofileOliver_Lemm
Thanks
- APEX connects Jira
- Facts amp Figures
- about me
- Slide 4
- Agenda
- Motivation
- Jira
- Slide 8
- Jira (2)
- Jira (3)
- Jira (4)
- Jira (5)
- Jira (6)
- Jira (7)
- Webservices
- Webservices (2)
- Webservices (3)
- Webservices (4)
- Webservices (5)
- Webservices (6)
- Webservice
- Webservices (8)
- Webservices (9)
- Webservice (2)
- JSON
- JSON
- JSON (2)
- JSON (3)
- JSON (4)
- APEX
- APEX (2)
- Conclusion
- Slide 34
-
27
JSON
convert clob to JSON object
looping entries
get value
processingl_values apex_jsont_valueshellipapex_jsonparse(p_values =gt l_values p_source =gt l_clob)
for i in 1 apex_jsonget_count(p_values =gt l_values p_path =gt )loop hellip end loop
l_jira_issuekey = apex_jsonget_varchar2(p_values =gt pi_json_issue p_path =gt key)
l_jira_issuetimespent = apex_jsonget_number(p_values =gt pi_json_issue p_path =gt fieldstimespent)
28
JSON
Number as String you have to convert
Datetime as String Converting with
apex_jsonget_datedoesnlsquot work because of format
custom fieldsin Jira are named likecustomfield_xxxxx
special cases
id 17149
created 2015-11-03T134816630+0100l_timestamp = to_timestamp_tz(pi_string YYYY-MM-DDThh24missFF3TZHTZM) l_string = to_char(l_timestamp yyyymmdd hh24miss)l_date = to_date(l_string yyyymmdd hh24miss)apex_jsonget_varchar2(p_values =gt pi_json_issue p_path =gt fieldscustomfield_10000)
29
JSON
Time worked Worklog not with information by day encapsuleted in issue you have call the worklog for every single ticket by one REST Call
special cases
for i in 1 apex_jsonget_count(p_values =gt l_values p_path =gt issues)loop l_rest_response = make_rest_request(pi_url =gt pi_jira_base_url || c_jira_rest_base_path || issue || apex_jsonget_varchar2(p_values =gt l_values p_path =gt issues[ || i || ]key) pi_username =gt pi_username pi_password =gt pi_password) apex_jsonparse(p_values =gt l_values_issue p_source =gt l_rest_response) l_jira_issue = get_issue_from_json(pi_json_issue =gt l_values_issue) for j in 1 apex_jsonget_count(p_values =gt l_values_issue p_path =gt fieldsworklogworklogs) loop l_jira_issue_worklog = get_issue_worklog_from_json(pi_json_issue_worklog =gt l_values_issue pi_path =gt fieldsworklogworklogs[ || j || ] pi_jira_issue_id =gt l_jira_issueid pi_jira_issue_key =gt l_jira_issuekey) pipe row(l_jira_issue_worklog)
30
JSON
transform JSON into type easier to use Transformation in package instead APEX testing possible by using sql Entities defined as column names documentation von
CollectionSpalte ndash JSON ndash Spaltenname im Type
using table function based on defined types
processing create or replace type t_jira_issue force as object(-- id 16276-- c001 id number -- Jira Issue ID
-- self httpsjiramt-agcomrestapi2issue16276-- c003 url_json varchar2(32767) -- c003 - JSON URL
-- key UITFPP-1057bdquo-- c001 key varchar2(32767) -- Issue Keyselect
from table(jira_rest_ws_pkgget_projects(pi_base_url =gt httpsjiraatlassiancom))
31
APEX
using APEX_COLLECTIONS not every search means new webservice call loading page doesnlsquot call a webservice APEX itself relies also on collections when working with Web Service References
problem authentication for webservice call every call needs a username amp password using Web Service Reference itlsquos inconvenient using Application Items instead
when logging into the apex application password is saved on server-side by application item attention the password value is visible in session state
32
APEXLivedemo
33
Conclusion
complexity is huge because of many different technical aspects
all important key facts are calculateable
transforming JSON in JavaScript or PLSQL is not easy in the beginning
first time parsing JSON even with APEX_JSON needs practiceremember in 12c you can directly parse JSON by SQL
Using APEX integrated bdquoWeb Service Referenceldquo only for simple examples
OliverLemm
httpoliverlemmblogspotde
httpdelinkedincominOliverLemm
httpswwwxingcomprofileOliver_Lemm
Thanks
- APEX connects Jira
- Facts amp Figures
- about me
- Slide 4
- Agenda
- Motivation
- Jira
- Slide 8
- Jira (2)
- Jira (3)
- Jira (4)
- Jira (5)
- Jira (6)
- Jira (7)
- Webservices
- Webservices (2)
- Webservices (3)
- Webservices (4)
- Webservices (5)
- Webservices (6)
- Webservice
- Webservices (8)
- Webservices (9)
- Webservice (2)
- JSON
- JSON
- JSON (2)
- JSON (3)
- JSON (4)
- APEX
- APEX (2)
- Conclusion
- Slide 34
-
28
JSON
Number as String you have to convert
Datetime as String Converting with
apex_jsonget_datedoesnlsquot work because of format
custom fieldsin Jira are named likecustomfield_xxxxx
special cases
id 17149
created 2015-11-03T134816630+0100l_timestamp = to_timestamp_tz(pi_string YYYY-MM-DDThh24missFF3TZHTZM) l_string = to_char(l_timestamp yyyymmdd hh24miss)l_date = to_date(l_string yyyymmdd hh24miss)apex_jsonget_varchar2(p_values =gt pi_json_issue p_path =gt fieldscustomfield_10000)
29
JSON
Time worked Worklog not with information by day encapsuleted in issue you have call the worklog for every single ticket by one REST Call
special cases
for i in 1 apex_jsonget_count(p_values =gt l_values p_path =gt issues)loop l_rest_response = make_rest_request(pi_url =gt pi_jira_base_url || c_jira_rest_base_path || issue || apex_jsonget_varchar2(p_values =gt l_values p_path =gt issues[ || i || ]key) pi_username =gt pi_username pi_password =gt pi_password) apex_jsonparse(p_values =gt l_values_issue p_source =gt l_rest_response) l_jira_issue = get_issue_from_json(pi_json_issue =gt l_values_issue) for j in 1 apex_jsonget_count(p_values =gt l_values_issue p_path =gt fieldsworklogworklogs) loop l_jira_issue_worklog = get_issue_worklog_from_json(pi_json_issue_worklog =gt l_values_issue pi_path =gt fieldsworklogworklogs[ || j || ] pi_jira_issue_id =gt l_jira_issueid pi_jira_issue_key =gt l_jira_issuekey) pipe row(l_jira_issue_worklog)
30
JSON
transform JSON into type easier to use Transformation in package instead APEX testing possible by using sql Entities defined as column names documentation von
CollectionSpalte ndash JSON ndash Spaltenname im Type
using table function based on defined types
processing create or replace type t_jira_issue force as object(-- id 16276-- c001 id number -- Jira Issue ID
-- self httpsjiramt-agcomrestapi2issue16276-- c003 url_json varchar2(32767) -- c003 - JSON URL
-- key UITFPP-1057bdquo-- c001 key varchar2(32767) -- Issue Keyselect
from table(jira_rest_ws_pkgget_projects(pi_base_url =gt httpsjiraatlassiancom))
31
APEX
using APEX_COLLECTIONS not every search means new webservice call loading page doesnlsquot call a webservice APEX itself relies also on collections when working with Web Service References
problem authentication for webservice call every call needs a username amp password using Web Service Reference itlsquos inconvenient using Application Items instead
when logging into the apex application password is saved on server-side by application item attention the password value is visible in session state
32
APEXLivedemo
33
Conclusion
complexity is huge because of many different technical aspects
all important key facts are calculateable
transforming JSON in JavaScript or PLSQL is not easy in the beginning
first time parsing JSON even with APEX_JSON needs practiceremember in 12c you can directly parse JSON by SQL
Using APEX integrated bdquoWeb Service Referenceldquo only for simple examples
OliverLemm
httpoliverlemmblogspotde
httpdelinkedincominOliverLemm
httpswwwxingcomprofileOliver_Lemm
Thanks
- APEX connects Jira
- Facts amp Figures
- about me
- Slide 4
- Agenda
- Motivation
- Jira
- Slide 8
- Jira (2)
- Jira (3)
- Jira (4)
- Jira (5)
- Jira (6)
- Jira (7)
- Webservices
- Webservices (2)
- Webservices (3)
- Webservices (4)
- Webservices (5)
- Webservices (6)
- Webservice
- Webservices (8)
- Webservices (9)
- Webservice (2)
- JSON
- JSON
- JSON (2)
- JSON (3)
- JSON (4)
- APEX
- APEX (2)
- Conclusion
- Slide 34
-
29
JSON
Time worked Worklog not with information by day encapsuleted in issue you have call the worklog for every single ticket by one REST Call
special cases
for i in 1 apex_jsonget_count(p_values =gt l_values p_path =gt issues)loop l_rest_response = make_rest_request(pi_url =gt pi_jira_base_url || c_jira_rest_base_path || issue || apex_jsonget_varchar2(p_values =gt l_values p_path =gt issues[ || i || ]key) pi_username =gt pi_username pi_password =gt pi_password) apex_jsonparse(p_values =gt l_values_issue p_source =gt l_rest_response) l_jira_issue = get_issue_from_json(pi_json_issue =gt l_values_issue) for j in 1 apex_jsonget_count(p_values =gt l_values_issue p_path =gt fieldsworklogworklogs) loop l_jira_issue_worklog = get_issue_worklog_from_json(pi_json_issue_worklog =gt l_values_issue pi_path =gt fieldsworklogworklogs[ || j || ] pi_jira_issue_id =gt l_jira_issueid pi_jira_issue_key =gt l_jira_issuekey) pipe row(l_jira_issue_worklog)
30
JSON
transform JSON into type easier to use Transformation in package instead APEX testing possible by using sql Entities defined as column names documentation von
CollectionSpalte ndash JSON ndash Spaltenname im Type
using table function based on defined types
processing create or replace type t_jira_issue force as object(-- id 16276-- c001 id number -- Jira Issue ID
-- self httpsjiramt-agcomrestapi2issue16276-- c003 url_json varchar2(32767) -- c003 - JSON URL
-- key UITFPP-1057bdquo-- c001 key varchar2(32767) -- Issue Keyselect
from table(jira_rest_ws_pkgget_projects(pi_base_url =gt httpsjiraatlassiancom))
31
APEX
using APEX_COLLECTIONS not every search means new webservice call loading page doesnlsquot call a webservice APEX itself relies also on collections when working with Web Service References
problem authentication for webservice call every call needs a username amp password using Web Service Reference itlsquos inconvenient using Application Items instead
when logging into the apex application password is saved on server-side by application item attention the password value is visible in session state
32
APEXLivedemo
33
Conclusion
complexity is huge because of many different technical aspects
all important key facts are calculateable
transforming JSON in JavaScript or PLSQL is not easy in the beginning
first time parsing JSON even with APEX_JSON needs practiceremember in 12c you can directly parse JSON by SQL
Using APEX integrated bdquoWeb Service Referenceldquo only for simple examples
OliverLemm
httpoliverlemmblogspotde
httpdelinkedincominOliverLemm
httpswwwxingcomprofileOliver_Lemm
Thanks
- APEX connects Jira
- Facts amp Figures
- about me
- Slide 4
- Agenda
- Motivation
- Jira
- Slide 8
- Jira (2)
- Jira (3)
- Jira (4)
- Jira (5)
- Jira (6)
- Jira (7)
- Webservices
- Webservices (2)
- Webservices (3)
- Webservices (4)
- Webservices (5)
- Webservices (6)
- Webservice
- Webservices (8)
- Webservices (9)
- Webservice (2)
- JSON
- JSON
- JSON (2)
- JSON (3)
- JSON (4)
- APEX
- APEX (2)
- Conclusion
- Slide 34
-
30
JSON
transform JSON into type easier to use Transformation in package instead APEX testing possible by using sql Entities defined as column names documentation von
CollectionSpalte ndash JSON ndash Spaltenname im Type
using table function based on defined types
processing create or replace type t_jira_issue force as object(-- id 16276-- c001 id number -- Jira Issue ID
-- self httpsjiramt-agcomrestapi2issue16276-- c003 url_json varchar2(32767) -- c003 - JSON URL
-- key UITFPP-1057bdquo-- c001 key varchar2(32767) -- Issue Keyselect
from table(jira_rest_ws_pkgget_projects(pi_base_url =gt httpsjiraatlassiancom))
31
APEX
using APEX_COLLECTIONS not every search means new webservice call loading page doesnlsquot call a webservice APEX itself relies also on collections when working with Web Service References
problem authentication for webservice call every call needs a username amp password using Web Service Reference itlsquos inconvenient using Application Items instead
when logging into the apex application password is saved on server-side by application item attention the password value is visible in session state
32
APEXLivedemo
33
Conclusion
complexity is huge because of many different technical aspects
all important key facts are calculateable
transforming JSON in JavaScript or PLSQL is not easy in the beginning
first time parsing JSON even with APEX_JSON needs practiceremember in 12c you can directly parse JSON by SQL
Using APEX integrated bdquoWeb Service Referenceldquo only for simple examples
OliverLemm
httpoliverlemmblogspotde
httpdelinkedincominOliverLemm
httpswwwxingcomprofileOliver_Lemm
Thanks
- APEX connects Jira
- Facts amp Figures
- about me
- Slide 4
- Agenda
- Motivation
- Jira
- Slide 8
- Jira (2)
- Jira (3)
- Jira (4)
- Jira (5)
- Jira (6)
- Jira (7)
- Webservices
- Webservices (2)
- Webservices (3)
- Webservices (4)
- Webservices (5)
- Webservices (6)
- Webservice
- Webservices (8)
- Webservices (9)
- Webservice (2)
- JSON
- JSON
- JSON (2)
- JSON (3)
- JSON (4)
- APEX
- APEX (2)
- Conclusion
- Slide 34
-
31
APEX
using APEX_COLLECTIONS not every search means new webservice call loading page doesnlsquot call a webservice APEX itself relies also on collections when working with Web Service References
problem authentication for webservice call every call needs a username amp password using Web Service Reference itlsquos inconvenient using Application Items instead
when logging into the apex application password is saved on server-side by application item attention the password value is visible in session state
32
APEXLivedemo
33
Conclusion
complexity is huge because of many different technical aspects
all important key facts are calculateable
transforming JSON in JavaScript or PLSQL is not easy in the beginning
first time parsing JSON even with APEX_JSON needs practiceremember in 12c you can directly parse JSON by SQL
Using APEX integrated bdquoWeb Service Referenceldquo only for simple examples
OliverLemm
httpoliverlemmblogspotde
httpdelinkedincominOliverLemm
httpswwwxingcomprofileOliver_Lemm
Thanks
- APEX connects Jira
- Facts amp Figures
- about me
- Slide 4
- Agenda
- Motivation
- Jira
- Slide 8
- Jira (2)
- Jira (3)
- Jira (4)
- Jira (5)
- Jira (6)
- Jira (7)
- Webservices
- Webservices (2)
- Webservices (3)
- Webservices (4)
- Webservices (5)
- Webservices (6)
- Webservice
- Webservices (8)
- Webservices (9)
- Webservice (2)
- JSON
- JSON
- JSON (2)
- JSON (3)
- JSON (4)
- APEX
- APEX (2)
- Conclusion
- Slide 34
-
32
APEXLivedemo
33
Conclusion
complexity is huge because of many different technical aspects
all important key facts are calculateable
transforming JSON in JavaScript or PLSQL is not easy in the beginning
first time parsing JSON even with APEX_JSON needs practiceremember in 12c you can directly parse JSON by SQL
Using APEX integrated bdquoWeb Service Referenceldquo only for simple examples
OliverLemm
httpoliverlemmblogspotde
httpdelinkedincominOliverLemm
httpswwwxingcomprofileOliver_Lemm
Thanks
- APEX connects Jira
- Facts amp Figures
- about me
- Slide 4
- Agenda
- Motivation
- Jira
- Slide 8
- Jira (2)
- Jira (3)
- Jira (4)
- Jira (5)
- Jira (6)
- Jira (7)
- Webservices
- Webservices (2)
- Webservices (3)
- Webservices (4)
- Webservices (5)
- Webservices (6)
- Webservice
- Webservices (8)
- Webservices (9)
- Webservice (2)
- JSON
- JSON
- JSON (2)
- JSON (3)
- JSON (4)
- APEX
- APEX (2)
- Conclusion
- Slide 34
-
33
Conclusion
complexity is huge because of many different technical aspects
all important key facts are calculateable
transforming JSON in JavaScript or PLSQL is not easy in the beginning
first time parsing JSON even with APEX_JSON needs practiceremember in 12c you can directly parse JSON by SQL
Using APEX integrated bdquoWeb Service Referenceldquo only for simple examples
OliverLemm
httpoliverlemmblogspotde
httpdelinkedincominOliverLemm
httpswwwxingcomprofileOliver_Lemm
Thanks
- APEX connects Jira
- Facts amp Figures
- about me
- Slide 4
- Agenda
- Motivation
- Jira
- Slide 8
- Jira (2)
- Jira (3)
- Jira (4)
- Jira (5)
- Jira (6)
- Jira (7)
- Webservices
- Webservices (2)
- Webservices (3)
- Webservices (4)
- Webservices (5)
- Webservices (6)
- Webservice
- Webservices (8)
- Webservices (9)
- Webservice (2)
- JSON
- JSON
- JSON (2)
- JSON (3)
- JSON (4)
- APEX
- APEX (2)
- Conclusion
- Slide 34
-
OliverLemm
httpoliverlemmblogspotde
httpdelinkedincominOliverLemm
httpswwwxingcomprofileOliver_Lemm
Thanks
- APEX connects Jira
- Facts amp Figures
- about me
- Slide 4
- Agenda
- Motivation
- Jira
- Slide 8
- Jira (2)
- Jira (3)
- Jira (4)
- Jira (5)
- Jira (6)
- Jira (7)
- Webservices
- Webservices (2)
- Webservices (3)
- Webservices (4)
- Webservices (5)
- Webservices (6)
- Webservice
- Webservices (8)
- Webservices (9)
- Webservice (2)
- JSON
- JSON
- JSON (2)
- JSON (3)
- JSON (4)
- APEX
- APEX (2)
- Conclusion
- Slide 34
-