api_authenticate returns error 20, Unknown username/password

  • 0
  • 1
  • Question
  • Updated 2 years ago
  • Answered
I am trying to do the api_authenticate in order to do the api_importfromCSV and am failing.  It seems pretty simple, but it is failing.

Here is the link
 $urlQuery=" https://fixandpaint.quickbase.com/db//main?a=API_Authenticate&appToken=xxx_valid_token&usern..."


 $data=Invoke-RestMethod -Uri  $urlQuery

But even running the link manually gives the error.

Any help would be greatly appreciated.

Thanks,
Dean
Photo of Dean

Dean

  • 532 Points 500 badge 2x thumb

Posted 2 years ago

  • 0
  • 1
Photo of Dean

Dean

  • 532 Points 500 badge 2x thumb
Would an "=" sign in the password field cause issues?
Photo of Dean

Dean

  • 532 Points 500 badge 2x thumb
Mystery solved... sort of... the = was causing the problem.  Is there a way to escape special characters like the = in a password?
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 26,522 Points 20k badge 2x thumb
Use %3D for =.

I don't know what language you are using but every modern language has a URLEncoding function. If you URL is coming from the QuickBase formula language you use this:

URLEncode([url])
Photo of Dean

Dean

  • 532 Points 500 badge 2x thumb
Thanks Dan.  I am using powershell... I will lookup the urlencode.
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 26,272 Points 20k badge 2x thumb
$Encode = [System.Web.HttpUtility]::UrlEncode($URL) 

$Decode = [System.Web.HttpUtility]::UrlDecode($Encode) 

Do us a favor and post your script when it is debugged.
Photo of Dean

Dean

  • 532 Points 500 badge 2x thumb
I decided to not use the authenticate and use the usertoken instead.  instead of the xml, I used the URL approach, and for that I was having issues with the multiple records being handled by QB.  It kept coming back and saying 1 record input, regardless of how many were included.

The solution involved adding a carriage return after each data row ("`r`n ").  Then I had issues with strings, but encapsulating them in double quotes fixed that.

Saga over for now... :)  Thanks for the help Dan.