Forum Discussion

MannyHernandez's avatar
MannyHernandez
Qrew Trainee
5 years ago

API Add_Record using URL Alternative and Field NAMEs rather than ID

Hello,

Usually, I post new records via API using field IDs. For a new specific case, I have to use Field NAMES. 

I see in the API documentation that this is supposed to be possible in theory. But in application, it does not seem to work. A new record will be posted  but all the fields come out blank.

Does anyone have the same problem?

https://target_domain/db/target_dbid?a=API_AddRecord&_fnm_second_year=1776
&_fid_8=changed&ticket=auth_ticket&apptoken=app_token


From API guide
"

Using field IDs and field names

When specifying fields, you can use either field IDs (fids) or field names. Field names are nearly identical to field labels; if you know the field label, you can determine the field name by converting all characters to lowercase and replacing all non-alphanumeric characters (including spaces) with an underscore.

For example, for a field with this label...

Event Name

...you should use this field name:

event_name

You can use a mixture of fids and field names in the same API call.

  • To obtain a field name, first determine the field's label (using API_GetSchema, or by viewing the field in the Quick Base application UI.) You can derive the field name by replacing uppercase characters with lowercase characters and using underscores instead of all non-alphanumeric characters.

  • To obtain a fid, use API_GetSchema. If you are an application manager, you can also obtain the fid using the Quick Base UI by customizing field properties."

    https://help.quickbase.com/api-guide/add_record.html


------------------------------
Manny Hernandez
------------------------------

7 Replies

  • API_AddRecord works for me when using field names.

    URLRoot() & "db/" & [_DBID_TABLENAME] & "?a=API_AddRecord&_fid_12=" & URLEncode ([Record ID#])& "&_fnm_text4=Test insert text&z=" & Rurl()ā€‹


    There may be something wrong with the formula URL you are using, post the formula and field names.

    ------------------------------
    Everett Patterson
    ------------------------------
  • AustinK's avatar
    AustinK
    Qrew Commander
    Where did you see that using "fnm" instead of fid was the way to do it in the URL? I was unable to find information on that.

    The only thing I see in the help doc you posted is that you can do this when you do an api call with XML. I don't see it mentioned that field name will work in the URL but I would be interested in figuring that one out too.

    Why are you unable to use the field ID in this specific case? I'm just curious why that would be a limitation.
      • AustinK's avatar
        AustinK
        Qrew Commander
        Yes that shows how to do it in an XML call but I am still not seeing where it says to replace fid with fnm. That was what I was wondering about because it sounded like they were using another resource than the regular docs.
    • MannyHernandez's avatar
      MannyHernandez
      Qrew Trainee
      @austink
      "Why are you unable to use the field ID in this specific case? I'm just curious why that would be a limitation."

      Homeadvisor post using a "simple" http post method that does not allow them to post using "custom fields." Dumbest thing ever... they can only post using their field names period. No way around it. 

      The solution, without using zapier, was to create a specific table with field names that would match theirs. once it comes into QB table, then I can auto-webhook it to drop into the proper table using field IDs and proper field types. 
      ā€‹

      see their attached http instructions.

      ------------------------------
      Manny Hernandez
      ------------------------------
      • RyanStanford1's avatar
        RyanStanford1
        Qrew Captain
        Would it be possible to make a field in QB to already premap the values you need into one field... and have that one compiled field to be the body of the webhook?

        ------------------------------
        Ryan Stanford
        ------------------------------