AddRecord shows Errorcode 2 Invalid Input

  • 0
  • 1
  • Question
  • Updated 6 years ago
  • Answered
I tried to use the API call to add record to my QB database but it always shows
<qdbapi> <action>API_AddRecord</action> <errcode>2</errcode> <errtext>Invalid input</errtext> </qdbapi>
My call looks like
https://intuitcorp.quickbase.com/db/dbid
?act=API_AddRecord&username=XXX&password=X&_fid_6=EBS&_fid_7=Systems&_fid_8=Issue&apptoken=b5kvidr23naegb3f8ki3bxv34uk
My table have total of 10 fields but the wiki says I don't have to pass in all 10 as long as they are not required. The three fields I passed in are all Text type so it shouldn't be the type issue. Any thoughts on this?
Photo of Malluce

Malluce

  • 0 Points

Posted 6 years ago

  • 0
  • 1
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 30,434 Points 20k badge 2x thumb
I don't see any obvious problem but there could be an issue with the data you are not showing us. You are apparently authenticated or you would have received another error message. See:

http://www.quickbase.com/api-guide/index.html#errorcodes.html

Break it down to debug. Log out and try to see if you can query for data:

https://intuitcorp.quickbase.com/db/dbid?act=API_DoQuery&username=XXX&password=XXX&apptoken=b5kvidr23naegb3f8ki3bxv34uk

Then try add a record one field at a time

https://intuitcorp.quickbase.com/db/dbid ?act=API_AddRecord
&username=XXX &password=XXX &apptoken=b5kvidr23naegb3f8ki3bxv34uk &_fid_6=EBS

Regarding the sub-domain intuitcorp, it this the subdomain used internally by Intuit employees?
Photo of Malluce

Malluce

  • 0 Points
Thanks for the response! Here are something I found by using DoQuery.
I was accessing the application dbid instead of table dbid. I'm sure this will cause an error. With the correct dbid the query returns expected result.
After I fixed this everything works properly! Thanks! That's a really good way to debug...lesson learned.
Regarding your question...yes. I can't believe I forgot to remove sub-domain AND apptoken.....I must be too tired =(
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 30,434 Points 20k badge 2x thumb
One more point: I didn't ask you what language you were using to send the API request. If you are using JavaScript from a QuickBase page you will already be logged in which case you do not need to authenticate as your ticket will be sent as an HTTP cookie automatically by the browser. If this is the case you can drop your username and password as parameters.
Photo of Malluce

Malluce

  • 0 Points
I'm using the HTTP API...I didn't pass in a ticket so I have to go with the username/password way.
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 30,434 Points 20k badge 2x thumb
Are you using JavaScript or another language such as Java, Python, Ruby to call the API? If you are using JavaScript from a QuickBase page to call the API you are probably already logged in in which case you don't need to sent the username or password as your browser will send a cookie representing the ticket automatically.
Photo of Malluce

Malluce

  • 0 Points
No, I just pass in the URL...using command line by doing curl -k