rivet Posted January 28, 2014 Posted January 28, 2014 I am trying to get some XML data (currency exchange ) inserted into a field, but not luck. URL http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.xchange%20where%20pair%20in%20(%22USDCAD%22)&diagnostics=true&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys
comment Posted January 28, 2014 Posted January 28, 2014 Please elaborate on the process (you posted this in Calculations!) and on "no luck". Also, why don't you import the response, instead of sticking it into a field?
rivet Posted January 29, 2014 Author Posted January 29, 2014 attached is my test file. Test on left, desired on right. I figured I could push the URL in to a field to be parse by the custom function. Import sounds like a good idea, but to be honest I have never tackled xsl. insertXMLurl.fmp12.zip
comment Posted January 29, 2014 Posted January 29, 2014 I'm afraid I am stuck with version 11 ATM, so can't look at your file. Import sounds like a good idea, but to be honest I have never tackled xsl. If you can post a link to the API specs, I'll help you with the XSLT.
rivet Posted January 29, 2014 Author Posted January 29, 2014 correction http://developer.yahoo.com/yql/console/?q=show%20tables&env=store://datatables.org/alltableswithkeys#h=select+*+from+yahoo.finance.xchange+where+pair+in+(%22CADUSD%22)
comment Posted January 29, 2014 Posted January 29, 2014 Try the attached: Compressed file.zip Note: The date needs more work. Their date is m/d/y and in my file it is routed to a Text field.
rivet Posted January 29, 2014 Author Posted January 29, 2014 Hey Comment, this is great, I appreciate the help. Thank you. Q: What details did the API url give you to help with this?
comment Posted January 29, 2014 Posted January 29, 2014 (edited) Q: What details did the API url give you to help with this? None, really. I was trying to understand if there was a way to get some control over the response through the URL. It seems that this is an undocumented service; I am not sure how you stumbled upon it. Update: The description can be found here: http://developer.yahoo.com/yql/console/?q=show%20tables&env=store://datatables.org/alltableswithkeys#h=desc+yahoo.finance.xchange But alas there is no more info there to be found. Edited January 29, 2014 by comment
rivet Posted January 29, 2014 Author Posted January 29, 2014 FYI: when converted to fmp12, the import mapping dialogue will show the left side but zero records to import. UPDATE Client12 - works Client13 - does not work
rivet Posted January 29, 2014 Author Posted January 29, 2014 I took the xml results and built a static source file which worked. I am now looking to see if there are any fmp13 release note about this.
rivet Posted January 29, 2014 Author Posted January 29, 2014 my php guy came up with this: <?php // Get cURL resource $curl = curl_init(); //Define header array for cURL requestes $header = array('Contect-Type:application/xml', 'Accept:application/xml'); // Set some options - we are passing in a useragent too here curl_setopt_array($curl, array( CURLOPT_HTTPHEADER => $header, //Set http header options CURLOPT_URL => 'http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.xchange%20where%20pair%20in%20(%22CADUSD%22)&diagnostics=true&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys', CURLOPT_HTTPGET => TRUE //Set cURL to GET method )); // Send the request & save response to $resp $resp = curl_exec($curl); // Close request to clear up some resources curl_close($curl); exit; ?> this is an extra layer, but for now it should do, while I investigate FMP or perhaps I will investigate another source for exchanges rates
rivet Posted January 29, 2014 Author Posted January 29, 2014 wow, complete bust on the XML. Had to write script loop incase import resulted in a null, then when I set a schedule on server13 (win) it was giving me 718 errors. Plan B! URL: http://rate-exchange.appspot.com/currency?from=USD&to=CAD&q=1 result: {"to": "CAD", "rate": 1.11666, "from": "USD", "v": 1.11666} inserted url into a field then parsed. Just one of those days. (Hey Comment, as always, thanks for your time and help)
comment Posted January 29, 2014 Posted January 29, 2014 I don't know: it seems very strange to me. There has been a change in v.13 with regard to requesting a XML response, but I don't think it should break existing requests. Have you tried reconstructing the import step from scratch in v.13? If it doesn't work, you should report it as a bug.
Recommended Posts
This topic is 4008 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now