Alert.png The wiki is deprecated and due to be decommissioned by the end of September 2022.
The content is being migrated to other supports, new updates will be ignored and lost.
If needed you can get in touch with EGI SDIS team using operations @ egi.eu.

Difference between revisions of "Accounting Portal API"

From EGIWiki
Jump to navigation Jump to search
 
(40 intermediate revisions by the same user not shown)
Line 7: Line 7:
The Accounting Portal is an AJAX-based we application, but in contrast with many of them offers deep linking by changing the URL dynamically on user selection.  
The Accounting Portal is an AJAX-based we application, but in contrast with many of them offers deep linking by changing the URL dynamically on user selection.  


This functionality requires a reasonably recent browser, but since it already requires CORS for basic operation, this functionality is supported by all browsers with CORS already.  
This functionality requires a reasonably recent browser, but since it already requires CORS for basic operation, this functionality is supported by all browsers with CORS already. [http://caniuse.com/#search=CORS][http://caniuse.com/#search=history]


[http://caniuse.com/#search=CORS]
The non-conforming browsers only represent 5% of the current user base (mostly Opera Mini for mobile phones). Any relevant browser from the last 5 years supports these functionalities.
[http://caniuse.com/#search=history]
 
The non-conforming browsers only represent 5% of the current user base (mostly Opera Mini for mobile phones). Any relevant browser from the last 5 years supports these functionalities.  


= Basic format of the Accounting Portal URLs =
= Basic format of the Accounting Portal URLs =


So, for example, to see the Total number of jobs by Operations Centre and Month for EGI Official VOs, we would use a simple URL with the portal WWW domain, a path selector, which defines the desired views and a API-enabling data-selector that enables the API and selects  
So, for example, to see the Total number of jobs by Operations Centre and Month for EGI Official VOs, we would use a simple URL with the portal WWW domain, a function, and a API-enabling data-selector that enables the API and selects  


<pre>
https://accounting.egi.eu/egi/JSON/  
https://accounting.egi.eu/egi/JSON/  


''https://<---- Domain --->/<page>/<DS>/''
https://<-- Domain --->/<function>/<DS>/''


https://accounting.egi.eu/egi/CSV/  
https://accounting.egi.eu/egi/CSV/  
</pre>


Using a URL with only the path selector and data selector selects default values for each of the selectable parameters in the interface, clicking the “Update” button will update the URL with all selected parameters.
Using a URL with only the function and data selector selects default values for each of the selectable parameters in the interface, clicking the “Update” button will update the URL with all selected parameters.


The CPU Efficiency (%) by Resource Centre and Year for EGI Official VOs between June and July 2016 would be:
The CPU Efficiency (%) by Resource Centre and Year for EGI Official VOs between June and July 2016 would be:
<pre>
https://accounting.egi.eu/egi/cpueff/SITE/Year/2016/6/2016/7/egi/onlyinfrajobs/CSV/  
https://accounting.egi.eu/egi/cpueff/SITE/Year/2016/6/2016/7/egi/onlyinfrajobs/CSV/  


''https://<--- Domain --->/<page>/<query>/<RV>/<CV>/<Date>/<VO>/<Local>/<DS>/''
https://<--- Domain --->/<function>/<query>/<RV>/<CV>/<Date>/<VO>/<Local>/<DS>/


https://accounting.egi.eu/egi/cpueff/SITE/Year/2016/6/2016/7/egi/onlyinfrajobs/JSON/  
https://accounting.egi.eu/egi/cpueff/SITE/Year/2016/6/2016/7/egi/onlyinfrajobs/JSON/  
</pre>


These URLs were obtained after selecting the relevant options in the web site, and then appended with '/CSV/' or '/JSON/' as required.  
These URLs were obtained after selecting the relevant options in the web site, and then appended with '/CSV/' or '/JSON/' as required.  


Each of the URL segments encodes one aspect, each of which will be covered in a section.
Each of the URL segments encodes one aspect, each of which will be covered in a section.
'/egi/' --> this is the Path Selector, for some views it would consist on several segments, encondig for example a certain Resource Centre, Country or Discipline.
{|class="wikitable"
'/cpueff/' ---> would be the selected metric.
!URL fragment
'/SITE/' is the ROW variable, in this case resource centre.
!Function
'/Year/' is the COLUMN variable, in this case Year.
'/2016/6/' --> is the Year and Month of the start date.
'/2016/7/' --> Year and month of the ending date.
'/egi/' --> for official VOs.
'/onlyinfrajobs/' --> to filter out local jobs.
'/CSV/' or '/JSON/' to select the ouput format.
 
= Views =
These URL fragments define the selected view and with it the data shown. Most of the views work hierarchically, so from a view of the infrastructure we can navigate to a particular country and inside this a concrete site. The following table shows a list of valid path selectors:
 
{| class="wikitable"
!Path
!Extra Parameters
!Data shown
|-
|-
|[[Accounting_Portal_API/report/resource_centres/|/report/resource_centres/]]
|<code>/egi/</code>
|Infrastructure, type of report
|Function selector, for some functions it would consist on several segments, encodig for example a certain Resource Centre, Country or Discipline.
|Resource centre report
|-
|-
|report/disciplines/
|<code>/cpueff/</code>
|Infrastructure, discipline list
|would be the selected metric.
|Discipline report
|-
|-
|wlcg/report/tier2/
|<code>/SITE/</code>
|Day/hour
|ROW variable, in this case resource centre.
|WLCG Tier2 Report
|-
|-
|wlcg/report/countries/
|<code>/Year/</code>
|Day/hour
|COLUMN variable, in this case Year.
|WLCG Countries Report
|-
|-
|wlcg/report/tier1/
|<code>/2016/6/</code>
|N/A
|Year and Month of the start date.
|WLCG Tier1 Report
|-
|-
|report/interngi/
|<code>/2016/7/</code>
|No
|Year and month of the ending date.
|InterNGI Report
|-
|-
|report/vomet/
|<code>/egi/</code>
|No
|for official VOs.
|VO activity report
|-
|-
|disciplines/cloud/
|<code>/onlyinfrajobs/</code>
|No
|to filter out local jobs.
|Cloud disciplines overview
|-
|-
|disciplines/cloud/
|<code>/CSV/</code> or <code>/JSON/</code>
|Discipline
|to select the ouput format.
|Cloud Discipline detail
|}
 
= Functions =
These URL fragments define the selected function and with it the data shown. Most of the functions work hierarchically, so from a function of the infrastructure we can navigate to a particular country and inside this a concrete site. The following table shows a list of valid path selectors:
 
{| class="wikitable"
!Function
!Data shown
|-
|-
|disciplines/
|[[Accounting_Portal_API_Report_Resource_Centres|<code>/report/resource_centres/</code>]]
|No
|Resource Centre report
|HTC disciplines overview
|-Resource_Centres
|[[Accounting_Portal_API_Report_Disciplines|<code>/report/disciplines/</code>]]
|Discipline report
|-
|-
|disciplines/
|[[Accounting_Portal_API_Report_Tier2|<code>/wlcg/report/tier2/</code>]]
|Discipline
|WLCG Tier2 Report
|HTC Discipline detail
|-
|-
|/tier1/cloud/
|[[Accounting_Portal_API_Report_Countries|<code>/wlcg/report/countries/</code>]]
|No
|WLCG Countries Report
|WLCG Cloud Tier1 overview
|-
|-
|/tier1/cloud/node/
|[[Accounting_Portal_API_Function_Disciplines_HTC | <code>/disciplines/htc/</code>]]
|Node
|HTC disciplines overview
|WLCG Cloud Tier1 node detail
|-
|-
|/tier1/cloud/site/
|[[Accounting_Portal_API_Function_Disciplines_Cloud | <code>/disciplines/cloud/</code>]]
|Site
|Cloud disciplines overview
|WLCG Cloud Tier1 site detail
<!-- |-
|-
|[[Accounting_Portal_API_Function_Tier1_HTC | <code>/tier1/htc/</code>]]
|/tier1/
|No
|WLCG HTC Tier1 overview
|WLCG HTC Tier1 overview
|-
|-
|/tier1/node/
|[[Accounting_Portal_API_Function_Tier1_Cloud | <code>/tier1/cloud/</code>]]
|Node
|WLCG Cloud Tier1 overview
|WLCG HTC Tier1 node detail
|-
|-
|/tier1/site/
|[[Accounting_Portal_API_Function_Tier2_HTC | <code>/tier2/htc/</code>]]
|Site
|WLCG HTC Tier2 overview
|WLCG HTC Tier1 site detail
|-
|-
|/tier2/cloud/
|[[Accounting_Portal_API_Function_Tier2_Cloud | <code>/tier2/cloud/</code>]]
|No
|WLCG Cloud Tier2 overview
|WLCG Cloud Tier2 overview
-->
|-
|-
|/tier2/cloud/federation/
|[[Accounting_Portal_API_Function_EGI_HTC | <code>/egi/htc/</code>]]
|Federation
|EGI HTC
|WLCG Cloud Tier2 federation detail
|-
|-
|/tier2/cloud/country/
|[[Accounting_Portal_API_Function_EGI_Cloud | <code>/egi/cloud/</code>]]
|Country
|Cloud Operations Centres (NGIs) Overview
|WLCG Cloud Tier2 country detail
|-
|-
|/tier2/cloud/site/
<!--|[[Accounting_Portal_API_Function_OSG_HTC | <code>/osg/htc/</code>]]
|Site
|OSG HTC overview
|WLCG Cloud Tier2 site detail
|-
|/tier2/
|No
|WLCG HTC Tier2 overview
|-
|/tier2/federation/
|Federation
|WLCG HTC Tier2 federation detail
|-
|/tier2/country/
|Country
|WLCG HTC Tier2 country detail
|-
|/tier2/site/
|Site
|WLCG HTC Tier2 site detail
|-
|/egi/
|No
|EGI HTC NGI overview
|-
|/egi/ngi/
|NGI (Operations Centre)
|EGI HTC NGI detail
|-
|/egi/country/
|Country
|EGI HTC Country detail
|-
|/egi/countries/
|No
|EGI HTC Country overview
|-
|/egi/site/
|Site
|EGI HTC Site detail
|-
|wlcg/
|No
|WLCG HTC Overview
|-
|wlcg/country/
|Country
|WLCG HTC Country detail
|-
|wlcg/site/
|Site
|WLCG HTC Site detail
|-
|-
|osg/cloud/
|[[Accounting_Portal_API_Function_OSG_Cloud | <code>/osg/cloud/</code>]]
|No
|OSG Cloud overview
|OSG Cloud overview
|- -->
|[[Accounting_Portal_API_Function_Resource_Centre_Admin_HTC | <code>/resource_centre_admin/htc/</code>]]
|Resource Centre Admin HTC
|-
|-
|osg/cloud/site/
|[[Accounting_Portal_API_Function_Resource_Centre_Admin_Cloud | <code>/resource_centre_admin/cloud/</code>]]
|Site
|Resource Centre Admin Cloud
|OSG Site detail
|-
|-
|osg/
|[[Accounting_Portal_API_Function_VO_Admin_HTC | <code>/vo_admin/htc/</code>]]
|No
|VO Admin HTC
|OSG HTC overview
|-
|osg/site
|Site
|OSG Site detail
|-
|site_admin/
|Site
|Site Admin HTC
|-
|site_admin/cloud/
|Site
|Site Admin Cloud
|-
|-
|vo_admin/cloud/
|[[Accounting_Portal_API_Function_VO_Admin_Cloud | <code>/vo_admin/cloud/</code>]]
|VO
|VO Admin Cloud
|VO Admin Cloud
|-
|-
|vo_admin/cloud/site/
|[[Accounting_Portal_API_Function_User_HTC | <code>/user/htc/</code>]]
|VO, Site
|User Function HTC
|VO Admin Site detail
|-
|vo_admin/cloud/ngi/
|VO, NGI
|VO Admin NGI detail
|-
|vo_admin/cloud/country/
|VO, Country
|VO Admin Country detail
|-
|vo_admin/
|VO
|VO Admin HTC
|-
|vo_admin/site/
|VO, Site
|VO Admin HTC Site detail
|-
|vo_admin/ngi/
|VO, NGI
|VO Admin HTC NGI detail
|-
|vo_admin/country/
|VO, Country
|VO Admin HTC Country detail
|-
|user/cloud/
|No
|User View Cloud
|-
|user/cloud/site/
|Site
|User View Cloud Site
|-
|user/cloud/ngi/
|NGI
|User View Cloud NGI
|-
|user/cloud/country/
|Country
|User View Cloud Country
|-
|user/
|No
|User View HTC
|-
|user/site/
|Site
|User View HTC Site
|-
|user/ngi/
|NGI
|User View HTC NGI
|-
|user/country/
|Country
|User View HTC Country
|-
|cloud/
|No
|Cloud NGI Overview
|-
|cloud/countries/
|No
|Cloud Countries Overview
|-
|cloud/site/
|Site
|Cloud Site Detail
|-
|cloud/ngi/
|NGI
|Cloud NGI Detail
|-
|cloud/country/
|Country
|Cloud Country Detail
|-
|wlcg/countries/
|No
|WLCG Countries Overview
|-
|-
|wlcg/country
|[[Accounting_Portal_API_Function_User_Cloud | <code>/user/cloud/</code>]]
|Country
|User Function Cloud
|WLCG Country Detail
|}
|}

Latest revision as of 09:17, 1 August 2017

Introduction

The EGI Accounting Portal Data Retrieval API is a REST interface that relies on HTTP commands that share the same channel as the normal user interface. The output can be selectable from CSV (comma separated value) or JSON (JavaScript Object Notation). Both can be readily adapted to whatever internal notation the consumer uses and have support in any relevant language or execution environment.

The basic premise of the API is to append a /csv/ or /json/ to existing URLs from the portal, this makes easy to first manipulate the user interface to get the desired information and then use the URL to get a data endpoint for it. This page will also cover how to change each of the URL components programmatically to achieve the same effect.

The Accounting Portal - technological choices

The Accounting Portal is an AJAX-based we application, but in contrast with many of them offers deep linking by changing the URL dynamically on user selection.

This functionality requires a reasonably recent browser, but since it already requires CORS for basic operation, this functionality is supported by all browsers with CORS already. [1][2]

The non-conforming browsers only represent 5% of the current user base (mostly Opera Mini for mobile phones). Any relevant browser from the last 5 years supports these functionalities.

Basic format of the Accounting Portal URLs

So, for example, to see the Total number of jobs by Operations Centre and Month for EGI Official VOs, we would use a simple URL with the portal WWW domain, a function, and a API-enabling data-selector that enables the API and selects

https://accounting.egi.eu/egi/JSON/ 

https://<-- Domain --->/<function>/<DS>/''

https://accounting.egi.eu/egi/CSV/ 

Using a URL with only the function and data selector selects default values for each of the selectable parameters in the interface, clicking the “Update” button will update the URL with all selected parameters.

The CPU Efficiency (%) by Resource Centre and Year for EGI Official VOs between June and July 2016 would be:

https://accounting.egi.eu/egi/cpueff/SITE/Year/2016/6/2016/7/egi/onlyinfrajobs/CSV/ 

https://<--- Domain --->/<function>/<query>/<RV>/<CV>/<Date>/<VO>/<Local>/<DS>/

https://accounting.egi.eu/egi/cpueff/SITE/Year/2016/6/2016/7/egi/onlyinfrajobs/JSON/ 

These URLs were obtained after selecting the relevant options in the web site, and then appended with '/CSV/' or '/JSON/' as required.

Each of the URL segments encodes one aspect, each of which will be covered in a section.

URL fragment Function
/egi/ Function selector, for some functions it would consist on several segments, encodig for example a certain Resource Centre, Country or Discipline.
/cpueff/ would be the selected metric.
/SITE/ ROW variable, in this case resource centre.
/Year/ COLUMN variable, in this case Year.
/2016/6/ Year and Month of the start date.
/2016/7/ Year and month of the ending date.
/egi/ for official VOs.
/onlyinfrajobs/ to filter out local jobs.
/CSV/ or /JSON/ to select the ouput format.

Functions

These URL fragments define the selected function and with it the data shown. Most of the functions work hierarchically, so from a function of the infrastructure we can navigate to a particular country and inside this a concrete site. The following table shows a list of valid path selectors:

Function Data shown
/report/resource_centres/ Resource Centre report
/report/disciplines/ Discipline report
/wlcg/report/tier2/ WLCG Tier2 Report
/wlcg/report/countries/ WLCG Countries Report
/disciplines/htc/ HTC disciplines overview
/disciplines/cloud/ Cloud disciplines overview
/egi/htc/ EGI HTC
/egi/cloud/ Cloud Operations Centres (NGIs) Overview
/resource_centre_admin/htc/ Resource Centre Admin HTC
/resource_centre_admin/cloud/ Resource Centre Admin Cloud
/vo_admin/htc/ VO Admin HTC
/vo_admin/cloud/ VO Admin Cloud
/user/htc/ User Function HTC
/user/cloud/ User Function Cloud