Discussions

Expand all | Collapse all

API Boot Camp App

  • 1.  API Boot Camp App

    Posted 11 days ago
      |   view attached
    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.
    ------------------------------


  • 2.  RE: API Boot Camp App

    Posted 10 days ago
    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
    ------------------------------



  • 3.  RE: API Boot Camp App

    Posted 10 days ago
    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.
    ------------------------------

    Attachment(s)



  • 4.  RE: API Boot Camp App

    Posted 10 days ago
      |   view attached
    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
    ------------------------------

    Attachment(s)

    js
    issueUpdated.js   2K 1 version


  • 5.  RE: API Boot Camp App

    Posted 10 days ago
    Hi Neil,

    Thanks for the debugging file.  I put in your javascript page in the api_doquery. So I am getting the debugging error. 

    There are two database tables. I want the search on 'bqiugimre' . I added it to the url variable in the program and with the token I created in my app. But the debugger is stopping on the 'bqiugimvj' database table. 

    Could that be the problem. I thought I changed it, but not sure what is going on, but I think the 'bqiugimre' is the one I want to read the data from?



    ------------------------------
    Bob T.
    ------------------------------



  • 6.  RE: API Boot Camp App

    Posted 10 days ago
    Bob,
    I should have deleted the debugger statement.  That stops the script from running so you can see what's happening.  Delete that line and try again.  Also the dbid should be of the table you want to read the records from.  The errors are reported in the else clauses of the if statements.
    Let me know..
    Neil

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



  • 7.  RE: API Boot Camp App

    Posted 10 days ago
      |   view attached
    Finally worked. Thanks Neil.



    ------------------------------
    Bob T.
    ------------------------------