Discussions

Expand all | Collapse all

First Webhook, First Error. API_AddRecord

  • 1.  First Webhook, First Error. API_AddRecord

    Posted 03-27-2019 17:27
    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. 


  • 2.  RE: First Webhook, First Error. API_AddRecord

    Posted 03-27-2019 17:32

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


  • 3.  RE: First Webhook, First Error. API_AddRecord

    Posted 03-27-2019 17:55
    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 &. 


  • 4.  RE: First Webhook, First Error. API_AddRecord

    Posted 03-28-2019 09:11
    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.


  • 5.  RE: First Webhook, First Error. API_AddRecord

    Posted 03-28-2019 10:08
    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? 


  • 6.  RE: First Webhook, First Error. API_AddRecord

    Posted 03-28-2019 13:01
    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. 


  • 7.  RE: First Webhook, First Error. API_AddRecord

    Posted 03-28-2019 13:36
    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>
     


  • 8.  RE: First Webhook, First Error. API_AddRecord

    Posted 03-28-2019 13:42
    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


  • 9.  RE: First Webhook, First Error. API_AddRecord

    Posted 03-28-2019 14:24
    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.


  • 10.  RE: First Webhook, First Error. API_AddRecord

    Posted 03-28-2019 16:25
    Thanks everyone, now have this working and found out it's not very good at filling in dropdown fields.  Darn! 


  • 11.  RE: First Webhook, First Error. API_AddRecord

    Posted 03-28-2019 17:59
    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. 


  • 12.  RE: First Webhook, First Error. API_AddRecord

    Posted 03-28-2019 18:07
    ... 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).


  • 13.  RE: First Webhook, First Error. API_AddRecord

    Posted 04-02-2019 09:26
    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.  


  • 14.  RE: First Webhook, First Error. API_AddRecord

    Posted 04-02-2019 14:03
    Build a formula in the source table to combine the two field values; and then push the value of the formula into the destination field.


  • 15.  RE: First Webhook, First Error. API_AddRecord

    Posted 04-02-2019 14:09
    I've done that as 

    <field fid="10">[items_total][Company Name]</field>

    But I don't know the correct coding for a space, e.g.

    <field fid="10">[items_total] & " " & [Company Name]</field>

    I'm sure this would fail and I'm tempted to try:- 

    <field fid="10">[items_total]%20[Company Name]</field>

    But can't find anything regarding this scenario, anywhere.




  • 16.  RE: First Webhook, First Error. API_AddRecord

    Posted 04-02-2019 14:38
    No, build a formula in your table to combine the two field values together.  I do not believe you can push two values from separate fields into a single field within a Webhook.  I'm happy to be corrected.  But creating a formula specifically for this purpose in the table would be the easiest solution.


  • 17.  RE: First Webhook, First Error. API_AddRecord

    Posted 04-02-2019 14:48
    Grief, the answer to everything is add more fields, I've got close to 700 fields in this table already... I'll create a blank field and add that in as a spacer.  

    I have got this line which does work :
    <field fid="11">[products][billing_company][billing_first_name][billing_last_name]</field>

    Which has 4 fields into one via the webhook but no space between them.  I was hoping for a bit of code to create a space but a blank field will do.




  • 18.  RE: First Webhook, First Error. API_AddRecord

    Posted 04-02-2019 14:51
    perhaps then build 1 formula field which is a forced space; and use that as a field to encode between the values repeatedly.  You may then be able to use that same 'space' formula for other purposes.

    [value 1][space][value2][space]


  • 19.  RE: First Webhook, First Error. API_AddRecord

    Posted 04-02-2019 14:58
    Exactly, this is what I've just done.  I have blank fields to keep items in line when designing awkward screens.  I've set the width to be 2 characters so hopefully it will read well.  


  • 20.  RE: First Webhook, First Error. API_AddRecord

    Posted 04-03-2019 08:32
    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.