yahoo finance api returns empty response - yql

My application showing stock market data. I am using YQL for fetching stock data.
http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.quotes%20where%20symbol%20in%20(%22SBIN.NS%22)&env=store://datatables.org/alltableswithkeys&diagnostics=true&format=xml
Lats two days, When I am fetching morning or before (1.00 pm India time) then yql query returns empty response.
But right now it show exact problem
The query result is "yahoo.finance.quotes' has been blocked.
Response is
<query xmlns:yahoo="http://www.yahooapis.com/v1/base.rng" yahoo:count="0" yahoo:created="2012-09-26T11:24:22Z" yahoo:lang="en-US">
<diagnostics>
<publiclyCallable>true</publiclyCallable>
<url execution-start-time="20" execution-stop-time="23" execution-time="3" proxy="DEFAULT">
<![CDATA[
http://www.datatables.org/yahoo/finance/yahoo.finance.quotes.xml
]]>
</url>
<cache execution-start-time="25" execution-stop-time="26" execution-time="1" method="GET" type="MEMCACHED">
<![CDATA[ 13c4f8eac77ad886bade5a711c8c1ef5 ]]>
</cache>
<javascript name="yahoo.finance.quotes" verb="select">
<![CDATA[
com.yahoo.platforms.pipes.model.ModuleException: Error Codes: js.blocked.execute.request Message: "The current table 'yahoo.finance.quotes' has been blocked. It exceeded the allotted quotas of either time or instructions"
]]>
</javascript>
<user-time>26</user-time>
<service-time>4</service-time>
<build-version>30549</build-version>
</diagnostics>
<results/>
</query>
I am not exceed request limit 1000\hours. Just try in day 50 times.

"This is a community contributed table and used by multiple people. We mark a table as abusive if it seems to be hogging our resources, or consistently taking more than 30s to execute (this could also be due to a slow downstream source). This particular table seems to be getting marked as abusive more times than others. We also remove our blocks after a while, hence the sporadic working of the table. I would advise that you wait for official tables from Yahoo! Finance if your application needs a stabler data source."
http://developer.yahoo.com/forum/YQL/YQL-The-current-table-39-yahoo-finance-quotes-39-has/1332611837865-68d31e89-80e4-4691-91e6-86f687302ff4

Related

How to retrieve archived messages in the reverse order with XMPPFramework?

I'm implementing retrieving XMPP chat history with XEP-0313 Message Archive Management using XMPPFramework for iOS. I receive messages page by page using XMPPFramework's class XMPPMessageArchiveManagement. I'm able to receive the pages in the reverse order providing the message before which the next page should be.
let resultSet = XMPPResultSet(max: 50, before: theIdOfTheOldestReceivedMessage ?? "")
self.xmppMAM?.retrieveMessageArchive(at: to,
withFields: [field],
with: resultSet)
But I also would like to receive the messages on each page in the reverse order from the last one to the first one. According to the documentation I should provide the element in the query:
A client wishing for a reversed page should include the <flip-page/> element in its query, like so:
<iq type='set' id='q29309'>
<query xmlns='urn:xmpp:mam:2'>
<x xmlns='jabber:x:data' type='submit'>
<field var='FORM_TYPE' type='hidden'><value>urn:xmpp:mam:2</value></field>
<field var='start'>\<value>2010-08-07T00:00:00Z\</value>\</field>
</x>
<set xmlns='http://jabber.org/protocol/rsm'>
<max>10</max>
<after>09af3-cc343-b409f\</after>
</set>
<flip-page/>
</query>
</iq>
The source: https://xmpp.org/extensions/xep-0313.html#query-paging-flip.
The problem is that I don't populate the query myself: XMPPFramework is responsible for that. The framework generates the final XML and I'm only able to provide fields and a result set. The provided fields will be inside the x element, the provided result set will be a separate element of the queue. But how to provide the <flip-page/> element to the queue with XMPPMessageArchiveManagement by XMPPFramework?

Quickbooks API and detecting deleted items

I'm using the Quickbooks XML API to import salesorders, items, and customers. Everything works great, however I haven't figured out how to handle things that are deleted in Quickbooks. Querying the imported data in my system is not an option because I have 20,000+ salesorders. My question is, does Quickbooks have a query for deleted items?
QuickBooks for Windows:
If you're using QuickBooks for Windows, then you can do a TxnDeletedQueryRq request to get a list of recently deleted transactions.
Example:
<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="9.0"?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<TxnDeletedQueryRq>
<!-- TxnDelType may have one of the following values: ARRefundCreditCard, Bill, BillPaymentCheck, BillPaymentCreditCard, BuildAssembly, Charge, Check, CreditCardCharge, CreditCardCredit, CreditMemo, Deposit, Estimate, InventoryAdjustment, Invoice, ItemReceipt, JournalEntry, PayrollLiabilityAdjustment [PRIVATE], PayrollPriorPayment [PRIVATE], PayrollYearToDateAdjustment [PRIVATE], PurchaseOrder, ReceivePayment, SalesOrder, SalesReceipt, SalesTaxPaymentCheck, TimeTracking, TransferInventory, VehicleMileage, VendorCredit -->
<TxnDelType>Invoice</TxnDelType>
<TxnDelType>ReceivePayment</TxnDelType>
</TxnDeletedQueryRq>
</QBXMLMsgsRq>
</QBXML>
Example from here:
http://www.consolibyte.com/docs/index.php/QbXML_for_Querying_for_Deleted_Objects
http://www.consolibyte.com/docs/index.php/Example_qbXML_Requests
The full syntax with all options/flags you can set can be found in the QuickBooks OSR:
https://developer-static.intuit.com/qbSDK-current/Common/newOSR/index.html
QuickBooks Online:
If you're using QuickBooks Online, then you can use the CDC requests to poll for recently changed data, including things that have been deleted.
https://quickbooks.api.intuit.com/v3/company/1234/cdc?entities=Class,Item,Invoice&changedSince=2012-07-20T22:25:51-07:00
Will return something like:
<IntuitResponse xmlns="http://schema.intuit.com/finance/v3" time="2013-04-03T10:36:19.393Z">
<CDCResponse>
<QueryResponse>
<Customer>...
</Customer>
...
Some of which may have a status="Deleted" attribute to let you know it's been deleted.

Sending an order into Quickbooks via IPP doesn't work when transaction date is in the past

I've edited the question to make it more clean and focused now that I've investigated more.
Syncing orders are working for today's date and future dates, but not for dates in the past. I'm testing now directly in the API explorer.
Here is the add order request and response:
<!--Add order request-->
<Add xmlns="http://www.intuit.com/sb/cdm/v2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
RequestId="ecc53f53d70f0a52de4c88021721ba32"
xsi:schemaLocation="http://www.intuit.com/sb/cdm/v2 ./RestDataFilter.xsd ">
<OfferingId>ipp</OfferingId>
<ExternalRealmId>688875295</ExternalRealmId>
<Object xsi:type="SalesOrder">
<Header>
<DocNumber>6</DocNumber>
<TxnDate>2010-12-25</TxnDate>
<CustomerId idDomain="QB">4</CustomerId>
<SalesRepId idDomain="QB">1</SalesRepId>
</Header>
<Line>
<ItemId idDomain="QB">1</ItemId>
<Qty>6</Qty>
</Line>
</Object>
</Add>
<!--Add order response-->
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<RestResponse xmlns="http://www.intuit.com/sb/cdm/v2">
<Success RequestId="ecc53f53d70f0a52de4c88021721ba32">
<ObjectRef>
<Id idDomain="NG">802721</Id>
<SyncToken>1</SyncToken>
<LastUpdatedTime>2013-04-29T15:26:53Z</LastUpdatedTime>
</ObjectRef>
<RequestName>SalesOrderAdd</RequestName>
<ProcessedTime>2013-04-29T15:26:53Z</ProcessedTime>
</Success>
</RestResponse>
Here is the sync status and sync activity. There was only one entity with SalesOrder, but the times don't match up, so I don't believe its referencing the same order that I added via API explorer. Also, the order that I added did not appear in Quickbooks also.
<SyncStatusResponse>
<NgIdSet>
<NgId>802721</NgId>
<NgObjectType>SalesOrder</NgObjectType>
</NgIdSet>
<RequestId>DB7F4BF877006079E040900A0F1B14C1</RequestId>
<StateCode>8</StateCode>
<StateDesc>Record netted with QB</StateDesc>
<MessageCode>70</MessageCode>
<MessageDesc>MBL Netter success using QB SDK ext_ack_id</MessageDesc>
<ResponseLogTMS>2013-04-29T15:38:02.0Z</ResponseLogTMS>
</SyncStatusResponse>
<SyncActivityResponse>
<SyncType>Writeback</SyncType>
<StartSyncTMS>2013-04-10T12:42:21.0</StartSyncTMS>
<EndSyncTMS>2013-04-29T08:38:02.0</EndSyncTMS>
<EntityName>SalesOrder</EntityName>
<EntityRowCount>20</EntityRowCount>
</SyncActivityResponse>
From the sync status response, state code 8 means
Record netted. Synchronized. Object created in Data Services. Sync Manager has acknowledged synchronizing the object and mapped its NG ID to a QB ID in QuickBooks. Equivalent to StateCode 1 (for object created in QuickBooks).
Message code 70 seems to be ok base on its description, but it wasn't listed in the documentation.
In Quickbooks Destop, by default only the current Fiscal year transactions are displayed. Could you try changing the Date filter to "All", to see if the Sales Order made it ?
So your Request is succeeding but you are not seeing it in QuicKBooks after sync is run.
Check the sync status of the object, or you can see all the sync activity by calling these APIS
http://docs.developer.intuit.com/0025_Intuit_Anywhere/0050_Data_Services/v2/0500_QuickBooks_Windows/0600_Object_Reference/SyncActivity
http://docs.developer.intuit.com/0025_Intuit_Anywhere/0050_Data_Services/v2/0500_QuickBooks_Windows/0600_Object_Reference/SyncStatus
Even though your request succeeded, before it can by synced to QuickBooks it must pass the business rules to be created/updated on the desktop.
If your object encountered an error (lets say it was a duplicate) then you can add an errored object filter on your query to query for it as well.
regards
Jarred

How do I fetch orgusers beyond the 1st 100 using the Google Apps OrgUser provisioning API feed

I am using Zend's gdata library for the Google Apps provisioning API. Since Zend doesn't yet support fetching org users (no retrieve function provided by the library for this feed), I am making a custom gdata query to the url (as suggested in the documentation developers.google.com/google-apps/provisioning/#retrieving_organization_users_experimental):
apps-apis.google.com/a/feeds/orguser/2.0/'.$customerId.'?get=all
This works well for <= 100 users.
Now, I have created a domain with 125 users across 5 OUs. When I fetch the above URI, I get the 1st 100 users (as documented and expected). However, I could not find the pagination link mentioned here: developers.google.com/google-apps/provisioning/reference#Results_Pagination
Here's the start of my orguser feed:
<?xml version='1.0' encoding='UTF-8'?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:apps='http://schemas.google.com/apps/2006'><id>https://apps-apis.google.com/a/feeds/orguser/2.0/C00xxxxxxx</id><updated>2013-01-06T08:17:43.520Z</updated><**link rel='next' type='application/atom+xml' href='https://apps-apis.google.com/a/feeds/orguser/2.0/C00xxxxxxx?get=all&startKey=RASS03jtnz0s2orxmbn.**'/><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='https://apps-apis.google.com/a/feeds/orguser/2.0/C00xxxxx'/>
I tried the https://apps-apis.google.com/a/feeds/orguser/2.0/C00xxxxxxx?get=all&startKey=RASS03jtnz0s2orxmbn. link but it gives me the exact same 100 users that the https://apps-apis.google.com/a/feeds/orguser/2.0/C00xxxxxxx?get=all link gives. This is the only occurrence of the word "next" in my feed and so there is not other URI I can try to fetch the next 25 users.
So I have only been able to get 100 users from this API call. How do I go about fetching the next 25 users? Examples/code would be really appreciated. Or what am I doing wrong?
Please help - this is blocking an urgent delivery.
Thanks!,
Vinay.
Your 2nd request should look like:
https://apps-apis.google.com/a/feeds/orguser/2.0/C00xxxxxx?startKey=RASS03jtnz0s2orxmbn&get=all
startKey should be set to the value of the next parameter and get should continue to be all for each page request.
Also, make sure the URL is decoded, if & is encoded as & in the request, then Google's servers will see all of all&startKey=RASS03jtnz0s2orxmbn as the value of get and it won't see a startKey parameter at all.

Is there any service returning ZIP Codes on given city/satate?

is there any server available that i can use for getting zip codes on the basis on city/state ?
Thanks
You can use geonames postal code search. For example:
http://ws.geonames.org/postalCodeSearch?adminCode1=CA&placename=San+Francisco&maxRows=3
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<geonames>
<totalResultsCount>76</totalResultsCount>
<code>
<postalcode>94102</postalcode>
<name>San Francisco</name>
<countryCode>US</countryCode>
<lat>37.781334</lat>
<lng>-122.416728</lng>
<adminCode1>CA</adminCode1>
<adminName1>California</adminName1>
<adminCode2>075</adminCode2>
<adminName2>San Francisco</adminName2>
<adminCode3/>
<adminName3/>
</code>
<code>
<postalcode>94103</postalcode>
<name>San Francisco</name>
<countryCode>US</countryCode>
<lat>37.77254</lat>
<lng>-122.414664</lng>
<adminCode1>CA</adminCode1>
<adminName1>California</adminName1>
<adminCode2>075</adminCode2>
<adminName2>San Francisco</adminName2>
<adminCode3/>
<adminName3/>
</code>
<code>
<postalcode>94107</postalcode>
<name>San Francisco</name>
<countryCode>US</countryCode>
<lat>37.762147</lat>
<lng>-122.397099</lng>
<adminCode1>CA</adminCode1>
<adminName1>California</adminName1>
<adminCode2>075</adminCode2>
<adminName2>San Francisco</adminName2>
<adminCode3/>
<adminName3/>
</code>
</geonames>
You can use the US Postal Service HTTP/XML API
According to this page on the US Postal Service website which documents their XML based web API, specifically Section 3.0 (page 13) of this PDF document, they have a URL where you can send an XML request containing an address minus the Zip Code and they will respond with an XML document containing the complete address.
You can't do a lookup with just a city and state though, because a single city can contain multiple ZIP codes, so you need to pass the street address as well.
According to their documentation, this is what your request would look like:
GET http://SERVERNAME/ShippingAPITest.dll?API=ZipCodeLookup&XML=<ZipCodeLookupRequest%20USERID="xxxxxxx"><Address ID="0"><Address1></Address1> <Address2>6406 Ivy Lane</Address2><City>Greenbelt</City><State>MD</State></Address></ZipCodeLookupRequest>
And here's what you would receive back:
<?xml version="1.0"?>
<ZipCodeLookupResponse>
<Address ID="0">
<Address2>6406 IVY LN</Address2>
<City>GREENBELT</City>
<State>MD</State>
<Zip5>20770</Zip5>
<Zip4>1441</Zip4>
</Address>
</ZipCodeLookupResponse>
USPS does require that you register with them before you can use the API, but, as far as I could tell, there is no charge for access. By the way, their API has some other features: you can do Address Standardization and Zip Code Lookup, as well as the whole suite of tracking, shipping, labels, etc.

Resources