Skip to main content
Question

API_AddRecord works, API_GenAddRecordForm doesn't.

  • April 26, 2018
  • 0 replies
  • 54 views

API_GenAddRecordForm works fine for me when calling it from a webpage, but from my javascript page I only seem able to get API_AddRecord to work, but it doesn't take me to the record after generating it.  And, when I try API_GenAddRecordForm from Postman, instead of a qdbapi error report I get thousands of lines of html code.  My goal is to generate a new record and then view it in Edit mode from my javascript page.  What would be the correct syntax for that API call?  Thank you!
This topic has been closed for replies.

  • Quickbase Alumni
  • April 26, 2018
Everything is working properly - there is just some confusion over how to use the API calls.

The vast majority of the API methods return a single XML document as a response. The method API_GenAddRecordForm is an exception as it returns a HTML document as a response and included in this response are links and references to other resources such as JavaScript files, CSS files, font files etc.

When  API_GenAddRecordForm is loaded from a hyperlink or entered into the address bar of a Browser, the Browser will make additional calls to the other resources and assembles everything into a visible page. However, when Postman loads API_GenAddRecordForm it only grabs the raw HTML response and does not request the other resources nor does Postman render the page (it isn't a browser and doesn't even have a rendering engine).

This explains everything your report.

The area where you are probably going astray is that in your JavaScfipt you are probably calling API_GenAddRecordForm using:
$.get("...?act=API_GenAddRecordForm...") 
when you should be using:
document.location.href = "...?act=API_GenAddRecordForm..."  

  • Author
  • Quickbase Alumni
  • April 26, 2018
Aha - that explains a lot.  Thank you!

  • Author
  • Quickbase Alumni
  • April 26, 2018
But actually, I'm using :

var url = "https://xxxx.quickbase.com";  
  url    += "/db/";
  url    += "abcdefghi";
  url    += "?a=API_AddRecord";

and then the url gets called from $.ajax

so now I'll try rewriting the javascript without the .ajax