Forum Discussion

BobThomas1's avatar
BobThomas1
Qrew Cadet
5 years ago

API Boot Camp App

Hi ~ I'm using the API Boot Camp app to learn the QB API. I have progressed to the code page section, which I assume I am using the API_DoQuery javascript page to generate four fields in an XML response. 

I am not getting any records. I am posting what my Chrome browser shows in the developer console window.

Any suggestions about what I'm doing wrong. I tried putting in the url https, and tableDBID. I thought maybe a token so I created one for the app. 

Not  sure what I'm doing wrong?

------------------------------
Bob T.
------------------------------
  • Bob,
    If you could paste the url and your xml, I can help you with this. The screen is indicating that the url is incorrect.

    ------------------------------
    Neil Schneider
    ------------------------------
    • BobThomas1's avatar
      BobThomas1
      Qrew Cadet
      Neil,

      I have attached a few snapshots to hopefully hope. I ran the DoQuerys from the URL line and have successfully created XML data for. The last part of the API lesson had you look at doquery.js, so I have attached that file, with the url path and database table. (I am thinking I am getting the database IDs wrong.) 

      The lesson has you go behind the 'launch code page button'. I have tried to change the paths and databases to what the organization I am working for uses. I even created a auth. token, but not sure I did this right. (I took out the actual token characters and put in (TOKEN_ENTERED_HERE instead). I figured that I had to have the write url, path & database ID correct, and that if it is running the  javascript program that I must have a legitimate user auth token. 

      Of course the instructor says to turn on javascript console.

      Maybe I need to just run the code URL from the url to troubleshoot. The data is supposed to show up in the JavaScript console as text, not xml. But I just get 'script loaded' but no data records is above this, which there should be.




      ------------------------------
      Bob T.
      ------------------------------
      • NeilSchneider's avatar
        NeilSchneider
        Qrew Cadet
        I don't think your request is returning any rows.  The problem is with the processRecords function, it doesn't check for errors.  This line is the culprit:
        xml.find('qdbapi').find('record').each(function(index)
        It assumes each 'find' actually get a result, but it doesn't appear to be.
        I updated your code to match one of my test environments and the problem is (most likely) that no records are being returned.  I've attached an updated version of the code you supplied, and you'll see the changes in the processRecords function.  It should also log an error if you're getting a different issue.
        Note if there was an api error you'll see the code in the log.
        Let me know how it goes..
        Neil

        ------------------------------
        Neil Schneider
        ------------------------------