How to Check For Duplicate Invoice Before adding New Invoice Using Quickbook API - quickbooks-online

I have integrated quickbook on my website. I am sending request through XML For Adding Invoice in Quickbook.
Its working fine from long time. now i want to check for duplicate invoice through Quickbook API as sometime we couldn't get response from quickbook for adding invoice so we again send request to add invoice so it gets duplicate invoice so if any api of quickbook which helps in checking duplicate invoice before adding any invoice through api.
I couln't find any api on quickbook documentation for checking duplicate invoice.
Thanks

If you don't have the TxnID, there really isn't a way to detect a "duplicate" invoice in QuickBooks.
The closest you can get is querying by RefNumber (QuickBooks qbXML for querying by RefNumber), but because QuickBooks allows duplicate RefNumbers (i.e. it's perfectly valid in QuickBooks to have two or more Invoice #1234s) there's no guarantee that the invoice that you get back from that query is the invoice that you created.
With all of that said, it sounds like you're trying to solve the wrong problem. You're trying to solve this:
now i want to check for duplicate invoice through Quickbook API
When you should be trying to solve this:
sometime we couldn't get response from quickbook for adding invoice
If you're talking about QuickBooks Online
You should always get some sort of HTTP response back from the QuickBooks Online servers. If you don't get something back, it's likely that you're not waiting long enough for the response, or that you have an error in your code which isn't processing the response correctly.
Can you post your cURL curl_getinfo($curl) output, and the result of ->lastRequest() and ->lastResponse() from your code?
If you're talking about QuickBooks for Windows
It's important to recognize that QuickBooks and the Web Connector will ALWAYS try to send a response to you (QuickBooks Web Connector documentation). ALWAYS. The only way you can miss a response completely is if you lose your internet connection, and even then you should at the very least know whether or not the request was sent to QuickBooks and thus know not to send it again.
If you're not getting a response, then there is a 99.9% chance that you are doing something incorrect which is causing you to not get the response.
The bottom line:
You should focus on why you're not getting the responses in your program and fix the source of this problem, rather than trying to fix a symptom.

Related

Microsoft Graph API subscription triggers same email with different IDs

I have a weird hard-to-replicate issue with Graph API and Outlook subscription endpoints. A user is authorised in my app and subscription is created for me/messages with change type created.
Everything works fine in 99% of the cases, but once in a while the endpoint is triggered several times with the same email. There is no changes to the email or any other part of the request, except ID, even timestamp. I have no idea how to replicate it consistently and/or fix an issue. Is there any scenario where Graph API would send the same message twice with slightly different IDs? It looks like they are sequentially generated IDs too, as they differ by 1-3 characters in the very end.

Remove "[External]" tags added by email server

My organization has begun adding obnoxious warnings to the subject and body of any email that arrives from an external address. My organization allows email forwarding, and I forward to gmail. I would like to have the extra text automatically removed before I see them in gmail. This would not violate the policies at my organization. Some ideas I had:
(1) One option would be to set up a gmail filter that edits the message. This feature does not seem to exist.
(2) Another option would be to customize the display so that this particular text is never shown on the screen. Again, there seems to be no way to do this.
(3) I wrote a script in Google Apps to grab to the content of each offending email and send an edited version to myself, but there is no way to make the "from" field show the original sender (perhaps with good reason). I can put that information in "reply to" but the gmail client doesn't show it nicely. This removes the annoying extra text at the cost of the ability to easily see who sent the email. The core of it is this call:
GmailApp.sendEmail("<my_email_address>",newSubject,newBody,{
attachments: message.getAttachments(),
bcc: message.getBcc(),
cc: message.getCc(),
htmlBody: newBody,
replyTo: message.getFrom(),
});
Any ideas? This is becoming a big problem as the "nanny state" approaches, so I'm sure others will appreciate your solution.
Issue
It unfortunately seems that at the day of this post, there is no way of edditing a forwarded email with the Gmail API. Check the documentation to see what you can actually do with the Gmail API in regards to forwarding email addresses.
Workaround
Despite it is not possible to edit a forwarding email address, in your case you are interested in:
Edit the body and subject of the email address.
Preserve the information of who the sender was.
Therefore what you could do is:
Get the email address you want to edit. Get the body, subject and information about who was sending it and store that.
Create a new message where you edit the message you just got and write on the subject the from field that was in the message you just got.
Send that created message to your desired recipient just like it was a forwarding email.
I hope this has helped you. Let me know if you need anything else or if you did not understood something. :)
Apps Script
You can insert messages into your inbox with their original "From" field but a modified body.
Note: Inserting is different from sending because the message is created on the inbox with less validation than sending.
To use this on Apps Script, take a look at the Advanced Gmail Service.
Custom Application
Another idea on how to do this is to use a custom application (in any language you'd prefer) that:
scans your company inbox with IMAP
manipulates the message body to remove the artifacts you don't want
insert manipulated message into your Gmail inbox with the Gmail API

How to unpublish an iCal (*.ics) feed?

One feature on my site allows registered users to create calendars for their organization. We provide a dynamically-generated iCal feed for these calendars through a URL with query-string parameters. Anyone can subscribe to these feeds by entering the provided URL into Google Calendar, Outlook, iPhone, etc...
This has been working well enough for a few years, but we now have a problem with stale or deleted calendars. If a registered user significantly alters or deletes their account, the calendar will no longer exist and the feed is useless. We currently return a "404 - Not Found" error for those requests (recently changed from "400 - Bad Request").
My question is, other than returning the 404, is there any way to get subscribers to stop requesting a bad feed? This is a similar question, where the accepted answer suggests returning 404 or 410 and hoping the clients will see the error and manually remove the subscription.
That doesn't seem to be working so far. We get ~ 100k feed requests an hour and a full 30% of those are for deleted calendars.
Do Google, Apple, et al not give up when they repeatedly get a 404 for a feed? How have others handled this issue?
If this was just a problem with log pollution I wouldn't worry too much about it. However, since the feeds are dynamically generated, each request hits the backend db. The processing is trivial and doesn't appear to be affecting performance, but the situation can only get worse.
Apologies if this belongs on ServerFault. While the issue affects my servers, I believe the solution is programmatic.
I don't believe there is an easy answer - I think it's been asked before.
It's like having to deal with all the traffic when some hackers use your site for target practise on logins or xmlrpc or just looking for vulnerabilities. Or the spammers trying a scatter gun approach sending emails. Or when a web spider decides to excessively crawl your site. You have to size for all that non useful traffic.
You could possibly generate and keep up to date a list outside of the database of the bad ics URLs and have a script check and bounce the request before it gets near the database ?
Basically try to deal as efficiently as possible with the problem.
You could also in account deletion try adding a step that requests the user go to their calendar programs and delete the feed before continuing. However that might cause bad vibes and probably would not totally fix it anyway.

Handlig large number request on the http server

I am planning to create a website for questioning and answering purpose. The website will contain the more functionality in the future. So the request will be increasing from the future point of view towards the website.
for example, the request may be like 2000 or more per second. Also the processing of request will requires some validation like user-name/password. After the request is validated, it is required save the data to the database.
I also want to know how to check the data write speed from multiple user's request from the server at a time.
Please let me know TIA...

Pulling facebook and twitter status updates into a SQL database via Coldfusion Page

I'd like to set up a coldfusion page that will pull the status updates from my own facebook account and twitter accounts and put them in a SQL database along with their timestamps. Whenever I run this page it should only grab information after the most recent time stamp it already has within the database.
I'm hoping this won't be too bad because all I'm interested in is just status updates and their time stamps. Eventually I'd like to pull other things like images and such, but for a first test just status updates is fine. Does anyone have sample code and/or pointers that could assist me in this endeavor?
I'd like it if any information relates to the current version of the apis (twitter with oAuth and facebook open graph) if they are necessary. Some solutions I've seen involve the creation of a twitter application and facebook application to interact with the APIs; is that necessary if all I want to do is access a subset of my own account information? Thanks in advance!
I would read the max(insertDate) from the database and if the API allows you, only request updates since that date. Then insert those updates. The next time you run you'll just need to get the max() of the last bunch of updates before calling for the next bunch.
You could run it every 5 minutes using a ColdFusion scheduled task.
How you communicate with the API is usually using <cfhttp />. One thing I always do is log every request and response, either in a text file, or in a database. That's can be invaluable when troubleshooting.
Hope that helps.
Use the cffeed tag to pull RSS feeds from Twitter and Facebook. Retain the date of the last feed scan somewhere (application variable or database) and loop over the feed entries. Any entry older than last scan is ignored, everything else gets committed. Make sure to wrap cffeed in a try/catch, as it will throw errors if the service is down (ahem, twitter) As mentioned in other answers, set it up as a scheduled task.
<cffeed action="read" properties="feedMetadata" query="feedQuery"
source="http://search.twitter.com/search.atom?q=+from:mytwitteraccount" />
Different approach than what you're suggesting, but it worked for us. We had two live events, where we asked people to post to a bespoke Facebook fan page, or to Twitter with a hashtag we endorsed for the event in realtime. Then we just fetched and parsed the RSS feeds of the FB page, and the Twitter search results, extracting what was new, on a short interval... I think it was approximately every three minutes. CFFEED was a little error-prone and wonky, just doing a CFHTTP get of the RSS feeds, and then processing the CFHTTP.filecontent struct item as XML worked fine
.LAG

Resources