Skip to main content
Question

First Webhook, First Error. API_AddRecord

  • March 27, 2019
  • 0 replies
  • 248 views

Trying my first web hook.  This is the code so far:


MyData
%b33nat_ks4k_dkqpnf9dgmkmb2bhh-----%
[items_total]
"W - Won"
"Bombouche"
[products]
[total_ex_tax]


This is for when a record is added.
Http: POST, Format XML, Message header QUICKBASE-ACTION / API_AddRecord

Error Message


API_AddRecord
11
Could not parse XML input
XML Parsing Error. not well-formed (invalid token) at line 4 column 21 (which is byte 103)
mydata


I watched a youtube guide on this and have looked around this site but can't find an answer for it.  Is there a working example out there, I'd would like a screen print if possible.  

I'm not sure if anything has changed since the video was put up and now.  I had this with an app token but that failed with the same issue too. The user token is brand new. 
This topic has been closed for replies.


If that is the actual user token, it looks incorrect.

Forum|alt.badge.img+17
  • Community Moderator
  • March 27, 2019
Hi Jack,

As a best practice for User Token you would want to keep them secure and be careful of sharing them. They function as a form of authentication within our API calls and can allow access to your data. To be on the safe side the end of this User Token has been cut out. If that was an actual User Token I would suggest deactivating it and instead replacing it with a new one if possible just to be on the safe side. 

As for error code 11 that error often comes up when the body of a Webhook contains XML characters that the API has trouble differentiating from your actual Webhook code. They can cause the message to become garbled. Do any of these fields you are passing over contain text elements and possible unique characters or XML character? Common culprits can be ", ', <, >, and &. 

  • Author
  • Registered
  • March 28, 2019
Thank you, I'll delete the user token but this is my test db but I'll be more careful, thankyou for answer, I'll check the data and see what pop's up.

  • Author
  • Registered
  • March 28, 2019
I've checked the data and can't see any offending characters, if this is working as I'd expect it to I just added one order to the source table I'd expect to see this appear in the destination table but the information is very simple and no strange characters.  The tables are about a year old so this web hook would be a new thing and cuts out a bit of manual work.  Would the script just be looking at the new row or the entire table? 

Forum|alt.badge.img+17
  • Community Moderator
  • March 28, 2019
Whenever the webhook was triggered it would only be looking at any records that triggered the webhook, not the full table. If you are seeing that error still and your body doesn't have any of the possible trouble characters in it then there might just be a syntax error. In your live one did you have % signs around the usertoken as your example did? Also it looks like some of the markup may have gotten chewed up by the forum, could you repost the webhook again and I would suggest using the pre setting in the format bar when you submit it to help keep it from being chewed up by the forum input. I would be happy to give it another look over and see if anything jumps out at me. 

  • Author
  • Registered
  • March 28, 2019
I saw the % thing from another posting.    When these are removed I get error 83 - "User Token Invalid" which is annoying as it's new.
<qdbapi>
<udata>MyData</udata>
<usertoken>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</usertoken>
<field fid="10">[items_total]</field>
<field fid="14">"W - Won"</field>
<field fid="70">"Bombouche"</field>
<field fid="11">[products]</field>
<field fid="12">[total_ex_tax]</field>
</qdbapi>
 

Forum|alt.badge.img+17
  • Community Moderator
  • March 28, 2019
Well that is a step forward, I would suggest making sure that your new User Token is assigned to the right app or apps if this is passing data between two apps just to be sure it is assigned. For a standard webhook you wouldn't want those %s around the User Token in my experience

Forum|alt.badge.img+12
  • Registered
  • March 28, 2019
Between the > < on the usertoken line; are you using the name of the Usertoken from the drop-down list in the fields or are you pasting it in.  Try the former.  Sometimes I have had a hard time with the Usertokens; and I've had to copy the full Usertoken value to test that the webhook is working.  Once it is; I then try to revert it back to the selected token Name from the list.

Sometimes; I have had to rebuild a Webhook from scratch.  Also; I never use the <udata> line - it's unecessary.

  • Author
  • Registered
  • March 28, 2019
Thanks everyone, now have this working and found out it's not very good at filling in dropdown fields.  Darn! 

Forum|alt.badge.img+17
  • Community Moderator
  • March 28, 2019
I am glad to hear that was helpful, and sometimes it is the littlest detail that drives you crazy after you build out something bigger. I've done the exact same thing before. 

... I'm late to chime on on this thread, but out of curiosity, are you using a Webhook to learn the syntax for tacking something more complicated in the future?  ie why not just use a no code Automation?  Or is this perhaps a Cross Realm Webhook (which can probably be done with an Action).

  • Author
  • Registered
  • April 2, 2019
Trying stuff out, I'm not familiar with all the components of Quickbase and do have a table from Big Commerce which needs loading. 

But, I would like to know if you can put two fields from the source into one field in the destination, I've not seen any syntax for this so just going one for one at the moment.  

  • Author
  • Registered
  • April 3, 2019
For anyone who finds this, a few hints:

<field fid="11">[products], [billing_company], [billing_first_name] [billing_last_name]</field>
You can add more than one source field for a destination field, and put commas between the fields.  

Populating a drop down:
<field fid="14">W - Won</field>
Don't use quotation marks in the field value.