Contents Web Service Connector Configuration Examples
Transcription
Contents Web Service Connector Configuration Examples
Contents Web Service Connector Configuration Examples ......................................................................................... 1 An Example to Get Stock Value Using Markit On Demand Web Services. ............................................... 2 To Configure the Web Service Request ................................................................................................ 2 To Configure the Response Processing for the Metrics ........................................................................ 4 To Select Metrics for Business Indicators ............................................................................................. 5 An Example to Get Sentiment Value Using General Sentiment Web Services ......................................... 6 To Configure the Web Service Request ................................................................................................ 7 To Configure the Response Processing for the Metrics ...................................................................... 10 To Select Metrics for Business Indicators ........................................................................................... 11 An Example to Get Currencies Exchange Rate Using Yahoo Web Services ............................................ 12 To Configure the Web Service Request .............................................................................................. 13 To Configure the Response Processing for the Metrics ...................................................................... 14 To Select Metrics for Business Indicators ........................................................................................... 17 An Example to Get Weather Information Using Yahoo Web Services ................................................... 18 To Configure the Web Service Request .............................................................................................. 19 To Configure the Response Processing for the Metrics ...................................................................... 21 To Select Metrics for Business Indicators ........................................................................................... 23 An Example to Get Brand Influence Score Using Klout Web Services .................................................... 23 To Configure the Web Service Request for a Variable........................................................................ 24 To Configure the Response Processing for a Variable ........................................................................ 26 To Configure the Web Service Request for the Metric ....................................................................... 27 To Configure the Response Processing for the Metrics ...................................................................... 29 To Select Metrics for Business Indicators ........................................................................................... 31 Web Service Connector Configuration Examples All examples listed in this document are running on http://caexecbeta.myaws.net. Note: Before using these examples read the ‘Using Web Service Connector’ section in the CA Executive Insight Configuration and Administration Guide. An Example to Get Stock Value Using Markit On Demand Web Services. This example illustrates a web connector with a simple request and response to obtain stock value. Only one metric will be obtained. The URL to the Web Services documentation: http://dev.markitondemand.com/#doc To create a Web Service connector that is using Markit on Demand web services please perform the following steps: 1. 2. 3. 4. Log in to the Admin UI. Click Metric Connectors under the Admin tab. The Metric Connector page opens. Click Add New, and select Web Connector from the drop-down list. The Web Connector page opens. In the Name field, enter Markit on Demand Connector To Configure the Web Service Request 5. On the Properties tab, enter the following: Leave Active Request field empty, as this will be filled in with the Request Name once saved and allows for multiple requests for the same connector using the New and Clone buttons. In the Request Name field, enter Stock Leave Method as GET In the URL field, enter http://dev.markitondemand.com/Api/v2/Quote Click Add new parameter link, enter the following: symbol CA Leave Authentication, Content, and Headers with the default field values. 6. Verify your screen looks like the image below: 7. Click Test 8. In the Response radio button group, select Status to verify that the Response status is OK. Status: Request Name: Stock Status Line: HTTP/1.1 200 OK Status Code: 200 9. In the Response radio button group, select Body to verify that XML data is displayed as the following: Body: Request Name: Stock Body: <StockQuote> <Status>SUCCESS</Status> <Name>CA Inc</Name> <Symbol>CA</Symbol> < XML element above that could be used as a metric name <LastPrice>31.98</LastPrice> < XML element above that could be used as a metric value <Change>-0.5</Change> <ChangePercent>-1.539408867</ChangePercent> <Timestamp>Wed Dec 18 12:47:46 UTC-05:00 2013</Timestamp> <MSDate>41626.5331712963</MSDate> <MarketCap>14431742520</MarketCap> <Volume>284794</Volume> <ChangeYTD>21.98</ChangeYTD> <ChangePercentYTD>45.4959053685</ChangePercentYTD> <High>32.5</High> <Low>31.935</Low> <Open>32.44</Open> </StockQuote> To Configure the Response Processing for the Metrics 10. On the Processing tab, enter the following: In the Type drop-down list, select Metric. Leave Parser with the default field value. In the Metric Name field, enter the XPath expression //Symbol to parse the metric name from the XML body. In the Metric Value field, enter the XPath expression //LastPrice to parse the metric value from the XML body. Leave Metric Timestamp field empty to use the poller provided timestamp. 11. Click Test 12. In the Response radio button group, select Result to verify the processing results. Results: Request Name: Stock Expression: //Symbol [CA] Expression: //LastPrice [31.98] 13. Set Polling interval field to desired value, for example 15 minutes. 14. Verify your screen looks like the image below: 15. Click Save To Select Metrics for Business Indicators 16. On Metrics tab, expand Stock and select metric CA to make it an business indicator 17. Verify your screen looks like the image below: 18. Click Save An Example to Get Sentiment Value Using General Sentiment Web Services This example illustrates a web connector that requires OAuth 1.0 authentication. For the response processing it will obtain the timestamp from the response and use the JSON parser. The URL to the Web Services documentation: http://api.generalsentiment.com/doc/. To get OAuth 1.0 credentials (consumer key and consumer secret); you will need an account with http://www.generalsentiment.com. To create a WS connector that is using General Sentiment web services, please perform the following steps: 1. 2. 3. 4. Log in to the Admin UI. Click Metric Connectors under the Admin tab. The Metric Connector page opens. Click Add New, and select Web Connector from the drop-down list. The Web Connector page opens. In the Name field, enter Google Sentiment Connector. To Configure the Web Service Request 5. On the Properties tab, enter the following: Leave the Active Request field empty, as this will be filled in with the Request Name once saved and allows for multiple requests for the same connector using the New and Clone buttons. In the Request Name field, enter Google Sentiment. Select POST in the Method. In the URL field, enter http://api.generalsentiment.com/api/getSentiment. Leave Parameters and Raw Body with the default field values. Click Add new body parameter link, enter the following: synset Google\tGOOG start_date $startTime{yyyyMMdd} end_date $endTime{yyyyMMdd} time_unit day depository twitter aggregate_sources true Select OAuth in Authentication drop-down. Select Default in the OAuth Provider drop-down. Select application/x-www-form-urlencoded in the Content drop-down. 6. Verify your screen looks like the image below: 7. Click Setup OAuthand perform the following: Leave Version and Token Verb with the default field values. In the Consumer Key field, enter a Consumer Key obtained from General Sentiment. In the Consumer Secret field, enter a Consumer Secret obtained from General Sentiment. Leave Token Key, Token Secret and OAuth Verifier empty. Check the Auto Authorize check box. In the Request Token URL field, enter http://api.generalsentiment.com/oauth/request_token. In the Access Token URL field, enter http://api.generalsentiment.com/oauth/access_token. In the Authorization URL field, enter http://api.generalsentiment.com/oauth/authorize. Leave Callback URL with the default field value. 8. Verify your screen looks like the image below: 9. Click OK to save and close the OAuth Authentication dialog. 10. Click Test 11. In the Response radio button group, select Status to verify that the Response status is OK. Status: Request Name: Google Sentiment Status Line: OK Status Code: 200 12. In the Response radio button group, select Body to verify that JSON data is displayed as the following: Body: Request Name: Google Sentiment Body: [ { "sentiment" : 0.36857569574356347, < JSON element value above that could be used as a metric value "date" : 20131218 < JSSON element value above that could be used as a metric timestamp }, { "sentiment" : 0.47353098525409215, "date" : 20131219 }] To Configure the Response Processing for the Metrics 13. On the Processing tab, enter the following: In the Type drop-down list, select Metric. In the Parser drop-down list, select JSON o Consult with http://goessner.net/articles/JsonPath/ to find more info about JsonPath. In the Metric Name field, enter {Sentiment} to create the metric name. In the Metric Value field, enter the JsonPath expression $..sentiment to parse the metric value from the JSON body. In the Metric Timestamp field, enter the JsonPath expression $..date to parse the metric timestamp from the JSON body. In the Date/Time Format field, enter yyyyMMdd to indicate that timestamp is coming in this format. 14. Click Test. 15. In the Response radio button group, select Result to verify the processing results. Results: Request Name: Google Sentiment Expression: {Sentiment} [Sentiment] Expression: $..sentiment [0.36857569574356347, 0.47353098525409215] Expression: $..date [20131218, 20131219] 16. Set Polling interval field to 1440 minutes (1 day). 17. Verify your screen looks like the image below: 18. Click Save. To Select Metrics for Business Indicators 19. On Metrics tab, expand Google Sentiment and select metric Sentiment to create a business indicator. 20. Verify your screen looks like the image below: 21. Click Save. An Example to Get Currencies Exchange Rate Using Yahoo Web Services This example illustrates a web connector that obtains multiple metrics from multiple XML elements in the response. To create a Web Service connector that is using Yahoo financial web services please perform the following steps: 1. 2. 3. 4. Log in to the Admin UI. Click Metric Connectors under the Admin tab. The Metric Connector page opens. Click Add New, and select Web Connector from the drop-down list. The Web Connector page opens. In the Name field, enter Yahoo Finance Connector To Configure the Web Service Request 5. On the Properties tab, enter the following: Leave the Active Request field empty, as this will be filled in with the Request Name once saved and allows for multiple requests for the same connector using the New and Clone buttons. In the Request Name field, enter Currencies. Leave Method as GET In the URL field, enter http://finance.yahoo.com/webservice/v1/symbols/allcurrencies/quote No Parameters are required for this request. Leave Authentication, Content, and Headers with the default field values. 6. Verify your screen looks like the image below: 7. Click Test . 8. In the Response radio button group, select Status to verify that the Response status is OK. Status: Request Name: Currencies Status Line: HTTP/1.1 200 OK Status Code: 200 9. In the Response radio button group, select Body to verify that XML data is displayed as the following: Body: Request Name: Currencies Body: <list version="1.0"> <meta> <type>resource-list</type> </meta> <resources count="168" start="0"> <resource classname="Quote"> <field name="name">USD/KRW</field> < XML attribute above that could be used as metric names <field name="price">1052.199951</field> < XML attribute above that could be used as metric values <field name="symbol">KRW=X</field> <field name="ts">1387395810</field> < XML attribute above that could be used as metric timestamps <field name="type">currency</field> <field name="utctime">2013-12-18T19:43:30+0000</field> <field name="volume">0</field> </resource> …………………………………………………… <resource classname="Quote"> <field name="name">USD/ARS</field> <field name="price">6.375500</field> <field name="symbol">ARS=X</field> <field name="ts">1387395903</field> <field name="type">currency</field> <field name="utctime">2013-12-18T19:45:03+0000</field> <field name="volume">0</field> </resource> </resources> </list> To Configure the Response Processing for the Metrics 10. On the Processing tab, enter the following: In the Type drop-down list, select Metric. Leave Parser with the default field value. In the Metric Name field, enter the XPath expression //field[@name='name'] to parse the metric name from the XML body. In the Metric Value field, enter the XPath expression //field[@name='price'] to parse the metric value from the XML body. In the Metric Timestamp field, enter the XPath expression //field[@name='ts'] to parse the metric timestamp from the XML body. In the Date/Time Format field, enter Seconds to indicate that timestamp is coming in this format. 11. Click Test. 12. In the Response radio button group, select Result to verify the processing results. Results: Request Name: Currencies Expression: //field[@name='name'] [USD/KRW, SILVER 1 OZ 999 NY, USD/VND, USD/BOB, USD/MOP, USD/BDT, USD/MDL, USD/VEF, USD/GEL, USD/ISK, USD/BYR, USD/THB, USD/MXV , USD/TND, USD/JMD, USD/DKK, USD/SRD, USD/BWP, USD/NOK, USD/MUR, USD/ZMK, USD/AZN, USD/INR, USD/MGA, USD/CAD, USD/XAF, USD/LBP, USD/XDR, USD/IDR, USD/IEP, USD/AUD, USD/MMK, USD/LYD, USD/ZAR, USD/IQD, USD/XPF, USD/TJS, USD/CUP, USD/UGX, USD/NGN, USD/PGK, USD/TOP, USD/TMT, USD/KES, USD/CRC, USD/MZN, USD/SYP, USD/ANG, USD/ZMW, USD/BRL, USD/BSD, USD/NIO, USD/GNF, USD/BMD, USD/SLL, USD/MKD, USD/BIF, USD/LAK, USD/BHD, USD/SHP, USD/BGN, USD/SGD, USD/CNY, USD/EUR, USD/TTD, USD/SCR, USD/BBD, USD/SBD, USD/MAD, USD/GTQ, USD/MWK, USD/PKR, USD/PEN, USD/AED, USD/LVL, PALLADIUM 1 UZ, USD/UAH, USD/LRD, USD/LSL, USD/SEK, USD/RON, USD/XOF, USD/COP, USD/CDF, USD/USD, USD/TZS, USD/GHS, USD/NPR, USD/ZWL, USD/SOS, USD/DZD, USD/FKP, USD/LKR, USD/JPY, USD/CHF, USD/KYD, USD/CLP, USD/IRR, USD/AFN, USD/DJF, USD/SVC, USD/PLN, USD/PYG, USD/ERN, USD/ETB, USD/ILS, USD/TWD, USD/KPW, USD/GIP, USD/BND, USD/HNL, USD/CZK, USD/HUF, USD/BZD, USD/JOD, USD/RWF, USD/LTL, USD/RUB, USD/RSD, USD/WST, PLATIN 1 UZ 999, USD/PAB, USD/NAD, USD/DOP, USD/ALL, USD/HTG, USD/AMD, USD/KMF, USD/MRO, USD/HRK, USD/KHR, USD/PHP, USD/KWD, USD/XCD, COPPER HIGHGRADE, USD/CNH, USD/SDG, USD/CLF, USD/KZT, USD/TRY, USD/FJD, USD/NZD, USD/BAM, USD/BTN, USD/STD, USD/VUV, USD/MVR, USD/AOA, USD/EGP, USD/QAR, USD/OMR, USD/CVE, USD/KGS, USD/MXN, USD/MYR, USD/GYD, USD/SZL, USD/YER, USD/SAR, USD/UYU, USD/GBP, USD/UZS, USD/GMD, USD/AWG, USD/MNT, GOLD 1 UZ, USD/HKD, USD/ARS] Expression: //field[@name='price'] [1049.640015, 0.049965, 21090.000000, 6.910000, 7.985250, 77.660004, 12.570000, 6.287700, 1.708900, 116.500000, 9470.000000, 32.200001, 2.546564, 1.650150, 106.050003, 5.420600, 3.275000, 8.688100, 6.103500, 30.450001, 0.000000, 0.784400, 61.619999, 2255.000000, 1.065505, 478.015747, 1505.500000, 0.649650, 12155.000000, 0.573921, 1.123356, 984.000000, 1.238000, 10.252300, 1163.050049, 86.620003, 4.773100, 1.000000, 2495.000000, 160.050003, 2.533400, 1.858897, 2.850300, 86.161499, 496.100006, 29.900000, 140.800003, 1.774700, 5.400000, 2.328300, 1.000000, 25.155001, 6828.000000, 1.000000, 4335.000000, 44.830002, 1535.000000, 8005.500000, 0.377100, 0.611450, 1.428800, 1.257310, 6.071800, 0.726040, 6.430000, 12.061450, 2.000000, 7.192645, 8.154150, 7.878000, 426.649994, 106.400002, 2.789000, 3.673100, 0.510250, 0.001432, 8.285000, 81.449997, 10.330000, 6.527900, 3.248600, 477.250000, 1944.000000, 911.500000, 1.000000, 1603.500000, 2.302500, 99.919998, 322.355011, 1172.000000, 78.334999, 0.611400, 130.800003, 103.425003, 0.887760, 0.820000, 526.794983, 24794.000000, 54.020000, 180.750000, 8.747500, 3.026850, 4518.845215, 14.880000, 19.115999, 3.505850, 29.730000, 900.000000, 0.611450, 1.260000, 20.405001, 20.037500, 216.294998, 1.990000, 0.707800, 670.000000, 2.502100, 32.762501, 83.335503, 2.320498, 0.000745, 1.000000, 10.352000, 42.500000, 102.099998, 43.240002, 404.950012, 357.725006, 290.500000, 5.546800, 3995.000000, 44.270000, 0.283000, 2.700000, 0.297000, 6.073750, 5.692500, 0.022740, 154.125000, 2.039300, 1.882500, 1.211460, 1.422450, 62.005001, 17835.000000, 96.330002, 15.410000, 97.730003, 6.895850, 3.641450, 0.384950, 79.080002, 49.053501, 12.846800, 3.256000, 207.949997, 10.319000, 214.755005, 3.750700, 21.170000, 0.608180, 2199.929932, 37.599998, 1.789800, 1637.500000, 0.000809, 7.752565, 6.377100] Expression: //field[@name='ts'] [1387396070, 1387391984, 1387395910, 1387395790, 1387395790, 1387395910, 1387395803, 1387395910, 1387395790, 1387395790, 1387395790, 1387396030, 1387395930, 1387396058, 1387395910, 1387396080, 1387395910, 1387395790, 1387396081, 1387395910, 0, 1387395790, 1387396025, 1387395910, 1387396081, 1387395790, 1387395804, 1387395790, 1387395790, 1387395790, 1387396050, 1387395910, 1387395910, 1387396080, 1387395910, 1387395803, 1387395790, 1387395790, 1387395803, 1387395803, 1387395790, 1387395920, 1387395790, 1387396073, 1387395910, 1387395910, 1387395910, 1387395803, 1387395910, 1387396016, 1387395790, 1387395910, 1387395901, 1387395790, 1387395910, 1387395802, 1387395910, 1387395910, 1387395910, 1387395790, 1387395790, 1387396081, 1387395910, 1387396060, 1387395802, 1387395846, 1387395790, 1387395790, 1387396073, 1387395802, 1387395803, 1387395910, 1387395910, 1387395910, 1387396070, 1387390587, 1387395803, 1387395910, 1387395790, 1387396081, 1387396076, 1387395910, 1387395910, 1387395802, 1387395790, 1387395910, 1387395910, 1387395790, 1387395790, 1387395910, 1387396073, 1387395790, 1387395790, 1387396081, 1387396081, 1387395790, 1387395896, 1387395910, 1387395910, 1387395910, 1387395803, 1387396081, 1387395790, 1387395920, 1387395790, 1387396050, 1387395910, 1387395790, 1387395790, 1387395802, 1387395802, 1387396081, 1387396080, 1387395790, 1387395910, 1387395802, 1387396046, 1387396081, 1387395910, 1387395790, 1387390616, 1387395790, 1387395910, 1387395803, 1387395790, 1387395803, 1387395790, 1387395803, 1387395910, 1387396076, 1387395790, 1387395910, 1387395910, 1387395790, 1387392164, 1387395790, 1387395910, 1387395790, 1387395790, 1387396081, 1387374301, 1387396050, 1387395910, 1387395790, 1387395910, 1387395910, 1387395790, 1387395790, 1387395996, 1387396041, 1387395910, 1387395910, 1387395790, 1387396081, 1387395790, 1387395910, 1387395910, 1387395910, 1387396075, 1387395802, 1387396030, 1387395790, 1387395790, 1387395910, 1387395910, 1387396056, 1387396049, 1387396073] 13. Set Polling interval field to desired value, for example 1 minute. 14. Verify your screen looks like the image below: 15. Click Save. To Select Metrics for Business Indicators 16. On the Metrics tab, expand Currencies and select desired metrics to create business indicators. 17. Verify your screen looks like the image below: 18. Click Save An Example to Get Weather Information Using Yahoo Web Services This example illustrates a web connector that obtains multiple metrics from a single XML element. The URL to the Web Services documentation: http://developer.yahoo.com/weather/ To create a WS connector that is using Yahoo weather web services please perform the following steps: 1. 2. 3. 4. Log in to the Admin UI. Click Metric Connectors under the Admin tab. The Metric Connector page opens. Click Add New, and select Web Connector from the drop-down list. The Web Connector page opens. In the Name field, enter Yahoo Weather Connector. To Configure the Web Service Request 5. On the Properties tab, enter the following: Leave Active Request field empty, as this will be filled in with the Request Name once saved and allows for multiple requests for the same connector using the New and Clone buttons. In the Request Name field, enter Boston Weather. Leave Method as GET In the URL field, enter http://weather.yahooapis.com/forecastrss?w=2367105 No Parameters are required for this request. Leave Authentication, Content, and Headers with the default field values. 6. Verify your screen looks like the image below: 7. Click Test . 8. In the Response radio button group, select Status to verify that the Response status is OK. Status: Request Name: Boston Weather Status Line: HTTP/1.1 200 OK Status Code: 200 9. In the Response radio button group, select Body to verify that XML data is displayed as the following: Body: Request Name: Boston Weather Body: <rss version="2.0" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:yweather="http://xml.weather.yahoo.com/ns/rss/1.0"> <channel> <title>Yahoo! Weather - Boston, MA</title> <link>http://us.rd.yahoo.com/dailynews/rss/weather/Boston__MA/*http://weather.yahoo. com/forecast/USMA0046_f.html</link> <description>Yahoo! Weather for Boston, MA</description> <language>en-us</language> <lastBuildDate>Wed, 18 Dec 2013 1:52 pm EST</lastBuildDate> <ttl>60</ttl> <yweather:location city="Boston" country="United States" region="MA"/> <yweather:units distance="mi" pressure="in" speed="mph" temperature="F"/> <yweather:wind chill="26" direction="300" speed="15"/> < XML attribute above that could be used as a metric value <yweather:atmosphere humidity="46" pressure="29.91" rising="1" visibility="10"/> < XML attribute above that could be used as a metric value <yweather:astronomy sunrise="7:07 am" sunset="4:11 pm"/> <image> <title>Yahoo! Weather</title> <width>142</width> <height>18</height> <link>http://weather.yahoo.com</link> <url>http://l.yimg.com/a/i/brand/purplelogo//uh/us/news-wea.gif</url> </image> <item> <title>Conditions for Boston, MA at 1:52 pm EST</title> <geo:lat>42.36</geo:lat> <geo:long>-71.06</geo:long> <link>http://us.rd.yahoo.com/dailynews/rss/weather/Boston__MA/*http://weather.yahoo. com/forecast/USMA0046_f.html</link> <pubDate>Wed, 18 Dec 2013 1:52 pm EST</pubDate> <yweather:condition code="30" date="Wed, 18 Dec 2013 1:52 pm EST" temp="35" text="Partly Cloudy"/> <description><![CDATA[ <img src="http://l.yimg.com/a/i/us/we/52/30.gif"/><br /> <b>Current Conditions:</b><br /> Partly Cloudy, 35 F<BR /> <BR /><b>Forecast:</b><BR /> Wed - Sunny. High: 33 Low: 23<br /> Thu - Partly Cloudy. High: 40 Low: 32<br /> Fri - Few Showers. High: 46 Low: 36<br /> Sat - Cloudy. High: 46 Low: 38<br /> Sun - Showers/Wind. High: 58 Low: 49<br /> <br /> <a href="http://us.rd.yahoo.com/dailynews/rss/weather/Boston__MA/*http://weather.yahoo. com/forecast/USMA0046_f.html">Full Forecast at Yahoo! Weather</a><BR/><BR/> (provided by <a href="http://www.weather.com" >The Weather Channel</a>)<br/> ]]></description> <yweather:forecast code="32" date="18 Dec 2013" day="Wed" high="33" low="23" text="Sunny"/> <yweather:forecast code="30" date="19 Dec 2013" day="Thu" high="40" low="32" text="Partly Cloudy"/> <yweather:forecast code="11" date="20 Dec 2013" day="Fri" high="46" low="36" text="Few Showers"/> <yweather:forecast code="26" date="21 Dec 2013" day="Sat" high="46" low="38" text="Cloudy"/> <yweather:forecast code="11" date="22 Dec 2013" day="Sun" high="58" low="49" text="Showers/Wind"/> <guid isPermaLink="false">USMA0046_2013_12_22_7_00_EST</guid> </item> </channel> </rss> To Configure the Response Processing for the Metrics 10. On the Processing tab, enter the following: In the Type drop-down list, select Metric. Leave Parser with the default field value. In the Metric Name field, enter {Temperature};{Humidity} to create 2 metric names. In the Metric Value field, enter the XPath expression //yweather:wind[@chill];//yweather:atmosphere[@humidity] to parse the two metric values from the XML body. Leave Metric Timestamp field empty to use the poller provided timestamp. 11. Click Test 12. In the Response radio button group, select Result to verify the processing results. Results: Request Name: Boston Weather Expression: {Temperature} [Temperature] Expression: //yweather:wind[@chill] [26] Expression: {Humidity} [Humidity] Expression: //yweather:atmosphere[@humidity] [46] 13. Set Polling interval field to desired value, for example 60 minutes. 14. Verify your screen looks like the image below: 15. Click Save To Select Metrics for Business Indicators 16. On Metrics tab, expand Boston Weather and select Temperature and Humidity metrics to create business indicators. 17. Verify your screen looks like the image below: 18. Click Save. An Example to Get Brand Influence Score Using Klout Web Services This example illustrates a web connector with a request that depends on another web service request to obtain a session id that will then be used for the web service to collect the metric. The URLs to the Web Services documentation: http://bradsknutson.com/blog/display-klout-score-withklout-api/ http://klout.com/s/developers/v2 To create a WS connector that is using Klout web services please perform the following steps: 1. 2. 3. 4. 5. Log in to the Admin UI. Click Metric Connectors under the Admin tab. The Metric Connector page opens. Click Add New, and select Web Connector from the drop-down list. The Web Connector page opens. In the Name field, enter CA Klout Score. In the Description field, enter Brand Influence To Configure the Web Service Request for a Variable 6. On the Properties tab, enter the following: Leave Active Request field empty, as this will be filled in with the Request Name once saved and allows for multiple requests for the same connector using the New and Clone buttons. In the Request Name field, enter Get Id. Leave Method as GET In the URL field, enter http://api.klout.com/v2/identity.json/twitter Click Add new parameter link, enter the following: screenName CA key xxxxxxxxxxxxxxxxxxx - your API key can be obtained using http://developer.klout.com/member/register Leave Authentication, Content, and Headers with the default field values. 7. Verify your screen looks like the image below: 8. Click Test 9. In the Response radio button group, select Status to verify that the Response status is OK. Status: Request Name: Get Id Status Line: HTTP/1.1 200 OK Status Code: 200 10. In the Response radio button group, select Body to verify that XML data is displayed as the following: Body: Request Name: Get Id Body: { "id" : "31525202156550768", < JSON element value above that could be used as variable "network" : "ks" } To Configure the Response Processing for a Variable 11. On the Processing tab, enter the following: In the Type drop-down list, select Metadata. In the Parser drop-down list, select JSON Click Add new variable link, enter the following: id $..id 12. Click Test 13. In the Response radio button group, select Result to verify the processing results. Results: Request Name: Get Id Expression: $..id [31525202156550768] 14. Verify your screen looks like the image below: To Configure the Web Service Request for the Metric 15. Go to the Properties tab and click the New button to create a new request. 16. Click Yes Add on the Confirm dialog 17. Enter the following: In the Request Name field, enter CA Score Leave Method as GET In the URL field, enter http://api.klout.com/v2/user.json/${id}/score Click Add new parameter link, enter the following: key xxxxxxxxxxxxxxxxxxx - your API key Leave Authentication, Content, and Headers with the default field values. 18. Click Test 19. In the Response radio button group, select Status to verify that the Response status is OK. Status: Request Name: CA Score Status Line: HTTP/1.1 200 OK Status Code: 200 20. In the Response radio button group, select Body to verify that XML data is displayed as the following: Body: Request Name: CA Score Body: { "score" : 71.17870234963782, "scoreDelta" : { "dayChange" : 0.027960410165690064, "weekChange" : 0.13356043811968732, "monthChange" : 3.8499299656164254 }, < JSON element values above could be used as metric values "bucket" : "70-79" } 21. Verify your screen looks like the image below: To Configure the Response Processing for the Metrics 22. On the Processing tab, enter the following: In the Type drop-down list, select Metric. Leave Parser with the default field value. In the Metric Name field, enter {Score};{Daily Change};{Weekly Change};{Monthly Change} to create 4 metric names. In the Metric Value field, enter the JsonPath expression $..score;$..dayChange;$..weekChange;$..monthChange to parse the 4 metric values from the JSON body. Leave the Metric Timestamp field empty to use the poller provided timestamp. 23. Click Test 24. In the Response radio button group, select Result to verify the processing results. Results: Request Name: CA Score Expression: {Score} [Score] Expression: $..score [71.17870234963782] Expression: {Daily Change} [Daily Change] Expression: $..dayChange [0.027960410165690064] Expression: {Weekly Change} [Weekly Change] Expression: $..weekChange [0.13356043811968732] Expression: {Monthly Change} [Monthly Change] Expression: $..monthChange [3.8499299656164254] 25. Set Polling interval field to 1440 minutes (1 day). 26. Verify your screen looks like the image below: 27. Click Save To Select Metrics for Business Indicators 28. On the Metrics tab, expand CA Score and select Score and Weekly Change metrics to create business indicators. 29. Verify your screen looks like the image below: 30. Click Save