scores API
scores API
If you are looking for a java tool and example, go here.
scores provides an URL based access to its reports. This allows to query reports using standard HTTP-methods. The output of the reports is provided in XML format.
General Information
Generally two steps are necessary to access the API:
- Log in to scores using your username and password
- access one or multiple of the reports by specifying the required arguments
Parameters
In the url-access to scores currently the following parameters are accepted:
parameter | description |
---|---|
format | the report format (defaults to api=simple xml) |
tz | the users time zone (time zone depending on which time zone: winter time “UTC+1”, summer time “UTC+2”) |
session | the authenticated session = sessionID (the session, which will be created after the successful login) |
group | the report group = report suite in scores |
report | the report name = single report |
filters | the filters are enumerated by 0..n, then the dimension marker |
query | attributes defined with q_ and followed by the id of the attribute |
group, report and filters
) from the table above and the contained dimensions are specific to a given report and are described in /wiki/spaces/KASRLCS/pages/159726841
perl lwp Example
Login to scores and fetch a session id.
SCORES_USER="testuser" SCORES_PASS="PASSWORD" SCORES_URL="https://scores.spring.de/scores-test" echo -n "user=$SCORES_USER&pass=$SCORES_PASS" | POST $SCORES_URL/export > .scores_session
fetch reports via
SCORES_URL="https://scores.spring.de/scores-test" SCORES_GROUP="visitors" SCORES_REPORT="overview" SCORES_STARTTIME=1259712000000 SCORES_ENDTIME=1259762400000 SCORES_RESOLUTION=3600000 SCORES_SITE="test" SCORES_PAGE="" GET "$SCORES_URL/export?session=`cat .scores_session`&group=$SCORES_GROUP&report=$SCORES_REPORT&format=api&tz=UTC\&0d_timerange=$SCORES_STARTTIME%20$SCORES_ENDTIME%20$SCORES_RESOLUTION&0d_site=$SCORES_SITE\&0d_cp=$SCORES_PAGE&"
wget Example
login via:
SCORES_USER="testuser" SCORES_PASS="PASSWORD" SCORES_URL="https://scores.spring.de/scores-test" wget -d -O .scores_session --post-data="user=$SCORES_USER&pass=$SCORES_PASS" $SCORES_URL/export
the session-id is stored in the file .scores_session
fetch reports via
SCORES_URL="https://scores.spring.de/scores-test" SCORES_GROUP="visitors" SCORES_REPORT="overview" SCORES_STARTTIME=1259712000000 SCORES_ENDTIME=1259762400000 SCORES_RESOLUTION=3600000 SCORES_SITE="test" SCORES_PAGE="" wget -O - "$SCORES_URL/export?session=`cat .scores_session`&group=$SCORES_GROUPreport=$SCORES_REPORT &format=api&tz=UTC\&0d_timerange=$SCORES_STARTTIME%20$SCORES_ENDTIME%20$SCORES_RESOLUTION\ &0d_site=$SCORES_SITE&0d_cp=$SCORES_PAGE&"
Example output can be
<?xml version="1.0" encoding="UTF-8"?> <scores> <report> <properties> <property name="resolution_raw"><value><![CDATA[3600000]]></value></property <property name="username"><value><![CDATA[Spring Development]]></value></property <property name="created"><value><![CDATA[21.01.2010 09:36:08 GMT]]></value></property <property name="report_name"><value><![CDATA[Übersicht]]></value></property <property name="runtime"><value><![CDATA[1440ms]]></value></property <property name="timerange"><value><![CDATA[02.12.2009 00:00:00 GMT - 02.12.2009 14:00:00 GMT]]></value></property <property name="report_group"><value><![CDATA[Besucher]]></value></property <property name="resolution"><value><![CDATA[Darstellung pro Stunde]]></value></property <property name="user"><value><![CDATA[devel]]></value></property <property name="filter"><value><![CDATA[]]></value></property <property name="filter_site"><value><![CDATA[test]]></value></property </properties> <data> <vector> <dimension name="timerange"><value><![CDATA[interval 2009-12-02 00:00:00.000 Mi GMT - 2009-12-02 01:00:00.000 Mi GMT 3600000]]></value></dimension> <dimension name="users"><value><![CDATA[0.0]]></value></dimension> <dimension name="clients"><value><![CDATA[7156.000000000001]]></value></dimension> <dimension name="sessions"><value><![CDATA[7189.0]]></value></dimension> <dimension name="pis"><value><![CDATA[36010.0]]></value></dimension> <dimension name="hits"><value><![CDATA[0.0]]></value></dimension> <dimension name="fis"><value><![CDATA[5266.0]]></value></dimension> <dimension name="lis"><value><![CDATA[7189.0]]></value></dimension> <dimension name="vtime"><value><![CDATA[7.29596E8]]></value></dimension> <dimension name="vcnt"><value><![CDATA[20912.0]]></value></dimension> <dimension name="clicks"><value><![CDATA[0.0]]></value></dimension> <dimension name="cent"><value><![CDATA[0.0]]></value></dimension> <dimension name="viewtime"><value><![CDATA[34.88886763580719]]></value></dimension> <dimension name="viewspersession"><value><![CDATA[5.009041591320073]]></value></dimension> <dimension name="sessionduration"><value><![CDATA[174.759789061819]]></value></dimension> </vector> </data> </report> </scores>